This commit is contained in:
mansaj 2023-02-14 14:06:12 -08:00 коммит произвёл Vincent
Родитель bf2895cbff
Коммит a1dc6802b7
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -114,24 +114,24 @@ export const defaultScreenshotOpts: Partial<DefaultScreenshotOpts> = {
export const checkAuthState = async (page: Page) => { export const checkAuthState = async (page: Page) => {
try { try {
const authStateTitleString = await page.locator('h1').textContent({ timeout: 4000 }) const authStateTitleString = await page.locator('h1').textContent({ timeout: 4000 })
const checkIfTitleConatins = (potentialTitle: string) => { const checkIfTitleContains = (potentialTitle: string) => {
return authStateTitleString?.includes(potentialTitle) return authStateTitleString?.includes(potentialTitle)
} }
switch (true) { switch (true) {
case checkIfTitleConatins('Enter your email'): case checkIfTitleContains('Enter your email'):
await enterYourEmail(page) await enterYourEmail(page)
break; break;
case checkIfTitleConatins('Enter your password'): case checkIfTitleContains('Enter your password'):
await enterYourPassword(page) await enterYourPassword(page)
break; break;
case checkIfTitleConatins('Set your password'): case checkIfTitleContains('Set your password'):
await setYourPassword(page) await setYourPassword(page)
break; break;
case checkIfTitleConatins('Enter confirmation code'): case checkIfTitleContains('Enter confirmation code'):
await enterConfirmationCode(page) await enterConfirmationCode(page)
break; break;
case checkIfTitleConatins('Sign in'): case checkIfTitleContains('Sign in'):
await signIn(page) await signIn(page)
break; break;
default: default: