gitbutler/app/e2e/utils.ts

26 lines
812 B
TypeScript
Raw Normal View History

2024-05-02 15:55:41 +03:00
import { Page } from '@playwright/test';
async function openDebugPanel(page: Page) {
const isOpen = (await page.locator('[data-testid="debug-panel"]')?.getAttribute('open')) === '';
if (!isOpen) {
await page.getByText('Debug').click();
await page.getByTestId('debug-panel').and(page.locator('[open]')).waitFor();
}
}
async function closeDebugPanel(page: Page) {
const isOpen = (await page.getByTestId('debug-panel')?.getAttribute('open')) === '';
if (isOpen) {
await page.getByText('Debug').click();
await page.getByTestId('debug-panel').and(page.locator(':not([open])')).waitFor();
}
}
export function getUtils(page: Page) {
return {
openDebugPanel: () => openDebugPanel(page),
closeDebugPane: () => closeDebugPanel(page)
};
}