-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathindex.test.js
40 lines (30 loc) · 1015 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('node:path');
const { _electron: electron } = require('playwright');
const { test, expect } = require('@playwright/test');
process.env.NODE_ENV = 'test';
const appPath = path.resolve(__dirname, '..');
test('YouTube Music App - With default settings, app is launched and visible', async () => {
const app = await electron.launch({
cwd: appPath,
args: [
appPath,
'--no-sandbox',
'--disable-gpu',
'--whitelisted-ips=',
'--disable-dev-shm-usage',
],
});
const window = await app.firstWindow();
const consentForm = await window.$(
"form[action='https://consent.youtube.com/save']",
);
if (consentForm) {
await consentForm.click('button');
}
// const title = await window.title();
// expect(title.replaceAll(/\s/g, ' ')).toEqual('YouTube Music');
const url = window.url();
expect(url.startsWith('https://music.youtube.com')).toBe(true);
await app.close();
});