mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
refactor(infra): record legacy data to improve testing stability (#4590)
This commit is contained in:
18
tests/kit/e2e-enhance/initializer.ts
Normal file
18
tests/kit/e2e-enhance/initializer.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
declare global {
|
||||
function readAffineDatabase(): Promise<any>;
|
||||
function writeAffineDatabase(data: any, binaries: any): Promise<void>;
|
||||
function readAffineLocalStorage(): Promise<any>;
|
||||
function writeAffineLocalStorage(data: any): Promise<void>;
|
||||
}
|
||||
|
||||
export async function patchDataEnhancement(page: Page) {
|
||||
const idbPath = join(dirname(require.resolve('idb')), 'umd.js');
|
||||
await page.addInitScript({ path: idbPath });
|
||||
|
||||
const patchPath = join(__dirname, './storage-patch.js');
|
||||
await page.addInitScript({ path: patchPath });
|
||||
}
|
||||
Reference in New Issue
Block a user