feat(mobile): explorer create/rename operation (#8628)

close AF-1560
This commit is contained in:
CatsJuice
2024-11-04 05:28:05 +00:00
parent 12e3cf1d07
commit 4cbf4b74d6
44 changed files with 1139 additions and 252 deletions

View File

@@ -1,5 +1,5 @@
/* eslint-disable unicorn/prefer-dom-node-dataset */
import { expect, type Page } from '@playwright/test';
import { expect, type Locator, type Page } from '@playwright/test';
export async function expandCollapsibleSection(page: Page, name: string) {
const divider = page.locator(`[data-collapsible]:has-text("${name}")`);
@@ -20,3 +20,24 @@ export async function expandCollapsibleSection(page: Page, name: string) {
export async function pageBack(page: Page) {
await page.getByTestId('page-header-back').tap();
}
export async function getAttrOfActiveElement(
page: Page,
attrName = 'data-testid'
) {
return await page.evaluate(name => {
const el = document.activeElement;
return el ? el.getAttribute(name) : '';
}, attrName);
}
/**
* Open the context menu of an explorer node
* @returns Menu Locator
*/
export async function openExplorerNodeMenu(page: Page, node: Locator) {
await node.getByTestId('menu-trigger').tap();
const menu = page.getByRole('dialog');
await expect(menu).toBeVisible();
return menu;
}