Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve SA test flakyness #2303

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/laboratory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"playwright:test:social": "playwright test --grep 'social.spec.ts'",
"playwright:test:siwe": "playwright test --grep siwe.spec.ts",
"playwright:test:siwe-email": "playwright test --grep siwe-email.spec.ts",
"playwright:test:siwe-sa": "playwright test --grep siwe-smart-account.spec.ts",
"playwright:test:siwe-sa": "playwright test --grep siwe-sa.spec.ts",
"playwright:test:sa": "playwright test --grep smart-account.spec.ts",
"playwright:test:canary": "playwright test --retries=0 --grep canary.spec.ts --project='Desktop Chrome/wagmi'",
"playwright:debug": "npm run playwright:test -- --debug",
Expand Down
5 changes: 4 additions & 1 deletion apps/laboratory/tests/shared/pages/ModalWalletPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export class ModalWalletPage extends ModalPage {
}

async togglePreferredAccountType() {
await this.page.getByTestId('account-toggle-preferred-account-type').click()
const toggleButton = this.page.getByTestId('account-toggle-preferred-account-type')
await expect(toggleButton, 'Toggle button should be visible').toBeVisible()
await expect(toggleButton, 'Toggle button should be enabled').toBeEnabled()
await toggleButton.click()
}

override async disconnect(): Promise<void> {
Expand Down
23 changes: 13 additions & 10 deletions apps/laboratory/tests/shared/utils/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const braveOptions: UseOptions = {
}
}

const EMAIL_BASED_PLATFORM_REGEX =
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-sa\.spec\.ts|social\.spec\.ts).*$/u

const SOLANA_UNIMPLEMENTED_TESTS_REGEX =
/^(?!.*(?:email\.spec\.ts|siwe\.spec\.ts|canary\.spec\.ts|smart-account\.spec\.ts|social\.spec\.ts|siwe-sa\.spec\.ts|siwe-email\.spec\.ts)).*$/u

const customProjectProperties: CustomProjectProperties = {
'Desktop Chrome/ethers': {
testIgnore: /(?:social\.spec\.ts).*$/u
Expand All @@ -46,31 +52,28 @@ const customProjectProperties: CustomProjectProperties = {
testIgnore: /(?:social\.spec\.ts).*$/u
},
'Desktop Brave/wagmi': {
testIgnore:
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-smart-account\.spec\.ts|social\.spec\.ts).*$/u,
testIgnore: EMAIL_BASED_PLATFORM_REGEX,
useOptions: braveOptions
},
'Desktop Chrome/wagmi': {
testIgnore:
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-smart-account\.spec\.ts|social\.spec\.ts).*$/u
testIgnore: EMAIL_BASED_PLATFORM_REGEX
},
'Desktop Firefox/wagmi': {
testIgnore:
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-smart-account\.spec\.ts|social\.spec\.ts).*$/u
testIgnore: EMAIL_BASED_PLATFORM_REGEX
},
// Exclude social.spec.ts, email.spec.ts, siwe.spec.ts, and canary.spec.ts from solana, not yet implemented
'Desktop Chrome/solana': {
grep: /^(?!.*(?:email\.spec\.ts|siwe\.spec\.ts|canary\.spec\.ts|smart-account\.spec\.ts|social\.spec\.ts)).*$/u
grep: SOLANA_UNIMPLEMENTED_TESTS_REGEX
},
'Desktop Brave/solana': {
useOptions: braveOptions,
grep: /^(?!.*(?:email\.spec\.ts|siwe\.spec\.ts|canary\.spec\.ts|smart-account\.spec\.ts|social\.spec\.ts)).*$/u
grep: SOLANA_UNIMPLEMENTED_TESTS_REGEX
},
'Desktop Firefox/solana': {
grep: /^(?!.*(?:email\.spec\.ts|siwe\.spec\.ts|canary\.spec\.ts|smart-account\.spec\.ts|social\.spec\.ts)).*$/u
grep: SOLANA_UNIMPLEMENTED_TESTS_REGEX
},
'Desktop Safari/solana': {
grep: /^(?!.*(?:email\.spec\.ts|siwe\.spec\.ts|canary\.spec\.ts|smart-account\.spec\.ts|social\.spec\.ts)).*$/u
grep: SOLANA_UNIMPLEMENTED_TESTS_REGEX
}
}

Expand Down
3 changes: 2 additions & 1 deletion apps/laboratory/tests/smart-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ testModalSmartAccount(
await walletModalPage.openAccount()
await walletModalPage.openSettings()
await walletModalPage.togglePreferredAccountType()
await walletModalValidator.expectChangePreferredAccountToShow(EOA)
await walletModalPage.disconnect()
await walletModalPage.page.waitForTimeout(500)
await walletModalPage.page.waitForTimeout(1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't do timeouts, can we find another way to delay? E.g. waiting for connect button to show "Connect"?


await walletModalPage.emailFlow(
email.getEmailAddressToUse(parallelIndex, NOT_ENABLED_DOMAIN),
Expand Down