Skip to content

Commit 2d3ce4a

Browse files
authored
Merge pull request #813 from th-ch/fix-tests
Bump electron and fix tests in CI
2 parents a0543d1 + 971b7f0 commit 2d3ce4a

File tree

6 files changed

+151
-2054
lines changed

6 files changed

+151
-2054
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ jobs:
9191

9292
- name: Test
9393
uses: GabrielBB/xvfb-action@v1
94+
env:
95+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
9496
with:
9597
run: yarn test
9698

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
}
6868
},
6969
"scripts": {
70-
"test": "jest",
70+
"test": "playwright test",
71+
"test:debug": "DEBUG=pw:browser* playwright test",
7172
"start": "electron .",
7273
"start:debug": "ELECTRON_ENABLE_LOGGING=1 electron .",
7374
"icon": "rimraf assets/generated && electron-icon-maker --input=assets/youtube-music.png --output=assets/generated",
@@ -120,13 +121,13 @@
120121
"ytpl": "^2.3.0"
121122
},
122123
"devDependencies": {
124+
"@playwright/test": "^1.25.1",
123125
"auto-changelog": "^2.4.0",
124-
"electron": "^18.2.3",
126+
"electron": "^20.1.1",
125127
"electron-builder": "^23.0.3",
126128
"electron-devtools-installer": "^3.1.1",
127129
"electron-icon-maker": "0.0.5",
128-
"jest": "^27.3.1",
129-
"playwright": "^1.17.1",
130+
"playwright": "^1.25.1",
130131
"rimraf": "^3.0.2",
131132
"xo": "^0.45.0"
132133
},

plugins/sponsorblock/tests/segments.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { test, expect } = require("@playwright/test");
2+
13
const { sortSegments } = require("../segments");
24

35
test("Segment sorting", () => {

tests/environment.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/index.test.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
/**
2-
* @jest-environment ./tests/environment
3-
*/
1+
const path = require("path");
42

5-
describe("YouTube Music App", () => {
6-
const app = global.__APP__;
3+
const { _electron: electron } = require("playwright");
4+
const { test, expect } = require("@playwright/test");
75

8-
test("With default settings, app is launched and visible", async () => {
9-
const window = await app.firstWindow();
10-
const title = await window.title();
11-
expect(title).toEqual("YouTube Music");
6+
const appPath = path.resolve(__dirname, "..");
127

13-
const url = window.url();
14-
expect(url.startsWith("https://music.youtube.com")).toBe(true);
8+
test("YouTube Music App - With default settings, app is launched and visible", async () => {
9+
const app = await electron.launch({
10+
args: [
11+
"--no-sandbox",
12+
"--disable-gpu",
13+
"--whitelisted-ips=",
14+
"--disable-dev-shm-usage",
15+
appPath,
16+
],
1517
});
18+
19+
const window = await app.firstWindow();
20+
const title = await window.title();
21+
expect(title).toEqual("YouTube Music");
22+
23+
const url = window.url();
24+
expect(url.startsWith("https://music.youtube.com")).toBe(true);
25+
26+
await app.close();
1627
});

0 commit comments

Comments
 (0)