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 e88b6f6 commit 38e0a11
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions packages/suite-web/e2e/tests/firmware/firmware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 38e0a11

Please sign in to comment.