refactor(core): desktop project struct (#8334)

This commit is contained in:
EYHN
2024-11-05 11:00:33 +08:00
committed by GitHub
parent 89d09fd5e9
commit 902635e60f
343 changed files with 3846 additions and 3508 deletions

View File

@@ -119,10 +119,10 @@ test('can sync collections between different browser', async ({
);
await enableCloudWorkspace(page);
await page.getByTestId('explorer-bar-add-collection-button').click();
const title = page.getByTestId('input-collection-title');
const title = page.getByTestId('prompt-modal-input');
await title.isVisible();
await title.fill('test collection');
await page.getByTestId('save-collection').click();
await page.getByTestId('prompt-modal-confirm').click();
{
const context = await browser.newContext();

View File

@@ -396,9 +396,9 @@ test('create a collection and delete it', async ({ page }) => {
// create a collection
await page.getByTestId('all-collection-new-button').click();
await expect(page.getByTestId('edit-collection-modal')).toBeVisible();
await page.getByTestId('input-collection-title').fill('test collection');
await page.getByTestId('save-collection').click();
await expect(page.getByTestId('prompt-modal-input')).toBeVisible();
await page.getByTestId('prompt-modal-input').fill('test collection');
await page.getByTestId('prompt-modal-confirm').click();
// check the collection is created
await clickSideBarAllPageButton(page);

View File

@@ -32,10 +32,10 @@ const dragToFavourites = async (
const createCollection = async (page: Page, name: string) => {
await page.getByTestId('explorer-bar-add-collection-button').click();
const input = page.getByTestId('input-collection-title');
const input = page.getByTestId('prompt-modal-input');
await expect(input).toBeVisible();
await input.fill(name);
await page.getByTestId('save-collection').click();
await page.getByTestId('prompt-modal-confirm').click();
const newCollectionId = getCurrentCollectionIdFromUrl(page);
const collection = page.getByTestId(`explorer-collection-${newCollectionId}`);
await expect(collection).toBeVisible();

View File

@@ -20,7 +20,7 @@ const removeOnboardingPages = async (page: Page) => {
await page.getByTestId('page-list-header-selection-checkbox').click();
await page.getByTestId('list-toolbar-delete').click();
// confirm delete
await page.getByTestId('confirm-delete-page').click();
await page.getByTestId('confirm-modal-confirm').click();
};
test.beforeEach(async ({ page }) => {
@@ -57,10 +57,10 @@ const createAndPinCollection = async (
await page.getByTestId('save-as-collection').click({
delay: 200,
});
const title = page.getByTestId('input-collection-title');
const title = page.getByTestId('prompt-modal-input');
await expect(title).toBeVisible();
await title.fill(options?.collectionName ?? 'test collection');
await page.getByTestId('save-collection').click();
await page.getByTestId('prompt-modal-confirm').click();
await page.waitForTimeout(100);
};
@@ -159,10 +159,10 @@ test('add collection from sidebar', async ({ page }) => {
);
await expect(nullCollection).toBeVisible();
await page.getByTestId('explorer-bar-add-collection-button').click();
const title = page.getByTestId('input-collection-title');
const title = page.getByTestId('prompt-modal-input');
await expect(title).toBeVisible();
await title.fill('test collection');
await page.getByTestId('save-collection').click();
await page.getByTestId('prompt-modal-confirm').click();
await page.waitForTimeout(100);
const collections = page.getByTestId('explorer-collections');
const items = collections.locator('[data-testid^="explorer-collection-"]');

View File

@@ -7,7 +7,6 @@ import {
getPageByTitle,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import { waitForLogMessage } from '@affine-test/kit/utils/utils';
import { expect } from '@playwright/test';
test('New a page and open it, then favorite it', async ({
@@ -62,23 +61,6 @@ test('Export to html, markdown and png', async ({ page }) => {
// }
});
test.skip('Export to pdf', async ({ page }) => {
const CheckedMessage = '[test] beforeprint event emitted';
page.addInitScript(() => {
window.addEventListener('beforeprint', () => {
console.log(CheckedMessage);
});
});
await openHomePage(page);
await waitForEditorLoad(page);
{
await clickPageMoreActions(page);
await page.getByTestId('export-menu').click();
await page.getByTestId('export-to-pdf').click();
expect(waitForLogMessage(page, CheckedMessage)).toBeTruthy();
}
});
test('Cancel favorite', async ({ page, workspace }) => {
await openHomePage(page);
await waitForEditorLoad(page);

View File

@@ -358,13 +358,12 @@ test('can use cmdk to delete page and restore it', async ({ page }) => {
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
await openQuickSearchByShortcut(page);
await keyboardDownAndSelect(page, 'Move to trash');
await page.getByTestId('confirm-delete-page').click();
await page.getByTestId('confirm-modal-confirm').click();
const restoreButton = page.getByTestId('page-restore-button');
await expect(restoreButton).toBeVisible();
await page.waitForTimeout(100);
await openQuickSearchByShortcut(page);
expect(await commandsIsVisible(page, 'Move to trash')).toBe(false);
expect(await commandsIsVisible(page, 'Export to PDF')).toBe(false);
expect(await commandsIsVisible(page, 'Restore from trash')).toBe(true);
await keyboardDownAndSelect(page, 'Restore from trash');
await expect(restoreButton).not.toBeVisible();

View File

@@ -152,7 +152,7 @@ export const openWorkspaceProperties = async (page: Page) => {
await page
.locator('[data-testid="workspace-list-item"] .setting-name')
.click();
await page.getByTestId('workspace-list-item-properties').click();
await page.getByTestId('workspace-list-item-workspace:properties').click();
};
export const selectVisibilitySelector = async (