15 lines
690 B
TypeScript
15 lines
690 B
TypeScript
import { expect, type Page } from "@playwright/test"
|
|
|
|
/** Keep the old request in flight while switching settings in the same app. */
|
|
export async function openSettings(page: Page) {
|
|
// The open confirmation owns focus until the request settles. Browser
|
|
// Back can navigate while the test still holds that same response.
|
|
if (await page.getByRole("alertdialog").or(page.getByRole("dialog")).first().isVisible()) {
|
|
await page.goBack()
|
|
} else {
|
|
await page.locator('[data-slot="sidebar-footer"]').getByRole("button").click()
|
|
await page.getByRole("menuitem", { name: "Настройки", exact: true }).click()
|
|
}
|
|
await expect(page).toHaveURL(/\/settings(?:[/?#]|$)/)
|
|
}
|