mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 21:38:44 +08:00
1d36e2e4b2
#### PR Dependency Tree * **PR #15317** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Virtualized mobile navigation with shell navigation and interactive swipe menus; coordinated mobile back handling with interactive phases/state restoration. * Added shared auth request proxy and message-port based token handling across mobile and worker flows. * **Bug Fixes** * Hydrated remote worker error stacks for calls and observable errors. * Improved SQLite FTS/indexer and nbstore optional text handling; refined docs-search ref parsing and notification loading/retry. * **Refactor / UX** * Modal focus-preservation and pointer behavior updates; improved mobile menu controls and back gesture plugins. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
75 lines
2.9 KiB
TypeScript
75 lines
2.9 KiB
TypeScript
import { test } from '@affine-test/kit/playwright';
|
|
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
|
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
|
import {
|
|
openSettingModal,
|
|
openWorkspaceSettingPanel,
|
|
} from '@affine-test/kit/utils/setting';
|
|
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
|
|
import { expect } from '@playwright/test';
|
|
|
|
test('Create new workspace, then delete it', async ({ page, workspace }) => {
|
|
await openHomePage(page);
|
|
await waitForEditorLoad(page);
|
|
await createLocalWorkspace({ name: 'Test Workspace' }, page);
|
|
|
|
await page.waitForSelector('[data-testid="workspace-name"]');
|
|
expect(await page.getByTestId('workspace-name').textContent()).toBe(
|
|
'Test Workspace'
|
|
);
|
|
await openSettingModal(page);
|
|
await openWorkspaceSettingPanel(page);
|
|
await page.getByTestId('delete-workspace-button').click();
|
|
await expect(
|
|
page.locator('.affine-notification-center').first()
|
|
).not.toBeVisible();
|
|
const workspaceNameDom = page.getByTestId('workspace-name');
|
|
const currentWorkspaceName = (await workspaceNameDom.evaluate(
|
|
node => node.textContent
|
|
)) as string;
|
|
expect(currentWorkspaceName).toBeDefined();
|
|
await page
|
|
.getByTestId('delete-workspace-input')
|
|
.pressSequentially(currentWorkspaceName);
|
|
const promise = page
|
|
.getByText('Successfully deleted', { exact: true })
|
|
.waitFor({ state: 'visible' });
|
|
await page.getByTestId('delete-workspace-confirm-button').click();
|
|
await promise;
|
|
await page.reload();
|
|
await page.waitForSelector('[data-testid="workspace-name"]');
|
|
await page.waitForTimeout(1000);
|
|
expect(await page.getByTestId('workspace-name').textContent()).toBe(
|
|
'Demo Workspace'
|
|
);
|
|
const currentWorkspace = await workspace.current();
|
|
|
|
expect(currentWorkspace.meta.flavour).toContain('local');
|
|
});
|
|
|
|
test('Delete last workspace', async ({ page }) => {
|
|
await openHomePage(page);
|
|
await waitForEditorLoad(page);
|
|
const workspaceNameDom = page.getByTestId('workspace-name');
|
|
const currentWorkspaceName = await workspaceNameDom.evaluate(
|
|
node => node.textContent
|
|
);
|
|
await openSettingModal(page);
|
|
await openWorkspaceSettingPanel(page);
|
|
await page.getByTestId('delete-workspace-button').click();
|
|
await page
|
|
.getByTestId('delete-workspace-input')
|
|
.pressSequentially(currentWorkspaceName as string);
|
|
const deleted = page
|
|
.getByText('Successfully deleted', { exact: true })
|
|
.waitFor({ state: 'visible' });
|
|
await page.getByTestId('delete-workspace-confirm-button').click();
|
|
await deleted;
|
|
await openHomePage(page);
|
|
await expect(page.getByTestId('new-workspace')).toBeVisible();
|
|
await createLocalWorkspace({ name: 'Test Workspace' }, page, true);
|
|
await page.waitForTimeout(1000);
|
|
await page.waitForSelector('[data-testid="workspace-name"]');
|
|
await expect(page.getByTestId('workspace-name')).toHaveText('Test Workspace');
|
|
});
|