-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(trezor-user-env-link): add a basic test proving that all availab…
…le emulators run
- Loading branch information
Showing
4 changed files
with
288 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "[Test] trezor-user-env-link e2e" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- ".github/workflows/test-trezor-user-env-link-e2e.yml" | ||
- "packages/trezor-user-env/**" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
e2e-test-trezor-user-env-link: | ||
if: github.repository == 'trezor/trezor-suite' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.after}} | ||
fetch-depth: 2 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: yarn | ||
- name: Install dependencies | ||
run: | | ||
echo -e "\nenableScripts: false" >> .yarnrc.yml | ||
echo -e "\nenableHardenedMode: false" >> .yarnrc.yml | ||
yarn workspaces focus @trezor/trezor-user-env-link | ||
- name: Run e2e tests | ||
run: | | ||
docker run ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3 -d | ||
yarn workspace @trezor/trezor-user-env-link test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { typedObjectKeys } from '@trezor/utils'; | ||
|
||
import { TrezorUserEnvLink } from '../src'; | ||
|
||
(async () => { | ||
await TrezorUserEnvLink.connect(); | ||
|
||
if (!TrezorUserEnvLink.firmwares) { | ||
throw new Error('firmwares not loaded'); | ||
} | ||
for (const model of typedObjectKeys(TrezorUserEnvLink.firmwares)) { | ||
console.log('testing firmwares for model', model); | ||
|
||
for (const version of TrezorUserEnvLink.firmwares[model]) { | ||
console.log('starting emulator', model, version); | ||
await TrezorUserEnvLink.startEmu({ | ||
model, | ||
version, | ||
wipe: true, | ||
}); | ||
|
||
console.log('setting up emulator'); | ||
await TrezorUserEnvLink.setupEmu(); | ||
|
||
// todo: run more complex commands, typically those that require interaction with multiple screens (dry run..) | ||
|
||
console.log('wiping emulator'); | ||
await TrezorUserEnvLink.wipeEmu(); | ||
|
||
console.log('stopping emulator'); | ||
await TrezorUserEnvLink.stopEmu(); | ||
} | ||
} | ||
|
||
await TrezorUserEnvLink.disconnect(); | ||
|
||
console.log('ALL TESTS DONE'); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.