Skip to content

Commit

Permalink
Merge pull request #813 from th-ch/fix-tests
Browse files Browse the repository at this point in the history
Bump electron and fix tests in CI
  • Loading branch information
th-ch authored Sep 4, 2022
2 parents a0543d1 + 971b7f0 commit 2d3ce4a
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 2,054 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ jobs:

- name: Test
uses: GabrielBB/xvfb-action@v1
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
with:
run: yarn test

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
}
},
"scripts": {
"test": "jest",
"test": "playwright test",
"test:debug": "DEBUG=pw:browser* playwright test",
"start": "electron .",
"start:debug": "ELECTRON_ENABLE_LOGGING=1 electron .",
"icon": "rimraf assets/generated && electron-icon-maker --input=assets/youtube-music.png --output=assets/generated",
Expand Down Expand Up @@ -120,13 +121,13 @@
"ytpl": "^2.3.0"
},
"devDependencies": {
"@playwright/test": "^1.25.1",
"auto-changelog": "^2.4.0",
"electron": "^18.2.3",
"electron": "^20.1.1",
"electron-builder": "^23.0.3",
"electron-devtools-installer": "^3.1.1",
"electron-icon-maker": "0.0.5",
"jest": "^27.3.1",
"playwright": "^1.17.1",
"playwright": "^1.25.1",
"rimraf": "^3.0.2",
"xo": "^0.45.0"
},
Expand Down
2 changes: 2 additions & 0 deletions plugins/sponsorblock/tests/segments.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { test, expect } = require("@playwright/test");

const { sortSegments } = require("../segments");

test("Segment sorting", () => {
Expand Down
30 changes: 0 additions & 30 deletions tests/environment.js

This file was deleted.

33 changes: 22 additions & 11 deletions tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
/**
* @jest-environment ./tests/environment
*/
const path = require("path");

describe("YouTube Music App", () => {
const app = global.__APP__;
const { _electron: electron } = require("playwright");
const { test, expect } = require("@playwright/test");

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

const url = window.url();
expect(url.startsWith("https://music.youtube.com")).toBe(true);
test("YouTube Music App - With default settings, app is launched and visible", async () => {
const app = await electron.launch({
args: [
"--no-sandbox",
"--disable-gpu",
"--whitelisted-ips=",
"--disable-dev-shm-usage",
appPath,
],
});

const window = await app.firstWindow();
const title = await window.title();
expect(title).toEqual("YouTube Music");

const url = window.url();
expect(url.startsWith("https://music.youtube.com")).toBe(true);

await app.close();
});
Loading

0 comments on commit 2d3ce4a

Please sign in to comment.