2024-05-31 13:28:42 +03:00
|
|
|
import { expect, type Page } from '@playwright/test';
|
2023-09-02 06:31:07 +03:00
|
|
|
|
|
|
|
export async function clickEdgelessModeButton(page: Page) {
|
|
|
|
await page.getByTestId('switch-edgeless-mode-button').click({
|
|
|
|
delay: 50,
|
|
|
|
});
|
2024-05-31 13:28:42 +03:00
|
|
|
await expect(
|
|
|
|
page.locator(
|
|
|
|
'[data-testid="switch-edgeless-mode-button"][data-active="true"]'
|
|
|
|
)
|
|
|
|
).toBeVisible();
|
2023-09-02 06:31:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function clickPageModeButton(page: Page) {
|
2024-07-26 07:35:31 +03:00
|
|
|
await page.getByTestId('switch-page-mode-button').click({
|
2023-09-02 06:31:07 +03:00
|
|
|
delay: 50,
|
|
|
|
});
|
2024-05-31 13:28:42 +03:00
|
|
|
await expect(
|
|
|
|
page.locator('[data-testid="switch-page-mode-button"][data-active="true"]')
|
|
|
|
).toBeVisible();
|
2023-09-02 06:31:07 +03:00
|
|
|
}
|
2024-07-25 15:21:21 +03:00
|
|
|
|
|
|
|
export async function ensureInPageMode(page: Page) {
|
|
|
|
await expect(
|
|
|
|
page.locator('[data-testid="switch-page-mode-button"][data-active="true"]')
|
|
|
|
).toBeVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function ensureInEdgelessMode(page: Page) {
|
|
|
|
await expect(
|
|
|
|
page.locator(
|
|
|
|
'[data-testid="switch-edgeless-mode-button"][data-active="true"]'
|
|
|
|
)
|
|
|
|
).toBeVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function getPageMode(page: Page): Promise<'page' | 'edgeless'> {
|
|
|
|
if (
|
|
|
|
await page
|
|
|
|
.locator('[data-testid="switch-page-mode-button"][data-active="true"]')
|
|
|
|
.isVisible()
|
|
|
|
) {
|
|
|
|
return 'page';
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
await page
|
|
|
|
.locator(
|
|
|
|
'[data-testid="switch-edgeless-mode-button"][data-active="true"]'
|
|
|
|
)
|
|
|
|
.isVisible()
|
|
|
|
) {
|
|
|
|
return 'edgeless';
|
|
|
|
}
|
|
|
|
throw new Error('Unknown mode');
|
|
|
|
}
|