Skip to content

Commit

Permalink
refactor: generate 'chrome:// pages' specs to remove duplicate code (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak authored and pull[bot] committed May 13, 2024
1 parent c9323d0 commit 5049986
Showing 1 changed file with 20 additions and 41 deletions.
61 changes: 20 additions & 41 deletions spec/chromium-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2050,48 +2050,27 @@ describe('chromium features', () => {
});
});

describe('chrome://accessibility', () => {
it('loads the page successfully', async () => {
const w = new BrowserWindow({ show: false });
await w.loadURL('chrome://accessibility');
const pageExists = await w.webContents.executeJavaScript(
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')"
);
expect(pageExists).to.be.true();
});
});

describe('chrome://gpu', () => {
it('loads the page successfully', async () => {
const w = new BrowserWindow({ show: false });
await w.loadURL('chrome://gpu');
const pageExists = await w.webContents.executeJavaScript(
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')"
);
expect(pageExists).to.be.true();
});
});

describe('chrome://media-internals', () => {
it('loads the page successfully', async () => {
const w = new BrowserWindow({ show: false });
await w.loadURL('chrome://media-internals');
const pageExists = await w.webContents.executeJavaScript(
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')"
);
expect(pageExists).to.be.true();
});
});
describe('chrome:// pages', () => {
const urls = [
'chrome://accessibility',
'chrome://gpu',
'chrome://media-internals',
'chrome://tracing',
'chrome://webrtc-internals'
];

describe('chrome://webrtc-internals', () => {
it('loads the page successfully', async () => {
const w = new BrowserWindow({ show: false });
await w.loadURL('chrome://webrtc-internals');
const pageExists = await w.webContents.executeJavaScript(
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')"
);
expect(pageExists).to.be.true();
});
for (const url of urls) {
describe(url, () => {
it('loads the page successfully', async () => {
const w = new BrowserWindow({ show: false });
await w.loadURL(url);
const pageExists = await w.webContents.executeJavaScript(
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')"
);
expect(pageExists).to.be.true();
});
});
}
});

describe('document.hasFocus', () => {
Expand Down

0 comments on commit 5049986

Please sign in to comment.