mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
perf(y-indexeddb): improve boost and loading time (#1879)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { ok } from 'node:assert';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import type { PageMeta } from '@blocksuite/store';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
@@ -7,6 +10,13 @@ const user1 = require('@affine-test/fixtures/built-in-user1.json');
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const user2 = require('@affine-test/fixtures/built-in-user2.json');
|
||||
|
||||
export const rootDir = resolve(__dirname, '..', '..');
|
||||
// assert that the rootDir is the root of the project
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
ok(require(resolve(rootDir, 'package.json')).name.toLowerCase() === 'affine');
|
||||
|
||||
export const testResultDir = resolve(rootDir, 'test-results');
|
||||
|
||||
export async function getBuiltInUser() {
|
||||
return Promise.all([
|
||||
fetch('http://localhost:3000/api/user/token', {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { clickSideBarSettingButton } from '../libs/sidebar';
|
||||
import { testResultDir } from '../libs/utils';
|
||||
|
||||
test.describe('Local first setting page', () => {
|
||||
test('Should highlight the setting page menu when selected', async ({
|
||||
@@ -14,13 +17,20 @@ test.describe('Local first setting page', () => {
|
||||
const element = await page.getByTestId(
|
||||
'slider-bar-workspace-setting-button'
|
||||
);
|
||||
const prevColor = await element.evaluate(
|
||||
element => window.getComputedStyle(element).color
|
||||
);
|
||||
const prev = await element.screenshot({
|
||||
path: resolve(
|
||||
testResultDir,
|
||||
'slider-bar-workspace-setting-button-prev.png'
|
||||
),
|
||||
});
|
||||
await clickSideBarSettingButton(page);
|
||||
const currentColor = await element.evaluate(
|
||||
element => window.getComputedStyle(element).color
|
||||
);
|
||||
expect(prevColor).not.toBe(currentColor);
|
||||
await page.waitForTimeout(50);
|
||||
const after = await element.screenshot({
|
||||
path: resolve(
|
||||
testResultDir,
|
||||
'slider-bar-workspace-setting-button-after.png'
|
||||
),
|
||||
});
|
||||
expect(prev).not.toEqual(after);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user