Files
youtube-music/tests/index.test.js
JellyBrick e7d2d04f5a fix(test): Add a test to check the title
It failed because of @cliqz/adblocker-electron.
Check see this issue: https://github.com/ghostery/adblocker/issues/3462
2023-10-08 01:16:11 +09:00

41 lines
1009 B
JavaScript

/* 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();
});