fix: helper.ts issues with changing locales in tests
This commit is contained in:
@@ -54,6 +54,7 @@ export async function saveDocHotkeyAndAssert(page: Page): Promise<void> {
|
||||
export async function saveDocAndAssert(page: Page, selector = '#action-save'): Promise<void> {
|
||||
await page.click(selector, { delay: 100 })
|
||||
await expect(page.locator('.Toastify')).toContainText('successfully')
|
||||
await wait(500)
|
||||
expect(page.url()).not.toContain('create')
|
||||
}
|
||||
|
||||
@@ -73,13 +74,20 @@ export async function closeNav(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
export async function openDocControls(page: Page): Promise<void> {
|
||||
await page.locator('.doc-controls__popup .popup-button').click()
|
||||
await expect(page.locator('.doc-controls__popup .popup__content')).toBeVisible()
|
||||
await page.locator('.doc-controls__popup >> .popup-button').click()
|
||||
await expect(page.locator('.doc-controls__popup >> .popup__content')).toBeVisible()
|
||||
}
|
||||
|
||||
export async function changeLocale(page: Page, newLocale: string) {
|
||||
await page.locator('.localizer >> button').first().click()
|
||||
await page.locator(`.localizer >> a[href="/?locale=${newLocale}"]`).click()
|
||||
await page
|
||||
.locator(`.localizer`)
|
||||
.locator(`.popup >> button`, {
|
||||
hasText: newLocale,
|
||||
})
|
||||
.first()
|
||||
.click()
|
||||
await wait(500)
|
||||
expect(page.url()).toContain(`locale=${newLocale}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user