Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 85186b1

Browse files
committed
fix: change CI to install browsers for tests
1 parent 0c66cdb commit 85186b1

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ jobs:
1818
cache: "yarn"
1919
- name: Install dependencies
2020
run: yarn install
21+
- name: Install dependencies for browsers
22+
run: npx playwright install-deps
2123
- name: Run test:examples
2224
run: yarn run test:examples

examples/browser-video-streaming/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
</head>
1919
<body>
2020
<video id="video" controls autoplay></video>
21+
<div id="status"></div>
2122
</body>
2223
</html>

examples/browser-video-streaming/src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ document.addEventListener('DOMContentLoaded', async () => {
1313
Hls.DefaultConfig.debug = false
1414
if (Hls.isSupported()) {
1515
const video = document.getElementById('video')
16+
const status = document.getElementById('status')
1617
const hls = new Hls()
1718
hls.config.ipfs = node
1819
hls.config.ipfsHash = testHash
1920
hls.loadSource('master.m3u8')
2021
hls.attachMedia(video)
21-
hls.on(Hls.Events.MANIFEST_PARSED, () => video.play())
22+
hls.on(Hls.Events.MANIFEST_PARSED, () => {
23+
video.play()
24+
25+
const node = document.createTextNode("Video ready...");
26+
status.appendChild(node);
27+
})
2228
}
2329
})

examples/browser-video-streaming/tests/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ const play = test.extend({
1212

1313
play.describe('browser videostream:', () => {
1414
// DOM
15-
const video = "#video"
15+
const status = "#status"
1616

1717
play.beforeEach(async ({servers, page}) => {
1818
await page.goto(`http://localhost:${servers[0].port}/`);
1919
})
2020

2121
play('should properly initialized a IPFS node and stream a video', async ({ page }) => {
22-
await page.waitForFunction((el) => document.querySelector(el).readyState >= 2, video);
22+
await page.waitForSelector(`${status}:has-text('Video ready')`)
2323
});
2424
});

0 commit comments

Comments
 (0)