-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { test } from '@affine-test/kit/mobile'; | ||
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (2)[Mobile Safari] › explorer-folder.spec.ts:62:5 › create a folder and rename it
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (2)[Mobile Safari] › explorer-folder.spec.ts:62:5 › create a folder and rename it
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (2)[Mobile Safari] › explorer-folder.spec.ts:62:5 › create a folder and rename it
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 1 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:62:5 › create a folder and rename it
|
||
import { expect, type Locator, type Page } from '@playwright/test'; | ||
|
||
import { | ||
expandCollapsibleSection, | ||
getAttrOfActiveElement, | ||
openExplorerNodeMenu, | ||
} from './utils'; | ||
|
||
const locateFolder = async (scope: Page | Locator, name: string) => { | ||
return scope.locator(`[data-role="explorer-folder"][aria-label="${name}"]`); | ||
}; | ||
|
||
/** | ||
* Check rename input is focused | ||
*/ | ||
const isRenameInputFocused = async (page: Page) => { | ||
const focusElTestid = await getAttrOfActiveElement(page); | ||
expect(focusElTestid).toEqual('rename-input'); | ||
Check failure on line 19 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (2)[Mobile Safari] › explorer-folder.spec.ts:62:5 › create a folder and rename it
|
||
}; | ||
|
||
const createRootFolder = async (page: Page, name: string) => { | ||
const section = await expandCollapsibleSection(page, 'organize'); | ||
await section.getByTestId('explorer-bar-add-organize-button').tap(); | ||
const dialog = page.getByRole('dialog'); | ||
await expect(dialog).toBeVisible(); | ||
await isRenameInputFocused(page); | ||
await page.keyboard.type(name); | ||
await dialog.getByTestId('rename-confirm').tap(); | ||
await expect(dialog).not.toBeVisible(); | ||
const node = await locateFolder(section, name); | ||
return node; | ||
}; | ||
|
||
const createSubFolder = async (page: Page, parent: Locator, name: string) => { | ||
const menu = await openExplorerNodeMenu(page, parent); | ||
await menu.getByTestId('create-subfolder').tap(); | ||
|
||
const dialog = page.getByRole('dialog'); | ||
await expect(dialog).toBeVisible(); | ||
await isRenameInputFocused(page); | ||
await page.keyboard.type(name); | ||
await dialog.getByTestId('folder-rename-confirm').tap(); | ||
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (1)[Mobile Safari] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
Check failure on line 43 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:54:5 › create a sub folder
|
||
await expect(dialog).not.toBeVisible(); | ||
const node = await locateFolder(parent, name); | ||
return node; | ||
}; | ||
|
||
test('create a folder', async ({ page }) => { | ||
const node = await createRootFolder(page, 'Test Folder'); | ||
await expect(node).toBeVisible(); | ||
}); | ||
|
||
test('create a sub folder', async ({ page }) => { | ||
const parent = await createRootFolder(page, 'Parent Folder'); | ||
await expect(parent).toBeVisible(); | ||
await parent.tap(); | ||
const child = await createSubFolder(page, parent, 'Child Folder'); | ||
await expect(child).toBeVisible(); | ||
}); | ||
|
||
test('create a folder and rename it', async ({ page }) => { | ||
const originalName = 'Test Folder'; | ||
const appendedName = ' Renamed'; | ||
|
||
const folder = await createRootFolder(page, originalName); | ||
const menu = await openExplorerNodeMenu(page, folder); | ||
await menu.getByTestId('rename-folder').tap(); | ||
await isRenameInputFocused(page); | ||
await page.keyboard.type(appendedName); | ||
await menu.getByTestId('folder-rename-confirm').tap(); | ||
Check failure on line 71 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (2)[Mobile Safari] › explorer-folder.spec.ts:62:5 › create a folder and rename it
Check failure on line 71 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (2)[Mobile Safari] › explorer-folder.spec.ts:62:5 › create a folder and rename it
Check failure on line 71 in tests/affine-mobile/e2e/explorer-folder.spec.ts GitHub Actions / E2E Mobile Test (4)[Mobile Chrome] › explorer-folder.spec.ts:62:5 › create a folder and rename it
|
||
|
||
const renamedFolder = await locateFolder(page, originalName + appendedName); | ||
await expect(folder).not.toBeVisible(); | ||
await expect(renamedFolder).toBeVisible(); | ||
}); |