mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Remove test environment
This commit is contained in:
@ -1,38 +0,0 @@
|
|||||||
const path = require("path");
|
|
||||||
|
|
||||||
const NodeEnvironment = require("jest-environment-node");
|
|
||||||
const { _electron: electron } = require("playwright");
|
|
||||||
|
|
||||||
class TestEnvironment extends NodeEnvironment {
|
|
||||||
constructor(config) {
|
|
||||||
super(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
async setup() {
|
|
||||||
await super.setup();
|
|
||||||
|
|
||||||
const appPath = path.resolve(__dirname, "..");
|
|
||||||
this.global.__APP__ = await electron.launch({
|
|
||||||
args: [
|
|
||||||
"--no-sandbox",
|
|
||||||
"--disable-gpu",
|
|
||||||
"--whitelisted-ips=",
|
|
||||||
"--disable-dev-shm-usage",
|
|
||||||
appPath,
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async teardown() {
|
|
||||||
if (this.global.__APP__) {
|
|
||||||
await this.global.__APP__.close();
|
|
||||||
}
|
|
||||||
await super.teardown();
|
|
||||||
}
|
|
||||||
|
|
||||||
runScript(script) {
|
|
||||||
return super.runScript(script);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = TestEnvironment;
|
|
||||||
@ -1,16 +1,27 @@
|
|||||||
/**
|
const path = require("path");
|
||||||
* @jest-environment ./tests/environment
|
|
||||||
*/
|
|
||||||
|
|
||||||
describe("YouTube Music App", () => {
|
const { _electron: electron } = require("playwright");
|
||||||
const app = global.__APP__;
|
const { test, expect } = require("@playwright/test");
|
||||||
|
|
||||||
test("With default settings, app is launched and visible", async () => {
|
const appPath = path.resolve(__dirname, "..");
|
||||||
const window = await app.firstWindow();
|
|
||||||
const title = await window.title();
|
|
||||||
expect(title).toEqual("YouTube Music");
|
|
||||||
|
|
||||||
const url = window.url();
|
test("YouTube Music App - With default settings, app is launched and visible", async () => {
|
||||||
expect(url.startsWith("https://music.youtube.com")).toBe(true);
|
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();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user