mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
Merge branch 'master' into fix/lost-entrance-of-quick-search
This commit is contained in:
24
tests/libs/workspace-logic.ts
Normal file
24
tests/libs/workspace-logic.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
interface CreateWorkspaceParams {
|
||||
name: string;
|
||||
}
|
||||
export async function createWorkspace(
|
||||
params: CreateWorkspaceParams,
|
||||
page: Page
|
||||
) {
|
||||
// open workspace list modal
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
await workspaceName.click();
|
||||
|
||||
// open create workspace modal
|
||||
await page.locator('.add-icon').click();
|
||||
|
||||
// input workspace name
|
||||
await page.getByPlaceholder('Set a Workspace name').click();
|
||||
await page.getByPlaceholder('Set a Workspace name').fill(params.name);
|
||||
|
||||
// click create button
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
return page.waitForTimeout(300);
|
||||
}
|
||||
40
tests/local-first-workspace-list.spec.ts
Normal file
40
tests/local-first-workspace-list.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from './libs/playwright.js';
|
||||
import { loadPage } from './libs/load-page.js';
|
||||
import { createWorkspace } from './libs/workspace-logic.js';
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first workspace list', () => {
|
||||
test('just one item in the workspace list at first', async ({ page }) => {
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
await workspaceName.click();
|
||||
expect(
|
||||
page
|
||||
.locator('div')
|
||||
.filter({ hasText: 'AFFiNE TestLocal WorkspaceAvailable Offline' })
|
||||
.nth(3)
|
||||
).not.toBeNull();
|
||||
});
|
||||
|
||||
test.skip('create one workspace in the workspace list', async ({ page }) => {
|
||||
const newWorkspaceNameStr = 'New Workspace';
|
||||
await createWorkspace({ name: newWorkspaceNameStr }, page);
|
||||
|
||||
// check new workspace name
|
||||
const newWorkspaceName = page.getByTestId('workspace-name');
|
||||
expect(await newWorkspaceName.textContent()).toBe(newWorkspaceNameStr);
|
||||
});
|
||||
|
||||
test('create multi workspace in the workspace list', async ({ page }) => {
|
||||
await createWorkspace({ name: 'New Workspace 2' }, page);
|
||||
await createWorkspace({ name: 'New Workspace 3' }, page);
|
||||
|
||||
// show workspace list
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
await workspaceName.click();
|
||||
|
||||
//check workspace list length
|
||||
const workspaceCards = await page.$$('data-testid=workspace-card');
|
||||
expect(workspaceCards.length).toBe(3);
|
||||
});
|
||||
});
|
||||
@@ -5,15 +5,15 @@ import { loadPage } from './libs/load-page.js';
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first default workspace', () => {
|
||||
test.skip('Default workspace name', async ({ page }) => {
|
||||
test('preset workspace name', async ({ page }) => {
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
expect(await workspaceName.textContent()).toBe('AFFiNE');
|
||||
expect(await workspaceName.textContent()).toBe('AFFiNE Test');
|
||||
});
|
||||
|
||||
test.skip('Default workspace avatar', async ({ page }) => {
|
||||
test('default workspace avatar', async ({ page }) => {
|
||||
const workspaceAvatar = page.getByTestId('workspace-avatar');
|
||||
expect(await workspaceAvatar.innerHTML()).toBe(
|
||||
'<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="0.5" y="0.5" width="39" height="39" rx="19.5" stroke="#6880FF" fill="#FFF"></rect><path fillRule="evenodd" clipRule="evenodd" d="M18.6303 8.79688L11.2559 29.8393H15.5752L20.2661 15.2858L24.959 29.8393H29.2637L21.8881 8.79688H18.6303Z" fill="#6880FF"></path></svg>'
|
||||
);
|
||||
expect(
|
||||
await workspaceAvatar.locator('img').getAttribute('src')
|
||||
).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ test.describe('Add new page in quick search', () => {
|
||||
});
|
||||
|
||||
test.describe('Search and select', () => {
|
||||
test('Create a new page and search this page', async ({ page }) => {
|
||||
test.skip('Create a new page and search this page', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
await page.keyboard.insertText('test123456');
|
||||
|
||||
Reference in New Issue
Block a user