Skip to content

Commit

Permalink
chore: adapt zemu test for blindsigning mode
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 committed Oct 31, 2024
1 parent 597e1e7 commit cc8ba09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests_zemu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@zondax/ledger-algorand": "../js",
"@zondax/zemu": "^0.51.0"
"@zondax/zemu": "^0.51"
},
"devDependencies": {
"@ledgerhq/hw-transport-node-hid" : "^6.29.5",
Expand Down
20 changes: 3 additions & 17 deletions tests_zemu/tests/big_transactions_shortchut.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,19 @@ describe('BigTransactions - Shortcut', function () {
const txBlob = Buffer.from(txApplicationLong, 'hex')
console.log(sim.getMainMenuSnapshot())

// Enable expert mode
await sim.toggleExpertMode(`${m.prefix.toLowerCase()}-sign_application_big_shortcut`, true, 0);
// Enable blind signing mode
await sim.toggleBlindSigning(`${m.prefix.toLowerCase()}-sign_application_big_shortcut`, false, 0);

// Toggle shortcut mode on nano s, s+ and x devices, and compare
const snapshotsDelta = m.name == "nanos" ? 3 : 0
let nav = new ClickNavigation([2, 0, 5 + snapshotsDelta, 0])
await sim.navigateAndCompareSnapshots(".", `${m.prefix.toLowerCase()}-sign_application_big_shortcut`, nav.schedule, true, 3);

// Take snapshots of the shortcut mode and compare
nav = new ClickNavigation([2, -2])
await sim.navigateAndCompareSnapshots(".", `${m.prefix.toLowerCase()}-sign_application_big_shortcut`, nav.schedule, true, 12 + snapshotsDelta);

console.log(sim.getMainMenuSnapshot())
const responseAddr = await app.getAddressAndPubKey(accountId)
const pubKey = responseAddr.publicKey

await sim.deleteEvents()

// do not wait here.. we need to navigate
const signatureRequest = app.sign(accountId, txBlob)

// Wait until we are not in the main menu
await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot())

// Click on "skip fields" and approve
nav = new ClickNavigation([1, 0, 0])
await sim.navigateAndCompareSnapshots(".", `${m.prefix.toLowerCase()}-sign_application_big_shortcut`, nav.schedule, true, 17 + snapshotsDelta);
await sim.compareSnapshotsAndApprove(".", `${m.prefix.toLowerCase()}-sign_application_big_shortcut`, true, 0, 3000, true);

const signatureResponse = await signatureRequest
console.log(signatureResponse)
Expand Down

0 comments on commit cc8ba09

Please sign in to comment.