Skip to content

Commit 7bc0b9a

Browse files
committed
fixed bjf-toaster always intercepting the switch button list element
1 parent 082a529 commit 7bc0b9a

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default defineConfig<GlobalOptions>({
3636
// baseURL: 'http://127.0.0.1:3000',
3737

3838
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
39-
trace: 'on-all-retries',
39+
trace: 'on',
4040
screenshot: 'on',
4141
video: {
4242
mode: 'retain-on-failure',

src/contents/index/mounter.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ function createApp(roomId: string, plasmo: PlasmoSpec, info: StreamInfo): App {
152152
toast.promise(hooking, {
153153
loading: '正在挂接直播监听...',
154154
success: '挂接成功',
155-
position: 'top-left'
155+
position: 'top-left',
156+
duration: 4000,
156157
})
157158
try {
158159
await hooking

tests/features/jimaku.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ test('測試大海報房間下字幕區塊是否存在', async ({ themeRoom }) =
275275

276276
async function ensureButtonListVisible(p: PageFrame) {
277277
if (isFrame(p) && !await p.getByText('删除所有字幕记录').isVisible()) {
278-
await p.evaluate(() => window.document.querySelector('#bjf-toaster > div')?.remove()) // 防止 toaster 遲遲不消失
278+
// 防止 toaster 遲遲不消失
279+
await p.evaluate(() => window.document.querySelector('#bjf-toaster li[data-y-position="top"][data-x-position="left"]')?.remove())
279280
await p.getByText('切换字幕按钮列表').click({ timeout: 120000 })
280281
await p.waitForTimeout(2000)
281282
}

tests/helpers/bilibili-page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class BilibiliPage implements AsyncDisposable {
3333

3434
async checkIfNotSupport(): Promise<boolean> {
3535
const p = await this.getContentLocator()
36-
return await p.getByText('您使用的浏览器版本偏低,为保障您的直播观看体验').isVisible()
36+
return await p.getByText('您使用的浏览器版本偏低').isVisible()
3737
}
3838

3939
async isStatus(status: 'online' | 'offline'): Promise<boolean> {

tests/theme.setup.ts

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ setup('預先搜索大海報房間', async ({ cacher, rooms, maxRoomRetries, roo
66
setup.skip(roomId > 0, '已指定直播房間,跳過搜索')
77
setup.skip(rooms.length < 2, '房間數量不足,跳過搜索')
88
console.info('正在搜索大海報房間...')
9+
if (!process.env.CI) {
10+
const info = cacher.findRoomTypeFromCache('theme')
11+
setup.skip(!!info, '已從緩存中找到大海報房間: ' + info?.roomid)
12+
}
913
logger.info('rooms: ', rooms.map(r => r.roomid))
1014
const generator = Strategy.random(rooms, Math.min(maxRoomRetries, rooms.length))
1115
const info = await cacher.findRoomType('theme', generator)

tests/utils/misc.ts

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export function env<T>(name: string, convert: (s: string) => T): T {
3232
return convert(value)
3333
}
3434

35+
export function envStr(name: string): string {
36+
return env(name, String)
37+
}
38+
3539
export function envInt(name: string): number {
3640
return env(name, Number)
3741
}

0 commit comments

Comments
 (0)