Merge branch 'canary' into stable

This commit is contained in:
李华桥
2023-11-23 21:31:42 +08:00
357 changed files with 16759 additions and 12832 deletions

View File

@@ -7,6 +7,7 @@ import {
loginUser,
} from '@affine-test/kit/utils/cloud';
import { dropFile } from '@affine-test/kit/utils/drop-file';
import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor';
import {
clickNewPageButton,
getBlockSuiteEditorTitle,
@@ -78,6 +79,52 @@ test.describe('collaboration', () => {
}
});
test('share page with default edgeless', async ({ page, browser }) => {
await page.reload();
await waitForEditorLoad(page);
await createLocalWorkspace(
{
name: 'test',
},
page
);
await enableCloudWorkspaceFromShareButton(page);
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('TEST TITLE', {
delay: 50,
});
await page.keyboard.press('Enter', { delay: 50 });
await page.keyboard.type('TEST CONTENT', { delay: 50 });
await clickEdgelessModeButton(page);
await expect(page.locator('affine-edgeless-page')).toBeVisible({
timeout: 1000,
});
await page.getByTestId('cloud-share-menu-button').click();
await page.getByTestId('share-menu-create-link-button').click();
await page.getByTestId('share-menu-copy-link-button').click();
// check share page is accessible
{
const context = await browser.newContext();
const url: string = await page.evaluate(() =>
navigator.clipboard.readText()
);
const page2 = await context.newPage();
await page2.goto(url);
await waitForEditorLoad(page2);
await expect(page.locator('affine-edgeless-page')).toBeVisible({
timeout: 1000,
});
expect(await page2.textContent('affine-paragraph')).toContain(
'TEST CONTENT'
);
const logo = page2.getByTestId('share-page-logo');
const editButton = page2.getByTestId('share-page-edit-button');
await expect(editButton).not.toBeVisible();
await expect(logo).toBeVisible();
}
});
test('can collaborate with other user and name should display when editing', async ({
page,
browser,

View File

@@ -9,5 +9,5 @@
"@affine-test/kit": "workspace:*",
"@playwright/test": "^1.39.0"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -11,5 +11,5 @@
"@types/fs-extra": "^11.0.2",
"fs-extra": "^11.1.1"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -62,43 +62,38 @@ test('app sidebar router forward/back', async ({ page }) => {
});
}
{
const title = (await page
.locator('.affine-doc-page-block-title')
.textContent()) as string;
expect(title.trim()).toBe('test3');
await expect(page.locator('.affine-doc-page-block-title')).toHaveText(
'test3'
);
}
await page.click('[data-testid="app-sidebar-arrow-button-back"]');
await page.click('[data-testid="app-sidebar-arrow-button-back"]');
{
const title = (await page
.locator('.affine-doc-page-block-title')
.textContent()) as string;
expect(title.trim()).toBe('test1');
await expect(page.locator('.affine-doc-page-block-title')).toHaveText(
'test1'
);
}
await page.click('[data-testid="app-sidebar-arrow-button-forward"]');
await page.click('[data-testid="app-sidebar-arrow-button-forward"]');
{
const title = (await page
.locator('.affine-doc-page-block-title')
.textContent()) as string;
expect(title.trim()).toBe('test3');
await expect(page.locator('.affine-doc-page-block-title')).toHaveText(
'test3'
);
}
await historyShortcut(page, 'goBack');
await historyShortcut(page, 'goBack');
{
const title = (await page
.locator('.affine-doc-page-block-title')
.textContent()) as string;
expect(title.trim()).toBe('test1');
await expect(page.locator('.affine-doc-page-block-title')).toHaveText(
'test1'
);
}
await historyShortcut(page, 'goForward');
await historyShortcut(page, 'goForward');
{
const title = (await page
.locator('.affine-doc-page-block-title')
.textContent()) as string;
expect(title.trim()).toBe('test3');
await expect(page.locator('.affine-doc-page-block-title')).toHaveText(
'test3'
);
}
});
// }

View File

@@ -12,5 +12,5 @@
"fs-extra": "^11.1.1",
"playwright": "^1.39.0"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -9,14 +9,14 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/global": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/block-std": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/global": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
"@playwright/test": "^1.39.0",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
"serve": "^14.2.1"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -9,14 +9,14 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/global": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/block-std": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/global": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
"@playwright/test": "^1.39.0",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
"serve": "^14.2.1"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -9,14 +9,14 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/global": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/block-std": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/global": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
"@playwright/test": "^1.39.0",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
"serve": "^14.2.1"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -9,14 +9,14 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/global": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/block-std": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/global": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
"@playwright/test": "^1.39.0",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
"serve": "^14.2.1"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -18,5 +18,5 @@ test('Duplicate page should work', async ({ page }) => {
const duplicateButton = page.getByTestId('editor-option-menu-duplicate');
await duplicateButton.click({ delay: 100 });
const title2 = getBlockSuiteEditorTitle(page);
expect(await title2.innerText()).toBe('test(1)');
await expect(title2).toHaveText('test(1)', { timeout: 1000 });
});

View File

@@ -5,7 +5,10 @@ import {
getBlockSuiteEditorTitle,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import { clickSideBarCurrentWorkspaceBanner } from '@affine-test/kit/utils/sidebar';
import {
clickSideBarAllPageButton,
clickSideBarCurrentWorkspaceBanner,
} from '@affine-test/kit/utils/sidebar';
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
import type { Page } from '@playwright/test';
import { expect } from '@playwright/test';
@@ -76,6 +79,7 @@ test('Show collections items in sidebar', async ({ page }) => {
skipInitialPage: true,
});
expect(await items.count()).toBe(1);
await clickSideBarAllPageButton(page);
await createLocalWorkspace(
{
name: 'Test 1',

View File

@@ -25,22 +25,20 @@ test('Open last workspace when back to affine', async ({ page }) => {
expect(currentWorkspaceName).toEqual('New Workspace 2');
});
test.skip('Download client tip', async ({ page }) => {
test('Download client tip', async ({ page }) => {
await openHomePage(page);
const downloadClientTipItem = page.locator(
'[data-testid=download-client-tip]'
);
await expect(downloadClientTipItem).toBeVisible();
const localDemoTipsItem = page.locator('[data-testid=local-demo-tips]');
await expect(localDemoTipsItem).toBeVisible();
const closeButton = page.locator(
'[data-testid=download-client-tip-close-button]'
'[data-testid=local-demo-tips-close-button]'
);
await closeButton.click();
await expect(downloadClientTipItem).not.toBeVisible();
await page.goto('http://localhost:8080');
const currentDownloadClientTipItem = page.locator(
'[data-testid=download-client-tip]'
await expect(localDemoTipsItem).not.toBeVisible();
await page.reload();
const currentLocalDemoTipsItemItem = page.locator(
'[data-testid=local-demo-tips]'
);
await expect(currentDownloadClientTipItem).toBeVisible();
await expect(currentLocalDemoTipsItemItem).toBeVisible();
});
test('Check the class name for the scrollbar', async ({ page }) => {

View File

@@ -9,9 +9,11 @@ import {
import { clickSideBarAllPageButton } from '@affine-test/kit/utils/sidebar';
import { expect, type Page } from '@playwright/test';
const openQuickSearchByShortcut = async (page: Page) => {
const openQuickSearchByShortcut = async (page: Page, checkVisible = true) => {
await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 }));
await page.waitForTimeout(1000);
if (checkVisible) {
expect(page.getByTestId('cmdk-quick-search')).toBeVisible();
}
};
const keyboardDownAndSelect = async (page: Page, label: string) => {
@@ -80,7 +82,9 @@ async function assertResultList(page: Page, texts: string[]) {
.allInnerTexts();
const actualSplit = actual[0].split('\n');
expect(actualSplit[0]).toEqual(texts[0]);
expect(actualSplit[1]).toEqual(texts[1]);
if (actualSplit[1]) {
expect(actualSplit[1]).toEqual(texts[1]);
}
}
async function titleIsFocused(page: Page) {
@@ -133,11 +137,13 @@ test('Create a new page with keyword', async ({ page }) => {
await waitForEditorLoad(page);
await clickNewPageButton(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
const addNewPage = page.locator('[cmdk-item] >> text=New "test123456" Page');
await page.keyboard.insertText('"test123456"');
const addNewPage = page.locator(
'[cmdk-item] >> text=New ""test123456"" Page'
);
await addNewPage.click();
await page.waitForTimeout(300);
await assertTitle(page, 'test123456');
await assertTitle(page, '"test123456"');
});
test('Enter a keyword to search for', async ({ page }) => {
@@ -188,7 +194,7 @@ test('Navigate to the 404 page and try to open quick search', async ({
await page.goto('http://localhost:8080/404');
const notFoundTip = page.locator('button >> text=Back to My Content');
await expect(notFoundTip).toBeVisible();
await openQuickSearchByShortcut(page);
await openQuickSearchByShortcut(page, false);
const quickSearch = page.locator('[data-testid=cmdk-quick-search]');
await expect(quickSearch).toBeVisible({ visible: false });
});
@@ -215,6 +221,7 @@ test('Autofocus input after select', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await clickNewPageButton(page);
await page.waitForTimeout(500); // wait for new page loaded
await openQuickSearchByShortcut(page);
await page.keyboard.press('ArrowUp');
const locator = page.locator('[cmdk-input]');
@@ -251,8 +258,9 @@ test('assert the recent browse pages are on the recent list', async ({
await waitForEditorLoad(page);
{
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('sgtokidoki');
expect(await title.innerText()).toBe('sgtokidoki');
await title.click();
await title.pressSequentially('sgtokidoki', { delay: 100 });
await expect(title).toHaveText('sgtokidoki');
}
// create second page
@@ -262,8 +270,9 @@ test('assert the recent browse pages are on the recent list', async ({
await waitForEditorLoad(page);
{
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('theliquidhorse');
expect(await title.innerText()).toBe('theliquidhorse');
await title.click();
await title.pressSequentially('theliquidhorse', { delay: 100 });
await expect(title).toHaveText('theliquidhorse');
}
await page.waitForTimeout(200);
@@ -273,8 +282,9 @@ test('assert the recent browse pages are on the recent list', async ({
await waitForEditorLoad(page);
{
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('battlekot');
expect(await title.innerText()).toBe('battlekot');
await title.click();
await title.pressSequentially('battlekot', { delay: 100 });
await expect(title).toHaveText('battlekot');
}
await openQuickSearchByShortcut(page);
@@ -283,9 +293,9 @@ test('assert the recent browse pages are on the recent list', async ({
const quickSearchItems = page.locator(
'[cmdk-item] [data-testid="cmdk-label"]'
);
expect(await quickSearchItems.nth(0).textContent()).toBe('battlekot');
expect(await quickSearchItems.nth(1).textContent()).toBe('theliquidhorse');
expect(await quickSearchItems.nth(2).textContent()).toBe('sgtokidoki');
await expect(quickSearchItems.nth(0)).toHaveText('battlekot');
await expect(quickSearchItems.nth(1)).toHaveText('theliquidhorse');
await expect(quickSearchItems.nth(2)).toHaveText('sgtokidoki');
}
// create forth page, and check does the recent page list only contains three pages
@@ -299,8 +309,9 @@ test('assert the recent browse pages are on the recent list', async ({
await waitForEditorLoad(page);
{
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('affine is the best');
expect(await title.innerText()).toBe('affine is the best');
await title.click();
await title.pressSequentially('affine is the best', { delay: 100 });
await expect(title).toHaveText('affine is the best', { timeout: 500 });
}
await page.waitForTimeout(1000);
await openQuickSearchByShortcut(page);
@@ -308,9 +319,7 @@ test('assert the recent browse pages are on the recent list', async ({
const quickSearchItems = page.locator(
'[cmdk-item] [data-testid="cmdk-label"]'
);
expect(await quickSearchItems.nth(0).textContent()).toBe(
'affine is the best'
);
await expect(quickSearchItems.nth(0)).toHaveText('affine is the best');
}
});
@@ -401,3 +410,25 @@ test('can use cmdk to search page content and scroll to it, then the block will
const selectionElement = page.locator('affine-block-selection');
await expect(selectionElement).toBeVisible();
});
test('Create a new page with special characters in the title and search for this page', async ({
page,
}) => {
const specialTitle = '"test123456"';
await openHomePage(page);
await waitForEditorLoad(page);
await clickNewPageButton(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill(specialTitle);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText(specialTitle);
await page.waitForTimeout(300);
await assertResultList(page, [specialTitle, specialTitle]);
await page.keyboard.press('Enter');
await page.waitForTimeout(300);
await assertTitle(page, specialTitle);
});

View File

@@ -110,11 +110,11 @@ test('Different workspace should have different name in the setting panel', asyn
await createLocalWorkspace({ name: 'New Workspace 3' }, page);
await openSettingModal(page);
await page.getByTestId('current-workspace-label').click();
expect(await page.getByTestId('workspace-name-input').inputValue()).toBe(
await expect(page.getByTestId('workspace-name-input')).toHaveValue(
'New Workspace 3'
);
await page.getByText('New Workspace 2').click();
expect(await page.getByTestId('workspace-name-input').inputValue()).toBe(
await expect(page.getByTestId('workspace-name-input')).toHaveValue(
'New Workspace 2'
);
});

View File

@@ -14,6 +14,10 @@ test('Open shortcuts modal', async ({ page }) => {
await shortcutsIcon.click();
await page.waitForTimeout(1000);
const shortcutsModal = page.locator('[data-testid=shortcuts-modal]');
await expect(shortcutsModal).toContainText('Page');
const settingModal = page.getByTestId('setting-modal');
await expect(settingModal).toBeVisible();
const title = page.getByTestId('keyboard-shortcuts-title');
await expect(title).toBeVisible();
});

View File

@@ -9,5 +9,5 @@
"@affine-test/kit": "workspace:*",
"@playwright/test": "^1.39.0"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -7,3 +7,6 @@ BUILD_TYPE=canary yarn run build
cd tests/affine-migration
yarn run e2e
```
> Tips:
> Run `yarn dev` to start dev server in 8080 could make debugging more quickly.

View File

@@ -34,26 +34,21 @@ test('v1 to v4', async ({ page }) => {
await page.goto(coreUrl);
await clickSideBarAllPageButton(page);
await page.getByText('hello').click();
//#region fixme(himself65): blocksuite issue, data cannot be loaded to store
const url = page.url();
await page.waitForTimeout(5000);
await page.goto(url);
//#endregion
await expect(page.getByTestId('upgrade-workspace-button')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await expect(page.getByText('Refresh Current Page')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await expect(page.getByTestId('page-list-item')).toHaveCount(2);
await page
.getByTestId('page-list-item-title-text')
.getByText('hello')
.click();
await waitForEditorLoad(page);
expect(await page.locator('v-line').nth(0).textContent()).toBe('hello');
const changedLocalStorageData = await page.evaluate(() =>
window.readAffineLocalStorage()
);
const workspaces = JSON.parse(
changedLocalStorageData['jotai-workspaces']
) as any[];
for (const workspace of workspaces) {
expect(workspace.version).toBe(4);
}
await expect(page.locator('v-line').nth(0)).toHaveText('hello');
});
test('v2 to v4, database migration', async ({ page }) => {
@@ -62,63 +57,72 @@ test('v2 to v4, database migration', async ({ page }) => {
'0.8.0-canary.7'
);
//#region fixme(himself65): blocksuite issue, data cannot be loaded to store
const allPagePath = `${coreUrl}/workspace/${localStorageData.last_workspace_id}/all`;
await page.goto(allPagePath);
await page.waitForTimeout(5000);
//#endregion
const detailPagePath = `${coreUrl}/workspace/${localStorageData.last_workspace_id}/${localStorageData.last_page_id}`;
await page.goto(detailPagePath);
await expect(page.getByTestId('upgrade-workspace-button')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await expect(page.getByText('Refresh Current Page')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await waitForEditorLoad(page);
// check page mode is correct
expect(await page.locator('v-line').nth(0).textContent()).toBe('hello');
expect(await page.locator('affine-database').isVisible()).toBe(true);
await expect(page.locator('v-line').nth(0)).toHaveText('hello');
await expect(page.locator('affine-database')).toBeVisible();
// check edgeless mode is correct
await clickEdgelessModeButton(page);
await page.waitForTimeout(200);
expect(await page.locator('affine-database').isVisible()).toBe(true);
const changedLocalStorageData = await page.evaluate(() =>
window.readAffineLocalStorage()
);
const workspaces = JSON.parse(
changedLocalStorageData['jotai-workspaces']
) as any[];
for (const workspace of workspaces) {
expect(workspace.version).toBe(4);
}
await expect(page.locator('affine-database')).toBeVisible();
});
test('v3 to v4, surface migration', async ({ page }) => {
const { localStorageData } = await open404PageToInitData(page, '0.8.4');
//#region fixme(himself65): blocksuite issue, data cannot be loaded to store
const allPagePath = `${coreUrl}/workspace/${localStorageData.last_workspace_id}/all`;
await page.goto(allPagePath);
await page.waitForTimeout(5000);
//#endregion
const detailPagePath = `${coreUrl}/workspace/${localStorageData.last_workspace_id}/${localStorageData.last_page_id}`;
await page.goto(detailPagePath);
await expect(page.getByTestId('upgrade-workspace-button')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await expect(page.getByText('Refresh Current Page')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await waitForEditorLoad(page);
// check edgeless mode is correct
await clickEdgelessModeButton(page);
await expect(page.locator('edgeless-toolbar')).toBeVisible();
await expect(page.locator('affine-edgeless-page')).toBeVisible();
});
const changedLocalStorageData = await page.evaluate(() =>
window.readAffineLocalStorage()
);
const workspaces = JSON.parse(
changedLocalStorageData['jotai-workspaces']
) as any[];
for (const workspace of workspaces) {
expect(workspace.version).toBe(4);
}
test('v0 to v4, subdoc migration', async ({ page }) => {
await open404PageToInitData(page, '0.6.1-beta.1');
await page.goto(coreUrl);
await clickSideBarAllPageButton(page);
await expect(page.getByTestId('upgrade-workspace-button')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await expect(page.getByText('Refresh Current Page')).toBeVisible();
await page.getByTestId('upgrade-workspace-button').click();
await expect(page.getByTestId('page-list-item')).toHaveCount(2);
await page
.getByTestId('page-list-item-title-text')
.getByText('hello')
.click();
await waitForEditorLoad(page);
// check page mode is correct
await expect(page.locator('v-line').nth(0)).toHaveText('hello');
await expect(page.locator('v-line').nth(1)).toHaveText('TEST CONTENT');
// check edgeless mode is correct
await clickEdgelessModeButton(page);
await expect(page.locator('edgeless-toolbar')).toBeVisible();
await expect(page.locator('affine-edgeless-page')).toBeVisible();
});
test('v0 to v4, subdoc migration', async ({ page }) => {

View File

@@ -7,11 +7,11 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/global": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/block-std": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/global": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
"@playwright/test": "^1.39.0"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -9,5 +9,5 @@
"@affine-test/kit": "workspace:*",
"@playwright/test": "^1.39.0"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -3,5 +3,5 @@
"exports": {
"./*": "./*"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -2,7 +2,7 @@
"name": "@affine-test/kit",
"private": true,
"type": "module",
"version": "0.10.2",
"version": "0.10.3-canary.2",
"exports": {
"./electron": "./electron.ts",
"./playwright": "./playwright.ts",

View File

@@ -1,4 +1,6 @@
import type { Page } from '@playwright/test';
import { expect, type Page } from '@playwright/test';
import { waitForEditorLoad } from './page-logic';
interface CreateWorkspaceParams {
name: string;
@@ -28,10 +30,17 @@ export async function createLocalWorkspace(
await page.getByPlaceholder('Set a Workspace name').fill(params.name);
// click create button
await page.getByRole('button', { name: 'Create' }).click({
await page.getByTestId('create-workspace-create-button').click({
delay: 500,
});
await expect(
page.getByTestId('create-workspace-create-button')
).not.toBeAttached();
await waitForEditorLoad(page);
await expect(page.getByTestId('workspace-name')).toHaveText(params.name);
// if (isDesktop) {
// await page.getByTestId('create-workspace-continue-button').click();
// }

View File

@@ -9,53 +9,52 @@
"dependencies": {
"@affine/component": "workspace:*",
"@affine/i18n": "workspace:*",
"@mui/material": "^5.14.14",
"@storybook/addon-actions": "^7.4.6",
"@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-interactions": "^7.4.6",
"@storybook/addon-links": "^7.4.6",
"@storybook/addon-storysource": "^7.4.6",
"@storybook/blocks": "^7.4.6",
"@storybook/builder-vite": "^7.4.6",
"@storybook/addon-actions": "^7.5.3",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-interactions": "^7.5.3",
"@storybook/addon-links": "^7.5.3",
"@storybook/addon-storysource": "^7.5.3",
"@storybook/blocks": "^7.5.3",
"@storybook/builder-vite": "^7.5.3",
"@storybook/jest": "^0.2.3",
"@storybook/react": "^7.4.6",
"@storybook/react-vite": "^7.4.6",
"@storybook/test-runner": "^0.13.0",
"@storybook/react": "^7.5.3",
"@storybook/react-vite": "^7.5.3",
"@storybook/test-runner": "^0.15.2",
"@storybook/testing-library": "^0.2.2",
"@vitejs/plugin-react": "^4.1.0",
"concurrently": "^8.2.1",
"@vitejs/plugin-react": "^4.2.0",
"concurrently": "^8.2.2",
"jest-mock": "^29.7.0",
"serve": "^14.2.1",
"ses": "^0.18.8",
"storybook": "^7.4.6",
"storybook": "^7.5.3",
"storybook-dark-mode": "^3.0.1",
"wait-on": "^7.0.1"
"wait-on": "^7.2.0"
},
"devDependencies": {
"@blocksuite/block-std": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/editor": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/global": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/icons": "2.1.35",
"@blocksuite/lit": "0.0.0-20231116023037-31273bb7-nightly",
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
"@dnd-kit/sortable": "^7.0.2",
"@blocksuite/block-std": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/editor": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/global": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/icons": "2.1.36",
"@blocksuite/lit": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
"@blocksuite/virgo": "0.0.0-20231122113751-6bf81eb3-nightly",
"@dnd-kit/sortable": "^8.0.0",
"@tomfreudenberg/next-auth-mock": "^0.5.6",
"chromatic": "^7.4.0",
"foxact": "^0.2.20",
"jotai": "^2.4.3",
"chromatic": "^9.1.0",
"foxact": "^0.2.26",
"jotai": "^2.5.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "^6.16.0",
"storybook-addon-react-router-v6": "^2.0.7"
"react-router-dom": "^6.19.0",
"storybook-addon-react-router-v6": "^2.0.10"
},
"peerDependencies": {
"@blocksuite/blocks": "*",
"@blocksuite/editor": "*",
"@blocksuite/global": "*",
"@blocksuite/icons": "2.1.34",
"@blocksuite/lit": "*",
"@blocksuite/store": "*"
},
"version": "0.10.2"
"version": "0.10.3-canary.2"
}

View File

@@ -1,4 +1,4 @@
import { BrowserWarning, DownloadTips } from '@affine/component/affine-banner';
import { BrowserWarning, LocalDemoTips } from '@affine/component/affine-banner';
import type { StoryFn } from '@storybook/react';
import { useState } from 'react';
@@ -24,9 +24,13 @@ export const Default: StoryFn = () => {
export const Download: StoryFn = () => {
const [, setIsClosed] = useState(true);
const [isLoggedIn, setIsLoggedIn] = useState(false);
return (
<div>
<DownloadTips
<LocalDemoTips
isLoggedIn={isLoggedIn}
onLogin={() => setIsLoggedIn(true)}
onEnableCloud={() => {}}
onClose={() => {
setIsClosed(false);
}}

View File

@@ -1,41 +0,0 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import { Breadcrumbs } from '@affine/component';
import { Link, Typography } from '@mui/material';
import { expect } from '@storybook/jest';
import type { Meta, StoryFn } from '@storybook/react';
import { within } from '@storybook/testing-library';
export default {
title: 'AFFiNE/Breadcrumbs',
component: Breadcrumbs,
parameters: {
chromatic: { disableSnapshot: true },
},
} as Meta<typeof Breadcrumbs>;
const Template: StoryFn = args => <Breadcrumbs {...args} />;
export const Primary = Template.bind(undefined);
Primary.play = async ({ canvasElement }) => {
const canvas = within(canvasElement);
const text = canvas.getByText('AFFiNE');
expect(text.getAttribute('data-testid')).toBe('affine');
};
Primary.args = {
children: [
<Link
data-testid="affine"
key="1"
underline="hover"
color="inherit"
href="/"
>
AFFiNE
</Link>,
<Link key="2" underline="hover" color="inherit" href="/Docs/">
Docs
</Link>,
<Typography key="3" color="text.primary">
Introduction
</Typography>,
],
};

View File

@@ -15,4 +15,4 @@ If you find a bug, please file an issue on [GitHub](https://github.com/toeveryth
## Contributing
We welcome contributions from the community! [Get started here](https://github.com/toeverything/AFFiNE/blob/master/docs/BUILDING.md)
We welcome contributions from the community! [Get started here](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md)

View File

@@ -67,6 +67,31 @@ AffineNewPageButton.play = async ({ canvasElement }) => {
};
const testTags = [
{
color: 'red',
id: 'test-tag-id-cccc',
value: 'cccccccccccccccc',
},
{
color: 'red',
id: 'test-tag-id-a',
value: 'a',
},
{
color: 'red',
id: 'test-tag-id-b',
value: 'b',
},
{
color: 'red',
id: 'test-tag-id-c',
value: 'c',
},
{
color: 'red',
id: 'test-tag-id-d',
value: 'd',
},
{
color: 'red',
id: 'test-tag-id-0',

View File

@@ -1,9 +1,6 @@
import { toast } from '@affine/component';
import {
PublicLinkDisableModal,
StyledDisableButton,
} from '@affine/component/share-menu';
import { ShareMenu } from '@affine/component/share-menu';
import { PublicLinkDisableModal } from '@affine/component/disable-public-link';
import { ShareMenu } from '@affine/core/components/affine/share-page-modal/share-menu';
import type {
AffineCloudWorkspace,
LocalWorkspace,
@@ -24,20 +21,6 @@ export default {
},
} satisfies Meta;
const sharePageMap = new Map<string, boolean>([]);
// todo: use a real hook
const useIsSharedPage = (
_workspaceId: string,
pageId: string
): [isSharePage: boolean, setIsSharePage: (enable: boolean) => void] => {
const [isShared, setIsShared] = useState(sharePageMap.get(pageId) ?? false);
const togglePagePublic = (enable: boolean) => {
setIsShared(enable);
sharePageMap.set(pageId, enable);
};
return [isShared, togglePagePublic];
};
async function initPage(page: Page) {
await page.waitForLoaded();
// Add page block and surface block at root level
@@ -88,11 +71,8 @@ export const Basic: StoryFn = () => {
return (
<ShareMenu
currentPage={blockSuiteWorkspace.getPage('page0') as Page}
useIsSharedPage={useIsSharedPage}
workspace={localWorkspace}
onEnableAffineCloud={unimplemented}
togglePagePublic={unimplemented}
exportHandler={unimplemented}
/>
);
};
@@ -119,11 +99,8 @@ export const AffineBasic: StoryFn = () => {
return (
<ShareMenu
currentPage={blockSuiteWorkspace.getPage('page0') as Page}
useIsSharedPage={useIsSharedPage}
workspace={affineWorkspace}
onEnableAffineCloud={unimplemented}
togglePagePublic={unimplemented}
exportHandler={unimplemented}
/>
);
};
@@ -133,9 +110,7 @@ export const DisableModal: StoryFn = () => {
use(promise);
return (
<>
<StyledDisableButton onClick={() => setOpen(!open)}>
Disable Public Link
</StyledDisableButton>
<div onClick={() => setOpen(!open)}>Disable Public Link</div>
<PublicLinkDisableModal
open={open}
onConfirm={() => {