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

Commit 0052e51

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

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88
<title>IPFS with HLS-JS</title>
99
<link rel="icon" href="favicon.ico" />
1010

11-
<script
12-
defer
13-
src="https://cdn.jsdelivr.net/npm/hlsjs-ipfs-loader@0.3.0/dist/index.js"
14-
></script>
15-
<script defer src="https://cdn.jsdelivr.net/npm/hls.js@0.14.17"></script>
16-
1711
<script type="module" defer src="./src/index.js"></script>
1812
</head>
1913
<body>
2014
<video id="video" controls autoplay></video>
15+
<div id="status"></div>
2116
</body>
2217
</html>

examples/browser-video-streaming/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"build": "parcel build index.html --no-scope-hoist",
1111
"serve": "parcel serve index.html --open -p 8888",
1212
"start": "npm run serve",
13-
"test:example": "npm run build && playwright test tests --browser=webkit --retries=3"
13+
"test:example": "npm run build && playwright test tests --browser=firefox --retries=3"
1414
},
1515
"browserslist": "last 1 Chrome version",
1616
"dependencies": {
17+
"hls.js": "^0.14.17",
18+
"hlsjs-ipfs-loader": "^0.3.0",
1719
"ipfs": "^0.58.0"
1820
},
1921
"devDependencies": {
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict'
22

33
import Ipfs from 'ipfs'
4+
import Hls from 'hls.js'
5+
import HlsjsIpfsLoader from 'hlsjs-ipfs-loader'
46

5-
/* global Hls Ipfs HlsjsIpfsLoader */
6-
/* eslint-env browser */
77
document.addEventListener('DOMContentLoaded', async () => {
88
const testHash = 'QmdpAidwAsBGptFB3b6A9Pyi5coEbgjHrL3K2Qrsutmj9K'
99
const repoPath = 'ipfs-' + Math.random()
@@ -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+
const node = document.createTextNode("Video ready...");
24+
status.appendChild(node);
25+
26+
video.play()
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)