refactor: using unified nanoid (#4519)

This commit is contained in:
Alex Yang
2023-09-27 21:53:04 -05:00
committed by GitHub
parent 56f75160f3
commit 603f82ffc2
38 changed files with 258 additions and 183 deletions
@@ -9,6 +9,7 @@ import {
check8080Available,
setupProxyServer,
} from '@affine-test/kit/utils/proxy';
import { clickSideBarAllPageButton } from '@affine-test/kit/utils/sidebar';
import { expect } from '@playwright/test';
const { switchToNext } = setupProxyServer(
@@ -28,5 +29,8 @@ test('init page', async ({ page, context }) => {
await page.waitForTimeout(1000);
await page.goto('http://localhost:8081/');
await waitForEditorLoad(page);
await clickSideBarAllPageButton(page);
await page.getByText('hello').click();
await waitForEditorLoad(page);
expect(await page.locator('v-line').nth(0).textContent()).toBe('hello');
});
@@ -10,10 +10,10 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/blocks": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/global": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/store": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@playwright/test": "^1.37.1",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
@@ -37,6 +37,10 @@ test('database migration', async ({ page, context }) => {
await switchToNext();
await page.waitForTimeout(1000);
await page.goto(url);
//#region fixme(himself65): blocksuite issue, data cannot be loaded to store
await page.waitForTimeout(5000);
await page.reload();
//#endregion
await waitForEditorLoad(page);
// check page mode is correct
expect(await page.locator('v-line').nth(0).textContent()).toBe('hello');
@@ -9,10 +9,10 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/blocks": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/global": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/store": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@playwright/test": "^1.37.1",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
@@ -52,6 +52,10 @@ test('surface migration', async ({ page, context }) => {
await switchToNext();
await page.waitForTimeout(1000);
await page.goto(url);
//#region fixme(himself65): blocksuite issue, data cannot be loaded to store
await page.waitForTimeout(5000);
await page.reload();
//#endregion
await waitForEditorLoad(page);
// check edgeless mode is correct
+4 -4
View File
@@ -9,10 +9,10 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/blocks": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/global": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/store": "0.0.0-20230921103931-38d8f07a-nightly",
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@playwright/test": "^1.37.1",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
+3 -5
View File
@@ -415,11 +415,9 @@ test('image able to download', async ({ page }) => {
const downloadPromise = page.waitForEvent('download');
await locator.getByTestId('download-button').click();
const download = await downloadPromise;
expect(download.suggestedFilename()).toBe(`${blobId}.png`);
await download.saveAs(`download/ + ${download.suggestedFilename()}`);
expect(
fs.existsSync(`download/ + ${download.suggestedFilename()}`)
).toBeTruthy();
const name = download.suggestedFilename();
await download.saveAs(`download/ + ${name}`);
expect(fs.existsSync(`download/ + ${name}`)).toBeTruthy();
});
test('image should only able to move when image is larger than viewport', async ({
@@ -33,9 +33,15 @@ const createAndPinCollection = async (
name: 'test page',
});
await expect(cell).toBeVisible();
await page.getByTestId('create-first-filter').click();
await page.getByTestId(`filler-tag-Created`).click();
await page.getByTestId('save-as-collection').click();
await page.getByTestId('create-first-filter').click({
delay: 200,
});
await page.getByTestId(`filler-tag-Created`).click({
delay: 200,
});
await page.getByTestId('save-as-collection').click({
delay: 200,
});
const title = page.getByTestId('input-collection-title');
await title.isVisible();
await title.fill(options?.collectionName ?? 'test collection');
@@ -90,11 +90,13 @@ test('page delete -> create new page -> refresh page -> new page should be appea
await clickNewPageButton(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page1');
await page.waitForTimeout(1000);
const newPageId1 = page.url().split('/').reverse()[0];
await page.getByTestId('all-pages').click();
await clickNewPageButton(page);
await getBlockSuiteEditorTitle(page).click();
await getBlockSuiteEditorTitle(page).fill('this is a new page2');
await page.waitForTimeout(1000);
const newPageId2 = page.url().split('/').reverse()[0];
await page.getByTestId('all-pages').click();
await page.reload();