feat(core): enable new all docs by default (#12404)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
  - Simplified the user interface by always displaying the new All Pages view, removing the feature flag and old page version.
  - Updated selection interactions to use shift+click on document items instead of checkboxes.
  - Centralized drag-and-drop functionality in document list items and simplified drag handle behavior.
  - Generalized new page button component to accept standard HTML attributes.
  - Changed test ID attributes on new page buttons and list headers to use standard `data-testid`.

- **Bug Fixes**
  - Added stable test identifiers to new page buttons, document list items, menu items, and operation buttons for improved test reliability.
  - Enabled external drag-and-drop support on the trash button.

- **Tests**
  - Streamlined and updated end-to-end tests to match the new selection flow and UI changes, removing outdated or redundant test cases.
  - Simplified utility functions and wait conditions in test helpers for better accuracy and maintainability.
  - Updated selectors in tests to reflect new document item identifiers and centralized page element retrieval using utility functions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
EYHN
2025-05-22 11:29:05 +00:00
parent 333dc9cb89
commit 5035ab218d
28 changed files with 212 additions and 398 deletions

View File

@@ -2,17 +2,8 @@ import type { Page } from '@playwright/test';
// fixme: there could be multiple page lists in the Page
export const getPagesCount = async (page: Page) => {
const locator = page.locator('[data-testid="virtualized-page-list"]');
const pageListCount = await locator.count();
if (pageListCount === 0) {
return 0;
}
// locator is not a HTMLElement, so we can't use dataset
// oxlint-disable-next-line unicorn/prefer-dom-node-dataset
const count = await locator.getAttribute('data-total-count');
return count ? parseInt(count) : 0;
const locator = page.locator('[data-testid="doc-list-item"]');
return await locator.count();
};
export async function selectTag(page: Page, name: string | RegExp) {

View File

@@ -30,13 +30,10 @@ export async function waitForEditorLoad(page: Page) {
}
export async function waitForAllPagesLoad(page: Page) {
// if page-list-header-selection-checkbox is rendered, we believe all_pages is ready
await page.waitForSelector(
'[data-testid="page-list-header-selection-checkbox"]',
{
timeout: 20000,
}
);
// if doc-list-item is rendered, we believe all_pages is ready
await page.waitForSelector('[data-testid="doc-list-item"]', {
timeout: 20000,
});
}
export async function clickNewPageButton(page: Page, title?: string) {
@@ -112,15 +109,19 @@ export async function clickPageMoreActions(page: Page) {
}
export const getPageOperationButton = (page: Page, id: string) => {
return getPageItem(page, id).getByTestId('page-list-operation-button');
return getPageItem(page, id).getByTestId('doc-list-operation-button');
};
export const getPageItem = (page: Page, id: string) => {
return page.locator(`[data-page-id="${id}"][data-testid="page-list-item"]`);
return page.locator(`[data-doc-id="${id}"][data-testid="doc-list-item"]`);
};
export const getPageByTitle = (page: Page, title: string) => {
return page.getByTestId('page-list-item').getByText(title);
return page.getByTestId('doc-list-item').filter({
has: page.locator(
`[data-testid="doc-list-item-title"]:has-text("${title}")`
),
});
};
export type DragLocation =