diff --git a/.github/actions/check-previous-test-runs/action.yml b/.github/actions/check-previous-test-runs/action.yml index f15c7732f25..60700af8361 100644 --- a/.github/actions/check-previous-test-runs/action.yml +++ b/.github/actions/check-previous-test-runs/action.yml @@ -25,6 +25,7 @@ runs: steps: - name: Check Previous Test Runs id: check-previous-runs + continue-on-error: true env: GH_TOKEN: ${{ inputs.github_token }} run: | diff --git a/.github/workflows/test-suite-web-e2e-pw.yml b/.github/workflows/test-suite-web-e2e-pw.yml index f657620c8ac..47a020e299e 100644 --- a/.github/workflows/test-suite-web-e2e-pw.yml +++ b/.github/workflows/test-suite-web-e2e-pw.yml @@ -104,8 +104,8 @@ jobs: include: - TEST_GROUP: "@group=suite" CONTAINERS: "trezor-user-env-unix" - # - TEST_GROUP: "@group=device-management" # Disabled because there are no webOnly tests in this group - # CONTAINERS: "trezor-user-env-unix" + - TEST_GROUP: "@group=device-management" + CONTAINERS: "trezor-user-env-unix" - TEST_GROUP: "@group=settings" CONTAINERS: "trezor-user-env-unix" - TEST_GROUP: "@group=metadata1" diff --git a/.github/workflows/test-suite-web-e2e.yml b/.github/workflows/test-suite-web-e2e.yml index 91b386213ff..4c9d36127aa 100644 --- a/.github/workflows/test-suite-web-e2e.yml +++ b/.github/workflows/test-suite-web-e2e.yml @@ -97,9 +97,6 @@ jobs: fail-fast: false matrix: include: - - TEST_GROUP: "@group_suite" - CONTAINERS: "trezor-user-env-unix" - CYPRESS_USE_TREZOR_USER_ENV_BRIDGE: "1" - TEST_GROUP: "@group_device-management" CONTAINERS: "trezor-user-env-unix" CYPRESS_USE_TREZOR_USER_ENV_BRIDGE: "1" diff --git a/packages/suite-desktop-core/e2e/tests/onboarding/analytics-consent.test.ts b/packages/suite-desktop-core/e2e/tests/onboarding/analytics-consent.test.ts new file mode 100644 index 00000000000..6620309e243 --- /dev/null +++ b/packages/suite-desktop-core/e2e/tests/onboarding/analytics-consent.test.ts @@ -0,0 +1,33 @@ +import { expect, test } from '../../support/fixtures'; + +test.describe( + 'Onboarding - analytics consent', + { tag: ['@group=device-management', '@webOnly'] }, + () => { + test.beforeEach(async ({ onboardingPage }) => { + await onboardingPage.disableFirmwareHashCheck(); + }); + + test('analytics consent appears on any route that is visited initially. this time /accounts', async ({ + page, + url, + analyticsPage, + onboardingPage, + }) => { + await page.goto(url + 'accounts'); + await expect(analyticsPage.heading).toBeVisible({ timeout: 30000 }); + await analyticsPage.continueButton.click(); + await page.getByTestId('@onboarding/exit-app-button').click(); + + if (onboardingPage.isModelWithSecureElement()) { + await onboardingPage.passThroughAuthenticityCheck(); + await onboardingPage.optionallyDismissFwHashCheckError(); + } + + await onboardingPage.onboardingViewOnlyEnableButton.click(); + await expect(page.getByTestId('@suite-layout/body')).toBeVisible(); + await page.getByTestId('@account-menu/btc/normal/0').click(); + await expect(page.getByTestId('@wallet/menu/wallet-send')).toBeVisible(); + }); + }, +); diff --git a/packages/suite-desktop-core/e2e/tests/onboarding/transport.test.ts b/packages/suite-desktop-core/e2e/tests/onboarding/transport.test.ts new file mode 100644 index 00000000000..bc9d7d82187 --- /dev/null +++ b/packages/suite-desktop-core/e2e/tests/onboarding/transport.test.ts @@ -0,0 +1,29 @@ +import { expect, test } from '../../support/fixtures'; + +test.describe.skip( + 'Onboarding - transport webusb/bridge', + { tag: ['@group=device-management', '@webOnly'] }, + () => { + test.use({ startEmulator: false }); + + test.beforeEach(async ({ trezorUserEnvLink }) => { + await trezorUserEnvLink.stopBridge(); + await trezorUserEnvLink.stopEmu(); + await trezorUserEnvLink.startBridge(); + }); + + test('Offer webusb as primary choice on web', async ({ page, analyticsPage }) => { + await analyticsPage.continueButton.click(); + await expect(page.getByTestId('@webusb-button')).toBeVisible({ timeout: 30000 }); + await page.getByTestId('@connect-device-prompt/no-device-detected').click(); + await expect(page.getByTestId('@collapsible-box/body')).toHaveAttribute( + 'aria-expanded', + 'true', + ); + }); + + test.afterEach(async ({ trezorUserEnvLink }) => { + await trezorUserEnvLink.stopBridge(); + }); + }, +); diff --git a/packages/suite-web/e2e/tests/onboarding/analytics-consent.test.ts b/packages/suite-web/e2e/tests/onboarding/analytics-consent.test.ts deleted file mode 100644 index 4799d927cbe..00000000000 --- a/packages/suite-web/e2e/tests/onboarding/analytics-consent.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -// @group_suite -// @retry=2 - -const acceptAnalyticsConsentOnInitializedDevice = () => { - cy.getTestElement('@analytics/consent'); - cy.getTestElement('@analytics/continue-button').click(); - cy.getTestElement('@onboarding/exit-app-button').click(); -}; - -describe('Onboarding - analytics consent', () => { - beforeEach(() => { - cy.task('startBridge'); - cy.viewport('macbook-13').resetDb(); - }); - - it('analytics consent appears on any route that is visited initially. this time /accounts', () => { - cy.task('startEmu', { wipe: true }); - cy.task('setupEmu', { - needs_backup: false, - }); - cy.prefixedVisit('/accounts'); - cy.disableFirmwareHashCheck(); - - acceptAnalyticsConsentOnInitializedDevice(); - - cy.getTestElement('@onboarding/viewOnly/enable').click(); - cy.getTestElement('@suite-layout/body').should('be.visible'); - cy.getTestElement('@account-menu/btc/normal/0').click(); - cy.getTestElement('@wallet/menu/wallet-send'); - }); -}); diff --git a/packages/suite-web/e2e/tests/onboarding/firmware-update.test.ts b/packages/suite-web/e2e/tests/onboarding/firmware-update.test.ts deleted file mode 100644 index f8f7fab2625..00000000000 --- a/packages/suite-web/e2e/tests/onboarding/firmware-update.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -// @group_firmware-update -// @retry=2 - -import har from '../../fixtures/fw-update-on-bl-2.0.3-to-fw-2.5.1'; - -let firmwareHash = ''; - -// This file is the first test with bridge communication mocked. -// We need this because we: -// 1. don't have all possible versions emulators and we still need to support older versions -// 2. even if we had all possible versions it would not work since they are not supported by trezorlib anymore -// 3. we don't have emulator support for bootloader - -// Tests to be written: -// - [x] fw update from empty device bootloader 2.0.3 to firmware 2.5.1 -// - [] fw update T1B1 with intermediary -// - [] fw update T2T1 incremental update over 2.0.5 -// - [] fw update with fingerprint -// - [] fw update failures, various cases -// - [] fw update with evil device (getFirmwareHash) - -// HOW TO: -// - Have devtools opened -> network -// - Go to suite, do the same things you intend to do in your test -// - After your are done, right click "Save all as HAR with content" -// - Save it into path packages/suite-web/e2e/fixtures/.har -// - run `yarn tsx packages/suite-web/e2e process-har.ts .hare` -// - where you would normally do `cy.task('startBridge') run `cy.task('startMockedBridge, har)` instead where har is the output of process-har.ts script -// - profit - -describe.skip('fw update from empty device bootloader 2.0.3 to firmware 2.5.1', () => { - beforeEach(() => { - cy.task('startMockedBridge', har); - - // make sure that we always upgrade to version 2.5.1 - cy.intercept('*', { pathname: '/data/firmware/t2t1/releases.json' }, [ - { - required: false, - version: [2, 5, 1], - min_firmware_version: [2, 0, 8], - min_bootloader_version: [2, 0, 0], - url: 'firmware/t2t1/trezor-t2t1-2.5.1.bin', - url_bitcoinonly: 'firmware/t2t1/trezor-t2t1-2.5.1-bitcoinonly.bin', - fingerprint: '782d4934897018cac779eebb0d7c66e21da7789b9cd35e1f99f097bdfd9b7d33', - fingerprint_bitcoinonly: - 'db5d7b211532f717a32fe0b1bd3e3df6ad5464079a896a7f7492ab6e9e030bb5', - notes: 'https://blog.trezor.io/trezor-suite-and-firmware-updates-may-2022-b1af60742291', - changelog: - '* Support Electrum signatures in VerifyMessage.\n* Support Cardano Alonzo-era transactions (Plutus).\n* Bitcoin bech32 addresses QR codes have bigger pixels which are easier to scan.\n* EIP-1559 transaction correctly show final Hold to Confirm screen.\n* Trezor will refuse to sign UTXOs that do not match the provided derivation path (e.g., transactions belonging to a different wallet, or synthetic transaction inputs).\n* Zcash v5 transaction format.', - }, - ]); - - // make sure that 2.5.1 does not return 404 - cy.intercept( - '*', - { pathname: '/data/firmware/t2t1/trezor-t2t1-2.5.1.bin' }, - // seems like response does not matter. I thought there was firmware validation but it is probably - // only in place for custom firmware? - 'foo-bar', - ); - - cy.viewport(1440, 2560).resetDb(); - cy.prefixedVisit('/'); - }); - - it('firmware update error', () => { - cy.getTestElement('@analytics/continue-button').click(); - - // hook into redux actions to bypass firmware hash check - cy.window().its('store').should('exist'); - cy.window().then(window => { - window.store.subscribe(() => { - // watch for action that updates firmwareHash. this action is triggered after TrezorConnect.firmwareUpdate - // call is resolved and before TrezorConnect.getFirmwareHash is called. - // we save firmwareHash computed for the firmware binary that was installed and use it to mock - // the subsequent TrezorConnect.getFirmwareHash call to return the very same response - if (window.store.getState().firmware.firmwareHash && !firmwareHash) { - firmwareHash = window.store.getState().firmware.firmwareHash!; - cy.stub(window.TrezorConnect, 'getFirmwareHash').returns( - new Promise(resolve => - resolve({ - success: true, - payload: { - hash: firmwareHash, - }, - }), - ), - ); - } - }); - }); - - cy.getTestElement('@analytics/continue-button').click(); - - cy.getTestElement('@firmware/install-button').click(); - - cy.getTestElement('@firmware/continue-button', { - // longer timeout /listen needs to resolve - timeout: 60000, - }).click(); - }); -}); diff --git a/packages/suite-web/e2e/tests/onboarding/transport.test.ts b/packages/suite-web/e2e/tests/onboarding/transport.test.ts deleted file mode 100644 index 8014c5ca1dd..00000000000 --- a/packages/suite-web/e2e/tests/onboarding/transport.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @group_device-management -// @retry=2 - -describe('Onboarding - transport webusb/bridge', () => { - beforeEach(() => { - cy.viewport('macbook-13').resetDb(); - cy.prefixedVisit('/'); - }); - - it('Offer webusb as primary choice on web', () => { - cy.getTestElement('@analytics/continue-button').click(); - cy.getTestElement('@webusb-button'); - cy.getTestElement('@connect-device-prompt/no-device-detected').click(); - }); -});