Skip to content

Commit

Permalink
test(suite-web): adapt e2e tests to changes in #12472
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed May 27, 2024
1 parent 73206d2 commit df2f78f
Showing 1 changed file with 32 additions and 24 deletions.
56 changes: 32 additions & 24 deletions packages/suite-web/e2e/tests/firmware/firmware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Firmware', () => {
cy.task('startEmu', { wipe: true, version: '2.5.1' });
cy.task('setupEmu');
cy.task('startBridge');
cy.prefixedVisit('/');

cy.passThroughInitialRun();
cy.getTestElement('@suite-layout/body').matchImageSnapshot('outdated-notification-banner', {
clip: { x: 0, y: 0, height: 100, width: 1080 },
Expand All @@ -23,35 +23,43 @@ describe('Firmware', () => {

// check seed screen
cy.getTestElement('@modal/close-button').should('be.visible'); // modal is cancellable at this moment
cy.wait(1000); // wait for animation to finish before taking a screenshot
cy.getTestElement('@firmware-modal').matchImageSnapshot('check-seed');
cy.getTestElement('@firmware/confirm-seed-checkbox').click();
cy.getTestElement('@firmware/confirm-seed-button').click();

// reconnect in bootloader screen (disconnect)
cy.getTestElement('@firmware/disconnect-message', { timeout: 30000 });
cy.task('stopEmu');
// we can't really test anything from this point since this https://github.com/trezor/trezor-suite/pull/12472 was merged
// in combination with not doing git lfs checkout in feature branches. Firmware will not be uploaded and an error is presented to user
// but only in feature branches, develop or production branches should display correct behavior.

// reconnect in bootloader screen (connect in bootloader)
cy.getTestElement('@firmware/connect-in-bootloader-message', { timeout: 20000 });
cy.log(
'And this is the end my friends. Emulator does not support bootloader, so we can not proceed with actual fw install',
);
});
// one point to get over this would be to stub correct (bigger) firmware binary response here, but I don't know how to stub fetch that
// happens inside a nested iframe (connect-iframe).

// todo: this does not work when there is mismatch between latest fw in releases json and latest fw in trezor-user-env
it.skip(`For the latest firmware, update button in device settings should display "Up to date" but still be clickable`, () => {
cy.task('startEmu', { wipe: true });
cy.task('setupEmu');
cy.task('startBridge');
cy.prefixedVisit('/');
cy.passThroughInitialRun();
cy.getTestElement('@suite/menu/settings').click();
cy.getTestElement('@settings/menu/device').click();
cy.getTestElement('@settings/device/update-button')
.should('contain.text', 'Up to date')
.click({ scrollBehavior: false });
cy.getTestElement('@modal/close-button').click();
// cy.prefixedVisit('/', {
// onBeforeLoad: (win: Window) => {
// cy.stub(win, 'fetch').callsFake(
// (uri: string, options: Parameters<typeof fetch>[1]) => {
// console.log('uri', uri);
// if (uri.includes('static/connect/data/firmware/t2t1/')) {
// return Promise.resolve(
// new Response(new ArrayBuffer(0), { status: 200 }),
// );
// }

// return fetch(uri, options);
// },
// );
// },
// });

// // reconnect in bootloader screen (disconnect)
// cy.getTestElement('@firmware/disconnect-message', { timeout: 30000 });
// cy.task('stopEmu');

// // reconnect in bootloader screen (connect in bootloader)
// cy.getTestElement('@firmware/connect-in-bootloader-message', { timeout: 20000 });
// cy.log(
// 'And this is the end my friends. Emulator does not support bootloader, so we can not proceed with actual fw install',
// );
});
});

Expand Down

0 comments on commit df2f78f

Please sign in to comment.