Skip to content

Commit

Permalink
Fix some zemu tests for stax and flex (#116)
Browse files Browse the repository at this point in the history
* fix: zemu tests for stax and flex

* fix: zemu tests for stax and flex

* fix: zemu tests for stax and flex
  • Loading branch information
emmanuelm41 authored Jul 30, 2024
1 parent 590d467 commit 9299a42
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 11 deletions.
Binary file added tests_zemu/snapshots/fl-get-fvk/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests_zemu/snapshots/fl-get-ivk/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests_zemu/snapshots/fl-get-ovk/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests_zemu/snapshots/st-get-fvk/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests_zemu/snapshots/st-get-ivk/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests_zemu/snapshots/st-get-ovk/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 25 additions & 5 deletions tests_zemu/tests/addresses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu, { ButtonKind } from '@zondax/zemu'
import Zemu, {ButtonKind, isTouchDevice} from '@zondax/zemu'
import { defaultOptions as commonOpts, models } from './_config'
import ZCashApp from '@zondax/ledger-zcash'

Expand Down Expand Up @@ -46,7 +46,12 @@ describe('Addresses', function () {
test.concurrent.each(models)('show_unshielded_address', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Confirm' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const expectedAddrRaw = '026f27818e7426a10773226b3553d0afe50a3697bd02652f1b57d67bf648577d11'
Expand All @@ -67,7 +72,12 @@ describe('Addresses', function () {
test.concurrent.each(models)('get_shielded_address', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Confirm' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 1000 + 0x80000000
Expand Down Expand Up @@ -99,7 +109,12 @@ describe('Addresses', function () {
test.concurrent.each(models)('show shielded address', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Confirm' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 1000 + 0x80000000
Expand All @@ -123,7 +138,12 @@ describe('Addresses', function () {
test.concurrent.each(models)('show_shielded_address_with_div', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Confirm' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 1000 + 0x80000000
Expand Down
37 changes: 31 additions & 6 deletions tests_zemu/tests/keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu, { ButtonKind, DEFAULT_START_OPTIONS } from '@zondax/zemu'
import Zemu, { ButtonKind, DEFAULT_START_OPTIONS, isTouchDevice } from '@zondax/zemu'
import ZCashApp from '@zondax/ledger-zcash'
import { APP_SEED, defaultOptions as commonOpts, models } from './_config'

Expand All @@ -28,7 +28,12 @@ describe('Nullifier', function () {
test.concurrent.each(models)('get nullifier account 0x01', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Approve' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 0x01 + 0x80000000
Expand All @@ -53,7 +58,12 @@ describe('Nullifier', function () {
test.concurrent.each(models)('get_nullifier_account_0xFF', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Approve' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const path = 0xff + 0x80000000
Expand All @@ -80,7 +90,12 @@ describe('Get_keys', function () {
test.concurrent.each(models)('get ivk', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Approve' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 1000 + 0x80000000
Expand Down Expand Up @@ -108,7 +123,12 @@ describe('Get_keys', function () {
test.concurrent.each(models)('get ovk', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Approve' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 1000 + 0x80000000
Expand All @@ -131,7 +151,12 @@ describe('Get_keys', function () {
test.concurrent.each(models)('Get fvk', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start(defaultOptions(m, true))
await sim.start({
...defaultOptions(m, true),
approveKeyword: isTouchDevice(m.name) ? 'Approve' : '',
approveAction: ButtonKind.ApproveTapButton
})

const app = new ZCashApp(sim.getTransport())

const zip32Account = 1000 + 0x80000000
Expand Down

0 comments on commit 9299a42

Please sign in to comment.