Skip to content

Commit

Permalink
fixup! finished recorder feature and test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed Apr 5, 2024
1 parent 5bf802d commit a380bce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 43 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/partial-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,13 @@ jobs:
--timeout=60000 \
--max-failures=5
env:
DEBUG: true
DEBUG: true
- name: Upload Test Results
if: failure() && steps.test.conclusion != 'skipped'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-test-results
path: |
test-results/
playwright-report/
if-no-files-found: ignore
58 changes: 16 additions & 42 deletions tests/features/recorder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,8 @@ test('測試錄製 FLV', { tag: "@scoped" }, async ({ content, page, context, ta
await settingsPage.goto(tabUrl('settings.html'), { waitUntil: 'domcontentloaded' })
await settingsPage.getByText('功能设定').click()

await settingsPage.getByTestId('record-output-type').click()
try {
await settingsPage.getByText('FLV').click({ timeout: 5000 })
} catch {
logger.warn('選擇器尚未展開,改用文字捕捉')
await settingsPage.getByText('MP4').click()
await settingsPage.getByText('FLV').click()
}
await settingsPage.getByTestId('record-output-type').locator('div > div').nth(0).click()
await settingsPage.getByText('FLV').click()

await settingsPage.getByText('保存设定').click()
await settingsPage.close()
Expand Down Expand Up @@ -220,14 +214,8 @@ test('測試手動錄製', { tag: "@scoped" }, async ({ content, page, context,
await settingsPage.goto(tabUrl('settings.html'), { waitUntil: 'domcontentloaded' })
await settingsPage.getByText('功能设定').click()

await settingsPage.getByTestId('record-duration').click()
try {
await settingsPage.getByText('手动录制').click({ timeout: 5000 })
} catch {
logger.warn('選擇器尚未展開,改用文字捕捉')
await settingsPage.getByText('约前5分钟').click()
await settingsPage.getByText('手动录制').click()
}
await settingsPage.getByTestId('record-duration').locator('div > div').nth(0).click()
await settingsPage.getByText('手动录制').click()

await settingsPage.getByText('保存设定').click()
await settingsPage.close()
Expand Down Expand Up @@ -271,14 +259,8 @@ test('測試 HLS 完整編譯', { tag: "@scoped" }, async ({ content, page, cont
await settingsPage.goto(tabUrl('settings.html'), { waitUntil: 'domcontentloaded' })
await settingsPage.getByText('功能设定').click()

await settingsPage.getByTestId('record-fix').click()
try {
await settingsPage.getByText('完整编译').click({ timeout: 5000 })
} catch {
logger.warn('選擇器尚未展開,改用文字捕捉')
await settingsPage.getByText('快速编译').click()
await settingsPage.getByText('完整编译').click()
}
await settingsPage.getByTestId('record-fix').locator('div > div').nth(0).click()
await settingsPage.getByText('完整编译').click()

await settingsPage.getByText('保存设定').click()
await settingsPage.close()
Expand All @@ -298,7 +280,9 @@ test('測試 HLS 完整編譯', { tag: "@scoped" }, async ({ content, page, cont

const frontend = (async () => {
await expect(content.getByText('准备视频中...')).toBeVisible()
await expect(content.getByText('视频已发送到后台进行完整编码')).toBeVisible()
await expect(content.getByText('视频已发送到后台进行完整编码')).toBeVisible({
timeout: 0 // no timeout
})
})();

const backend = (async () => {
Expand Down Expand Up @@ -358,23 +342,11 @@ test('測試 FLV 完整編譯', { tag: "@scoped" }, async ({ content, page, cont
await settingsPage.getByText('功能设定').click()

// change to flv first
await settingsPage.getByTestId('record-output-type').click()
try {
await settingsPage.getByText('FLV').click({ timeout: 5000 })
} catch {
logger.warn('選擇器尚未展開,改用文字捕捉')
await settingsPage.getByText('MP4').click()
await settingsPage.getByText('FLV').click()
}
await settingsPage.getByTestId('record-output-type').locator('div > div').nth(0).click()
await settingsPage.getByText('FLV').click()

await settingsPage.getByTestId('record-fix').click()
try {
await settingsPage.getByText('完整编译').click({ timeout: 5000 })
} catch {
logger.warn('選擇器尚未展開,改用文字捕捉')
await settingsPage.getByText('快速编译').click()
await settingsPage.getByText('完整编译').click()
}
await settingsPage.getByTestId('record-fix').locator('div > div').nth(0).click()
await settingsPage.getByText('完整编译').click()

await settingsPage.getByText('保存设定').click()
await settingsPage.close()
Expand All @@ -394,7 +366,9 @@ test('測試 FLV 完整編譯', { tag: "@scoped" }, async ({ content, page, cont

const frontend = (async () => {
await expect(content.getByText('准备视频中...')).toBeVisible()
await expect(content.getByText('视频已发送到后台进行完整编码')).toBeVisible()
await expect(content.getByText('视频已发送到后台进行完整编码')).toBeVisible({
timeout: 0 // no timeout
})
})();

const backend = (async () => {
Expand Down

0 comments on commit a380bce

Please sign in to comment.