AFFiNE/tests/affine-mobile/e2e/utils.ts
CatsJuice 21d3b5084a
refactor(mobile): use separate explorer components for mobile (#8503)
close AF-1488

- remove dnd related logic
- separate styles
- remove empty status, always show a `New` button in each level of tree
2024-10-22 03:01:04 +00:00

23 lines
709 B
TypeScript

/* eslint-disable unicorn/prefer-dom-node-dataset */
import { expect, type Page } from '@playwright/test';
export async function expandCollapsibleSection(page: Page, name: string) {
const divider = page.locator(`[data-collapsible]:has-text("${name}")`);
if ((await divider.getAttribute('data-collapsed')) === 'true') {
await divider.click();
}
await expect(divider).toHaveAttribute('data-collapsed', 'false');
const section = divider.locator(
'~ [data-testid="collapsible-section-content"]'
);
await expect(section).toBeVisible();
return section;
}
/**
* Click header "<" button
*/
export async function pageBack(page: Page) {
await page.getByTestId('page-header-back').tap();
}