Skip to content

Commit

Permalink
perf: 修改脚本的加载位置
Browse files Browse the repository at this point in the history
  • Loading branch information
duan602728596 committed Aug 2, 2024
1 parent d65cc14 commit 7a06ccf
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/48tools/src/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ html
meta(charset='utf-8')
title= `48tools - ${ packageJson.version }`
include components/basic/Theme/stylesheet
include components/basic/wasm/wasm

body.theme
div.app#app
include components/basic/loading/loading

include components/basic/wasm/wasm
include components/basic/initialState/initialState
include components/basic/HACK_INTERCEPTS_SEND_Websocket/HACK_INTERCEPTS_SEND_Websocket

Expand Down
3 changes: 2 additions & 1 deletion packages/48tools/src/pages/Index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ const navLinkConfig: Array<Array<NativeItem>> = [
{
name: '口袋房间消息',
url: '/48/RoomMessage',
icon: <IconMessageFilled />
icon: <IconMessageFilled />,
testId: '48-room-message'
},
{
name: 'B站视频下载',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/test/src/TestId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export const enum Live48OptionsVP {
Dark = 2002
}

export const enum Pocket48RoomMessageVP {
Light = 2003,
Dark = 2004
}

/* AcFun */
export const enum AcFunDownload {
GetVideo = 300,
Expand Down
2 changes: 2 additions & 0 deletions packages/test/src/all.vp.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { test } from '@playwright/test';
import * as indexVPTest from './vpTests/index/index.vp.test.js';
import * as fortyEightVPTest from './vpTests/48/pocket48.vp.test.js';
import * as pocket48RoomMessage from './vpTests/48/roomMessage.vp.test.js';
import * as douyinVPTest from './vpTests/douyin/douyin.vp.test.js';

test.describe.parallel('48tools vp test', function(): void {
test.describe.serial(indexVPTest.title, indexVPTest.callback);
test.describe.serial(fortyEightVPTest.title, fortyEightVPTest.callback);
test.describe.serial(pocket48RoomMessage.title, pocket48RoomMessage.callback);
test.describe.serial(douyinVPTest.title, douyinVPTest.callback);
});
1 change: 0 additions & 1 deletion packages/test/src/utils/ElectronApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ElectronApp {
electronApp: ElectronApplication;
win: Page;
mediaDir?: string;
timer?: NodeJS.Timer;

// 初始化
async init(options?: InitOptions): Promise<void> {
Expand Down
45 changes: 45 additions & 0 deletions packages/test/src/vpTests/48/roomMessage.vp.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { test, expect } from '@playwright/test';
import ElectronApp from '../../utils/ElectronApp.js';
import { testTitle, vpImage } from '../../utils/testUtils.js';
import testIdClick from '../../actions/testIdClick.js';
import * as TestId from '../../TestId.js';

/* 口袋48房间消息 */
export const title: string = 'VP 48 Room Message Page';

export function callback(): void {
let app: ElectronApp | null = null;
let dark: boolean = false;

test.beforeEach(async function(): Promise<void> {
app = new ElectronApp();
await app.init({ dark });
});

test.afterEach(async function(): Promise<void> {
await app!.close();
app = null;
});

// 测试
async function Pocket48RoomMessageVPTest(isDark?: boolean): Promise<void> {
if (!app) {
throw new Error('app is null');
}

await testIdClick(app, '48-room-message');
await app.win.waitForSelector('.ant-pagination');
await expect(app.win).toHaveScreenshot(vpImage('48', 'pocket48-room-message', isDark));
}

test(testTitle(TestId.Pocket48RoomMessageVP.Light, 'pocket48 room message'), async function(): Promise<void> {
await Pocket48RoomMessageVPTest();

// 为下一个测试用例做修改
dark = true;
});

test(testTitle(TestId.Pocket48RoomMessageVP.Dark, 'pocket48 room message dark mode'), async function(): Promise<void> {
await Pocket48RoomMessageVPTest(true);
});
}

0 comments on commit 7a06ccf

Please sign in to comment.