Skip to content

Commit

Permalink
added e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed Oct 18, 2024
1 parent e97852b commit 91f21a3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,31 @@ test('測試导航', async ({ room, content, serviceWorker }) => {

})

test('測試 强制啓動 模式', { tag: '@scoped' }, async ({ context, optionPageUrl, page, content }) => {

logger.info('進入離綫的直播間...')
// this room is always offline (guess what)
await page.goto('https://live.bilibili.com/21849412', { waitUntil: 'domcontentloaded' })
await page.waitForTimeout(3000)
logger.info('測試主元素是否不存在...')
await expect(content.getByText('功能菜单')).toBeHidden()
await expect(content.locator('section#bjf-feature-jimaku')).not.toBeAttached()
await expect(content.locator('section#bjf-feature-superchat')).not.toBeAttached()

logger.info('正在修改設定...')
const settingsPage = await context.newPage()
await settingsPage.goto(optionPageUrl, { waitUntil: 'domcontentloaded' })
await settingsPage.getByText('开发者相关').click()
await settingsPage.getByText('在直播间下线时依然强制启动').check()
await settingsPage.getByText('保存设定').click()
await settingsPage.close()

logger.info('正在刷新頁面...')
await page.reload({ waitUntil: 'domcontentloaded' })
await page.waitForTimeout(3000)
logger.info('測試主元素是否存在...')
await expect(content.getByText('功能菜单')).toBeVisible()
await expect(content.locator('section#bjf-feature-jimaku')).toBeAttached()
await expect(content.locator('section#bjf-feature-superchat')).toBeAttached()

})

0 comments on commit 91f21a3

Please sign in to comment.