Skip to content

Commit

Permalink
fix: smart account spec issues on disconnect. improve project regex
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir committed May 23, 2024
1 parent 9f7a017 commit 1782026
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
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
File renamed without changes.
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)

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

0 comments on commit 1782026

Please sign in to comment.