refactor!: remove next.js (#3267)

This commit is contained in:
Alex Yang
2023-07-19 00:53:10 +08:00
committed by GitHub
parent 79227a1e7c
commit 47f12f77f2
296 changed files with 4115 additions and 3617 deletions

View File

@@ -15,7 +15,6 @@ import {
} from '@affine-test/kit/utils/filter';
import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
closeDownloadTip,
getBlockSuiteEditorTitle,
waitEditorLoad,
} from '@affine-test/kit/utils/page-logic';
@@ -74,7 +73,6 @@ test('allow creation of filters by favorite', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await clickSideBarAllPageButton(page);
await closeDownloadTip(page);
await createFirstFilter(page, 'Favourited');
await page
.locator('[data-testid="filter-arg"]', { hasText: 'true' })
@@ -89,7 +87,6 @@ test('allow creation of filters by created time', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await clickSideBarAllPageButton(page);
await closeDownloadTip(page);
await createFirstFilter(page, 'Created');
await checkFilterName(page, 'after');
// init date
@@ -120,7 +117,6 @@ test('creation of filters by created time, then click date picker to modify the
await openHomePage(page);
await waitEditorLoad(page);
await clickSideBarAllPageButton(page);
await closeDownloadTip(page);
await createFirstFilter(page, 'Created');
await checkFilterName(page, 'after');
// init date
@@ -149,7 +145,6 @@ test('use monthpicker to modify the month of datepicker', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await clickSideBarAllPageButton(page);
await closeDownloadTip(page);
await createFirstFilter(page, 'Created');
await checkFilterName(page, 'after');
// init date
@@ -173,11 +168,9 @@ test('use monthpicker to modify the month of datepicker', async ({ page }) => {
test('allow creation of filters by tags', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await closeDownloadTip(page);
await createPageWithTag(page, { title: 'Page A', tags: ['A'] });
await createPageWithTag(page, { title: 'Page B', tags: ['B'] });
await clickSideBarAllPageButton(page);
await closeDownloadTip(page);
await createFirstFilter(page, 'Tags');
await checkFilterName(page, 'is not empty');
await checkPagesCount(page, 2);

View File

@@ -1,12 +0,0 @@
import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test';
test('should have page0', async ({ page }) => {
await page.goto('http://localhost:8080/_debug/init-page.html');
await page.waitForSelector('v-line');
const pageId = await page.evaluate(async () => {
// @ts-expect-error
return globalThis.page.id;
});
expect(pageId).toBe('page0');
});

View File

@@ -5,7 +5,6 @@ import {
} from '@affine-test/kit/utils/filter';
import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
closeDownloadTip,
getBlockSuiteEditorTitle,
newPage,
waitEditorLoad,
@@ -29,7 +28,6 @@ const createAndPinCollection = async (
name: 'test page',
});
await expect(cell).toBeVisible();
await closeDownloadTip(page);
await page.getByTestId('create-first-filter').click();
await page
.getByTestId('variable-select')
@@ -146,7 +144,6 @@ test('create temporary filter by click tag', async ({ page }) => {
await page.keyboard.press('Enter');
await page.keyboard.press('Escape');
await page.locator('.tag', { hasText: 'TODO Tag' }).click();
await closeDownloadTip(page);
const cell = page.getByRole('cell', {
name: 'test page',
});

View File

@@ -25,7 +25,7 @@ test('Open last workspace when back to affine', async ({ page }) => {
expect(currentWorkspaceName).toEqual('New Workspace 2');
});
test('Download client tip', async ({ page }) => {
test.skip('Download client tip', async ({ page }) => {
await openHomePage(page);
const downloadClientTipItem = page.locator(
'[data-testid=download-client-tip]'

View File

@@ -42,6 +42,18 @@ export const test = baseTest.extend<{
await use({
current: async () => {
return await page.evaluate(async () => {
if (!(globalThis as any).currentWorkspace) {
await new Promise<void>((resolve, reject) => {
globalThis.addEventListener(
'affine:workspace:change',
() => resolve(),
{
once: true,
}
);
setTimeout(() => reject(new Error('timeout')), 2000);
});
}
return (globalThis as any).currentWorkspace;
});
},

View File

@@ -49,9 +49,3 @@ export async function clickPageMoreActions(page: Page) {
.getByTestId('editor-option-menu')
.click();
}
export const closeDownloadTip = async (page: Page) => {
await page
.locator('[data-testid="download-client-tip-close-button"]')
.click();
};

View File

@@ -1,25 +0,0 @@
import { expect, test } from 'vitest';
test('compare config', async () => {
const { default: nextConfigMock } = await import(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
'../../scripts/vitest/next-config-mock'
);
const mockConfig = nextConfigMock().publicRuntimeConfig;
const { default: nextConfig } = await import(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
'../../apps/web/next.config.mjs'
);
const config = nextConfig.publicRuntimeConfig;
Object.keys(config).forEach(key => {
expect(key in mockConfig, `${key} should be in the mockConfig`).toBe(true);
expect(typeof config[key], `${key}`).toBe(typeof mockConfig[key]);
});
Object.keys(mockConfig).forEach(key => {
expect(key in config, `${key} should be in the config`).toBe(true);
expect(typeof config[key], `${key}`).toBe(typeof mockConfig[key]);
});
});

View File

@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "..",
"noEmit": true
},
"include": ["**.spec.ts"]
}