There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
chore(electron): speed up electron tests (#9871)
pengx17699da97879b5
diff --git a/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts b/packages/frontend/apps/electron/src/main/windows-manager/tab-views.tsindex f92648dd53..8b65633636 100644--- a/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts+++ b/packages/frontend/apps/electron/src/main/windows-manager/tab-views.ts@@ -890,6 +890,9 @@ export class WebContentViewsManager {view.webContents.on('did-finish-load', () => {this.resizeView(view);+ if (process.env.SKIP_ONBOARDING) {+ this.skipOnboarding(view).catch(err => logger.error(err));+ }});// reorder will add to main window when loaded@@ -898,6 +901,15 @@ export class WebContentViewsManager {logger.info(`view ${viewId} created in ${performance.now() - start}ms`);return view;};++ private async skipOnboarding(view: WebContentsView) {+ await view.webContents.executeJavaScript(`+ window.localStorage.setItem('app_config', '{"onBoarding":false}');+ window.localStorage.setItem('dismissAiOnboarding', 'true');+ window.localStorage.setItem('dismissAiOnboardingEdgeless', 'true');+ window.localStorage.setItem('dismissAiOnboardingLocal', 'true');+ `);+ }}// there is no proper way to listen to webContents resize eventdiff --git a/tests/affine-desktop/e2e/workspace.spec.ts b/tests/affine-desktop/e2e/workspace.spec.tsindex 782786bdb8..82c383ab2f 100644--- a/tests/affine-desktop/e2e/workspace.spec.ts+++ b/tests/affine-desktop/e2e/workspace.spec.ts@@ -136,6 +136,8 @@ test('delete workspace and then restore it from backup', async ({ page }) => {);//#endregion+ await page.waitForTimeout(1000);+//#region 4. restore the workspace from backupawait page.getByTestId('slider-bar-workspace-setting-button').click();await expect(page.getByTestId('setting-modal')).toBeVisible();diff --git a/tests/affine-desktop/playwright.config.ts b/tests/affine-desktop/playwright.config.tsindex e484cd9780..e32e938348 100644--- a/tests/affine-desktop/playwright.config.ts+++ b/tests/affine-desktop/playwright.config.ts@@ -16,7 +16,6 @@ import type { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {testDir: './e2e',fullyParallel: true,- workers: 1,timeout: process.env.CI ? 50_000 : 30_000,expect: {timeout: process.env.CI ? 15_000 : 5_000,@@ -30,6 +29,7 @@ const config: PlaywrightTestConfig = {if (process.env.CI) {config.retries = 5;+ config.workers = 2;}if (process.env.DEV_SERVER_URL) {diff --git a/tests/kit/src/electron.ts b/tests/kit/src/electron.tsindex ae53d04c94..64a3762d61 100644--- a/tests/kit/src/electron.ts+++ b/tests/kit/src/electron.ts@@ -97,19 +97,6 @@ export const test = base.extend<{// wait for blocksuite to be loadedawait page.waitForSelector('v-line');- await page.evaluate(() => {- window.localStorage.setItem('dismissAiOnboarding', 'true');- window.localStorage.setItem('dismissAiOnboardingEdgeless', 'true');- window.localStorage.setItem('dismissAiOnboardingLocal', 'true');- });-- await page.reload({- timeout: 30000,- });-- // wait until the page is stable enough- await page.waitForTimeout(2000);-await use(page as Page);},views: async ({ electronApp, page }, use) => {