refactor: generate 'chrome:// pages' specs to remove duplicate code (#39684)

This commit is contained in:
Milan Burda 2023-08-30 17:07:41 +02:00 committed by GitHub
parent 9280b79112
commit e66c1f6c56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2050,48 +2050,27 @@ describe('chromium features', () => {
}); });
}); });
describe('chrome://accessibility', () => { describe('chrome:// pages', () => {
it('loads the page successfully', async () => { const urls = [
const w = new BrowserWindow({ show: false }); 'chrome://accessibility',
await w.loadURL('chrome://accessibility'); 'chrome://gpu',
const pageExists = await w.webContents.executeJavaScript( 'chrome://media-internals',
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')" 'chrome://tracing',
); 'chrome://webrtc-internals'
expect(pageExists).to.be.true(); ];
});
});
describe('chrome://gpu', () => { for (const url of urls) {
it('loads the page successfully', async () => { describe(url, () => {
const w = new BrowserWindow({ show: false }); it('loads the page successfully', async () => {
await w.loadURL('chrome://gpu'); const w = new BrowserWindow({ show: false });
const pageExists = await w.webContents.executeJavaScript( await w.loadURL(url);
"window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')" const pageExists = await w.webContents.executeJavaScript(
); "window.hasOwnProperty('chrome') && window.chrome.hasOwnProperty('send')"
expect(pageExists).to.be.true(); );
}); 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://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();
});
}); });
describe('document.hasFocus', () => { describe('document.hasFocus', () => {