fix: locale switcher flakey test (#5761)
This commit is contained in:
@@ -141,11 +141,10 @@ export async function openDocControls(page: Page): Promise<void> {
|
||||
await expect(page.locator('.doc-controls__popup >> .popup__content')).toBeVisible()
|
||||
}
|
||||
|
||||
export async function changeLocale(page: Page, newLocale: string, skipURLCheck: boolean = false) {
|
||||
export async function changeLocale(page: Page, newLocale: string) {
|
||||
await page.locator('.localizer >> button').first().click()
|
||||
await page
|
||||
.locator(`.localizer`)
|
||||
.locator(`.popup >> button`, {
|
||||
.locator(`.localizer .popup.popup--active .popup-button-list button`, {
|
||||
hasText: newLocale,
|
||||
})
|
||||
.first()
|
||||
@@ -153,11 +152,7 @@ export async function changeLocale(page: Page, newLocale: string, skipURLCheck:
|
||||
|
||||
const regexPattern = new RegExp(`locale=${newLocale}`)
|
||||
|
||||
if (skipURLCheck) {
|
||||
await wait(500)
|
||||
} else {
|
||||
await expect(page).toHaveURL(regexPattern)
|
||||
}
|
||||
await expect(page).toHaveURL(regexPattern)
|
||||
}
|
||||
|
||||
export function exactText(text: string) {
|
||||
@@ -196,12 +191,25 @@ export const findTableCell = (page: Page, fieldName: string, rowTitle?: string):
|
||||
return cell
|
||||
}
|
||||
|
||||
export async function navigateToListCellLink(page: Page, selector = '.cell-id') {
|
||||
const cellLink = page.locator(`${selector} a`).first()
|
||||
const linkURL = await cellLink.getAttribute('href')
|
||||
await cellLink.click()
|
||||
await page.waitForURL(`**${linkURL}`)
|
||||
}
|
||||
|
||||
export const findTableRow = (page: Page, title: string): Locator => {
|
||||
const row = page.locator(`tbody tr:has-text("${title}")`)
|
||||
expect(row).toBeTruthy()
|
||||
return row
|
||||
}
|
||||
|
||||
export async function switchTab(page: Page, selector: string) {
|
||||
await page.locator(selector).click()
|
||||
await wait(300)
|
||||
await expect(page.locator(`${selector}.tabs-field__tab-button--active`)).toBeVisible()
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an error when browser console error messages (with some exceptions) are thrown, thus resulting
|
||||
* in the e2e test failing.
|
||||
|
||||
Reference in New Issue
Block a user