Skip to content

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.

fix: a possible issue on electron flaky test (#3094)

Peng Xiaoce1e8d868cef
diff --git a/apps/electron/e2e/workspace.spec.ts b/apps/electron/e2e/workspace.spec.ts
index a63363bf1d..9886fd219b 100644
--- a/apps/electron/e2e/workspace.spec.ts
+++ b/apps/electron/e2e/workspace.spec.ts
@@ -57,6 +57,8 @@ test('export then add', async ({ page, appInfo, workspace }) => {
// goto workspace setting
await page.getByTestId('workspace-list-item').click();
+ await page.waitForTimeout(500);
+
// change workspace name
await page.getByTestId('workspace-name-input').fill(newWorkspaceName);
await page.getByTestId('save-workspace-name').click();
diff --git a/apps/electron/src/helper/db/base-db-adapter.ts b/apps/electron/src/helper/db/base-db-adapter.ts
index adece889b0..afb68adc25 100644
--- a/apps/electron/src/helper/db/base-db-adapter.ts
+++ b/apps/electron/src/helper/db/base-db-adapter.ts
@@ -119,6 +119,8 @@ export abstract class BaseSQLiteAdapter {
`[SQLiteAdapter][${this.role}] addUpdateToSQLite`,
'length:',
updates.length,
+ 'docids',
+ updates.map(u => u.docId),
performance.now() - start,
'ms'
);
diff --git a/apps/electron/src/helper/db/workspace-db-adapter.ts b/apps/electron/src/helper/db/workspace-db-adapter.ts
index 839a2c4118..dfdb455fec 100644
--- a/apps/electron/src/helper/db/workspace-db-adapter.ts
+++ b/apps/electron/src/helper/db/workspace-db-adapter.ts
@@ -52,11 +52,21 @@ export class WorkspaceSQLiteDB extends BaseSQLiteAdapter {
};
setupListener(docId?: string) {
- logger.debug('WorkspaceSQLiteDB: setupListener', this.workspaceId, docId);
+ logger.debug(
+ 'WorkspaceSQLiteDB:setupListener',
+ this.workspaceId,
+ docId,
+ this.getWorkspaceName()
+ );
const doc = this.getDoc(docId);
if (doc) {
const onUpdate = async (update: Uint8Array, origin: YOrigin) => {
- logger.debug('onUpdate', this.workspaceId, docId, update.length);
+ logger.debug(
+ 'WorkspaceSQLiteDB:onUpdate',
+ this.workspaceId,
+ docId,
+ update.length
+ );
const insertRows = [{ data: update, docId }];
if (origin === 'renderer') {
await this.addUpdateToSQLite(insertRows);