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

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

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