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

fix: email tests #2133

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/laboratory/tests/shared/utils/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const EMAIL_APPROVE_BUTTON_TEXT = 'Approve this login'
const APPROVE_URL_REGEX = /https:\/\/register.*/u
const OTP_CODE_REGEX = /\d{3}\s?\d{3}/u
const AVAILABLE_MAILSAC_ADDRESSES = 10
const EMAIL_DOMAIN = 'web3modal.msdc.co'

export class Email {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -31,19 +32,19 @@ export class Email {
if (messages.data.length > 0) {
const message = messages.data[0]
if (!message) {
throw new Error('No message found')
throw new Error(`No message found for address ${email}`)
}
const id = message._id
if (!id) {
throw new Error('Message ID not present')
throw new Error(`Message id not present for address ${email}`)
}

return id
}
await this.timeout(EMAIL_CHECK_TIMEOUT)
checks += 1
}
throw new Error('No email found')
throw new Error(`No email found for address ${email}`)
}

async getEmailBody(email: string, messageId: string): Promise<string> {
Expand Down Expand Up @@ -82,6 +83,6 @@ export class Email {
)
}

return `web3modal${index}@mailsac.com`
return `tests-${index}@${EMAIL_DOMAIN}`
}
}
7 changes: 7 additions & 0 deletions apps/laboratory/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ export class ModalValidator {
await expect(accountButton, 'Account button should be present').toBeAttached({
timeout: MAX_WAIT
})
await expect(
this.page.getByTestId('connect-button'),
'Connect button should not be present'
).toBeHidden({
timeout: MAX_WAIT
})
await this.page.waitForTimeout(500)
}

async expectAuthenticated() {
Expand Down
20 changes: 10 additions & 10 deletions apps/laboratory/tests/shared/validators/ModalWalletValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { ModalValidator } from './ModalValidator'

// Each entry corresponds to web3modal${index} email address EOA
const testEmailsEOAAddresses = [
'0x6DAa039A2bFBb48dE6c02E3333a30856C047D73f',
'0x804642811117f5063594D0Db0273EA3C1959AE2C',
'0x871f447Cc32EA3F28Ea09910BE124c451CCcAE4c',
'0xd3041Dbf9473b9D2f6E15EB1Ca2e5999D3eF9519',
'0x88dEF109b4877B6fc14c5Fd25ED68B821E270E30',
'0x465B06679a2a33F3350C9D245872d1e34f10BA9C',
'0x8cD2c90E98309FcdeEd2bA0FdaC050e0284D1fD6',
'0x4446d7538f4CF5832604BE20535d954439Ff075d',
'0xbC6996C993d358989743bC74082B046da9d4d8fb',
'0x1216ff6012bcFcBaDFb4691cF586702Af9482F8C',
'0x629EC1c38cB60E90A47464e166A422256ADd9987',
'0xc3425Dda0A828983d7D372153B637231b8b53b30',
'0xa9B505304E0DD13F6C4EaBE21d7a707d620fbce4',
'0xC1f94ee0cD3dF13866f8fFD2d0907694266C28CE',
'0xAde4446855699e2aB1bD9D2f57B31A920A7C7bec',
'0xE66C5Cd1b0B9162D9cb036f7452Ca5C47260757c',
'0x2221967773371A742C297AD5290c5db0Ed632023',
'0x72d8d1Cc520d715D8db8E9B34D971F783FdAe634',
'0x774Ef09E6d93DB7ffE31A836610EDB6202752687',
'0x3A24983B0527442d8249DE97cFAFabb379c9A938',
// Non-smart account enabled address
'0x26760E9EbAcD6f4C47c095E7fd544C5AC093a4E3'
]
Expand Down
Loading