Skip to content

Commit

Permalink
test(e2e): make timeouts shorter
Browse files Browse the repository at this point in the history
So tests that are hanging flakily fail fast
  • Loading branch information
sidvishnoi committed Jan 24, 2025
1 parent c0fdfc8 commit 4a6f7a9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
6 changes: 5 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export default defineConfig({
{ open: 'never', outputFolder: path.join(testDir, 'playwright-report') },
],
],
use: { trace: 'retain-on-failure' },
use: {
trace: 'retain-on-failure',
actionTimeout: 8_000,
navigationTimeout: 10_000,
},

projects: [
{
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/fixtures/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const test = base.extend<{ page: Page }, BaseScopeWorker>({
await use(context);
await context.close();
},
{ scope: 'worker' },
{ scope: 'worker', timeout: 5_000 },
],

// This is the background service worker in Chrome, and background script
Expand All @@ -47,7 +47,7 @@ export const test = base.extend<{ page: Page }, BaseScopeWorker>({
const background = await getBackground(browserName, context);
await use(background);
},
{ scope: 'worker' },
{ scope: 'worker', timeout: 5_000 },
],

i18n: [
Expand All @@ -65,7 +65,7 @@ export const test = base.extend<{ page: Page }, BaseScopeWorker>({
await use(popup);
await popup.close();
},
{ scope: 'worker' },
{ scope: 'worker', timeout: 5_000 },
],

page: async ({ persistentContext: context }, use) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/fixtures/connected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const test = base.extend<{ page: Page }, { popup: Popup }>({

await disconnectWallet(popup);
},
{ scope: 'worker' },
{ scope: 'worker', timeout: 10_000 },
],
});

Expand Down
16 changes: 10 additions & 6 deletions tests/e2e/pages/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,22 @@ export async function fillPopup(
i18n: BrowserIntl,
params: Partial<ConnectDetails>,
) {
const timeout = 1000;
const fields = getPopupFields(popup, i18n);
if (typeof params.walletAddressUrl !== 'undefined') {
await fields.walletAddressUrl.fill(params.walletAddressUrl);
await fields.walletAddressUrl.blur();
await fields.walletAddressUrl.fill(params.walletAddressUrl, { timeout });
await fields.walletAddressUrl.blur({ timeout });
}
if (typeof params.amount !== 'undefined') {
await fields.amount.fill(params.amount);
await fields.amount.blur();
await fields.amount.fill(params.amount, { timeout });
await fields.amount.blur({ timeout });
}
if (typeof params.recurring !== 'undefined') {
await fields.recurring.setChecked(params.recurring, { force: true });
await fields.recurring.blur();
await fields.recurring.setChecked(params.recurring, {
force: true,
timeout,
});
await fields.recurring.blur({ timeout });
}

return fields.connectButton;
Expand Down

0 comments on commit 4a6f7a9

Please sign in to comment.