mirror of
https://github.com/zonemaster/zonemaster-gui.git
synced 2025-11-22 16:31:04 +01:00
28 lines
769 B
TypeScript
28 lines
769 B
TypeScript
import type { Page } from "@playwright/test";
|
|
|
|
export function goToHome(page: Page) {
|
|
return page.goto('/');
|
|
}
|
|
|
|
export function setLang(page: Page, lang: string) {
|
|
return Promise.all([
|
|
page.waitForSelector('select#languageSwitcher'),
|
|
page.locator('select#languageSwitcher').selectOption(lang),
|
|
]);
|
|
}
|
|
|
|
export async function showOptions(page: Page) {
|
|
const showOptionSwitch = page.locator('#advanced-toggle');
|
|
|
|
if ((await showOptionSwitch.getAttribute('aria-expanded')) === 'false' ) {
|
|
return showOptionSwitch.click();
|
|
}
|
|
}
|
|
|
|
export function clearBrowserCache(page: Page) {
|
|
return Promise.all([
|
|
page.evaluate(() => window.localStorage.clear()),
|
|
page.evaluate(() => window.sessionStorage.clear()),
|
|
page.context().clearCookies(),
|
|
])
|
|
}
|