From 7ad0cafb5b78395ebb59672b17f8efa6a94be22d Mon Sep 17 00:00:00 2001 From: Carlos Medeiros Date: Wed, 2 Nov 2022 15:36:08 +0000 Subject: [PATCH] update zemu --- tests_tools/Cargo.lock | 114 ++++++++++++++------------- tests_zemu/package.json | 40 +++++----- tests_zemu/tests/pullImageKillOld.ts | 4 + tests_zemu/tests/sr25519.test.ts | 14 ++-- tests_zemu/tests/standard.test.ts | 15 ++-- 5 files changed, 95 insertions(+), 92 deletions(-) create mode 100644 tests_zemu/tests/pullImageKillOld.ts diff --git a/tests_tools/Cargo.lock b/tests_tools/Cargo.lock index c1501bf..34c5de3 100644 --- a/tests_tools/Cargo.lock +++ b/tests_tools/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" dependencies = [ "memchr", ] @@ -40,9 +40,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.67" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" [[package]] name = "cfg-if" @@ -52,9 +52,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] @@ -83,9 +83,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", @@ -104,21 +104,21 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "libc" -version = "0.2.94" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "memchr" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "merlin" @@ -134,9 +134,9 @@ dependencies = [ [[package]] name = "neon" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "544694d02bbff81f78dba5ef7d29341cc6d256edcae4fbb2d684491d5755c748" +checksum = "28e15415261d880aed48122e917a45e87bb82cf0260bb6db48bbab44b7464373" dependencies = [ "neon-build", "neon-runtime", @@ -146,18 +146,18 @@ dependencies = [ [[package]] name = "neon-build" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd4ec682b1a7837c84d9866c342ac6ffe2ce9712e844e4015f31d01bdeb73608" +checksum = "8bac98a702e71804af3dacfde41edde4a16076a7bbe889ae61e56e18c5b1c811" dependencies = [ "neon-sys", ] [[package]] name = "neon-runtime" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4b1a7f8f569b4e43feff04931924cebe40a630fa258d2a28147525d247defe" +checksum = "4676720fa8bb32c64c3d9f49c47a47289239ec46b4bdb66d0913cc512cb0daca" dependencies = [ "cfg-if", "neon-sys", @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "neon-sys" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c376c75ccf632a20d2f18fd2bde0b10f36a9cc5c8c7c4921f629147ebf59aeb6" +checksum = "a5ebc923308ac557184455b4aaa749470554cbac70eb4daa8b18cdc16bef7df6" dependencies = [ "cc", "regex", @@ -182,36 +182,36 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -220,9 +220,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "schnorrkel" @@ -258,15 +258,15 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b" dependencies = [ "serde", ] @@ -286,9 +286,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.6.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "subtle-ng" @@ -298,20 +298,20 @@ checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" [[package]] name = "syn" -version = "1.0.72" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", @@ -330,15 +330,21 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "version_check" @@ -348,15 +354,15 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zeroize" -version = "1.5.4" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb5728b8afd3f280a869ce1d4c554ffaed35f45c231fc41bfbd0381bef50317" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" dependencies = [ "zeroize_derive", ] diff --git a/tests_zemu/package.json b/tests_zemu/package.json index d9ac8f1..6d4fa6d 100644 --- a/tests_zemu/package.json +++ b/tests_zemu/package.json @@ -14,31 +14,31 @@ "Ledger" ], "scripts": { - "test": "jest --detectOpenHandles -t 'Standard'", - "testSR25519": "jest --detectOpenHandles --runInBand tests/sr25519.test.ts" + "test": "ts-node tests/pullImageKillOld.ts && jest -t 'Standard'", + "testSR25519": "ts-node tests/pullImageKillOld.ts && jest tests/sr25519.test.ts" }, "dependencies": { - "@zondax/ledger-substrate": "^0.24.0", - "@zondax/zemu": "^0.27.4" + "@zondax/ledger-substrate": "^0.39.0", + "@zondax/zemu": "^0.34.0" }, "devDependencies": { - "@types/jest": "^26.0.23", - "@types/ledgerhq__hw-transport": "^4.21.3", - "@typescript-eslint/eslint-plugin": "^4.25.0", - "@typescript-eslint/parser": "^4.25.0", - "blakejs": "^1.1.0", - "crypto-js": "4.0.0", + "@types/jest": "^29.2.1", + "@types/ledgerhq__hw-transport": "^4.21.4", + "@typescript-eslint/eslint-plugin": "^5.7.0", + "@typescript-eslint/parser": "^5.7.0", + "blakejs": "^1.1.1", + "crypto-js": "4.1.1", "ed25519-supercop": "^2.0.1", - "eslint": "^7.26.0", + "eslint": "^8.25.0", "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.23.2", - "eslint-plugin-jest": "^24.3.6", - "eslint-plugin-prettier": "^3.3.1", - "jest": "26.6.3", - "jest-serial-runner": "^1.1.0", - "jssha": "^3.1.1", - "prettier": "^2.3.0", - "ts-jest": "^26.5.6", - "typescript": "^4.2.3" + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-jest": "^27.1.2", + "eslint-plugin-prettier": "^4.0.0", + "jest": "29.2.0", + "jssha": "^3.2.0", + "prettier": "^2.5.1", + "ts-jest": "^29.0.3", + "ts-node": "^10.9.1", + "typescript": "^4.5.3" } } diff --git a/tests_zemu/tests/pullImageKillOld.ts b/tests_zemu/tests/pullImageKillOld.ts new file mode 100644 index 0000000..ddd30b7 --- /dev/null +++ b/tests_zemu/tests/pullImageKillOld.ts @@ -0,0 +1,4 @@ +import Zemu from '@zondax/zemu' + +Zemu.checkAndPullImage() +Zemu.stopAllEmuContainers() diff --git a/tests_zemu/tests/sr25519.test.ts b/tests_zemu/tests/sr25519.test.ts index 97082bf..aec4130 100644 --- a/tests_zemu/tests/sr25519.test.ts +++ b/tests_zemu/tests/sr25519.test.ts @@ -35,10 +35,6 @@ const defaultOptions = { jest.setTimeout(60000) -beforeAll(async () => { - await Zemu.checkAndPullImage() -}) - describe('SR25519', function () { test('get address sr25519', async function () { const sim = new Zemu(APP_PATH) @@ -73,7 +69,7 @@ describe('SR25519', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', 's-show_address_sr25519', 2) + await sim.compareSnapshotsAndApprove('.', 's-show_address_sr25519') const resp = await respRequest console.log(resp) @@ -100,7 +96,7 @@ describe('SR25519', function () { const respRequest = app.getAddress(0x80000000, 0x80000000, 0x80000000, true, 1) // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', 's-show_address_reject_sr25519', 3, 2) + await sim.navigateAndCompareUntilText('.', 's-show_address_reject_sr25519', 'REJECT') const resp = await respRequest console.log(resp) @@ -131,7 +127,7 @@ describe('SR25519', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', 's-sign_basic_normal', 5) + await sim.compareSnapshotsAndApprove('.', 's-sign_basic_normal') const signatureResponse = await signatureRequest console.log(signatureResponse) @@ -179,7 +175,7 @@ describe('SR25519', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', 's-sign_basic_expert', 11) + await sim.compareSnapshotsAndApprove('.', 's-sign_basic_expert') const signatureResponse = await signatureRequest console.log(signatureResponse) @@ -221,7 +217,7 @@ describe('SR25519', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', 's-sign_large_nomination', 6) + await sim.compareSnapshotsAndApprove('.', 's-sign_large_nomination') const signatureResponse = await signatureRequest console.log(signatureResponse) diff --git a/tests_zemu/tests/standard.test.ts b/tests_zemu/tests/standard.test.ts index 8e876fa..1cf5df5 100644 --- a/tests_zemu/tests/standard.test.ts +++ b/tests_zemu/tests/standard.test.ts @@ -32,10 +32,6 @@ const defaultOptions = { jest.setTimeout(60000) -beforeAll(async () => { - await Zemu.checkAndPullImage() -}) - describe('Standard', function () { test.each(models)('can start and stop container', async function (m) { const sim = new Zemu(m.path) @@ -109,7 +105,7 @@ describe('Standard', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', `${m.prefix.toLowerCase()}-show_address`, 2) + await sim.compareSnapshotsAndApprove('.', `${m.prefix.toLowerCase()}-show_address`) const resp = await respRequest @@ -138,7 +134,7 @@ describe('Standard', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', `${m.prefix.toLowerCase()}-show_address_reject`, 3, 2) + await sim.navigateAndCompareUntilText('.', `${m.prefix.toLowerCase()}-show_address_reject`, 'REJECT') const resp = await respRequest console.log(resp) @@ -169,7 +165,7 @@ describe('Standard', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', `${m.prefix.toLowerCase()}-sign_basic_normal`, 5) + await sim.compareSnapshotsAndApprove('.', `${m.prefix.toLowerCase()}-sign_basic_normal`) const signatureResponse = await signatureRequest console.log(signatureResponse) @@ -216,7 +212,8 @@ describe('Standard', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', `${m.prefix.toLowerCase()}-sign_basic_expert`, 11) + await sim.compareSnapshotsAndApprove('.', `${m.prefix.toLowerCase()}-sign_basic_expert`) + const signatureResponse = await signatureRequest console.log(signatureResponse) @@ -257,7 +254,7 @@ describe('Standard', function () { // Wait until we are not in the main menu await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot()) - await sim.compareSnapshotsAndAccept('.', `${m.prefix.toLowerCase()}-sign_large_nomination`, m.name === 'nanos' ? 6 : 5) + await sim.compareSnapshotsAndApprove('.', `${m.prefix.toLowerCase()}-sign_large_nomination`) const signatureResponse = await signatureRequest console.log(signatureResponse)