mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[FTR] Switch to new browser headless mode (#153828)
## Summary This PR updates the way how we start the headless browser for testing. The current way of starting in headless mode is eventually going away and the new headless mode offers more capabilities and stability, see https://www.selenium.dev/blog/2023/headless-is-going-away/ and https://developer.chrome.com/articles/new-headless/. ### Test adjustments All the adjusted discover, dashboard, maps and infra tests showed the same pattern during failure investigation that's around the fact that the new headless mode is closer to the regular / non-headless mode: * Tests passed with the old headless mode * Tests failed in regular / non-headless mode the same way they failed in new headless mode * The failure reasons were mostly around slightly different font rendering and slightly different browser sizes
This commit is contained in:
parent
66ad9e0ba5
commit
98df0c25d3
10 changed files with 16 additions and 8 deletions
|
@ -64,7 +64,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
|
||||
if (canReadClipboard) {
|
||||
const copiedSourceData = await browser.getClipboardValue();
|
||||
expect(copiedSourceData.startsWith('"_source"\n{"@message":["238.171.34.42')).to.be(true);
|
||||
expect(copiedSourceData.startsWith('Document\n{"@message":["238.171.34.42')).to.be(true);
|
||||
expect(copiedSourceData.endsWith('}')).to.be(true);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
|
||||
if (canReadClipboard) {
|
||||
const copiedSourceName = await browser.getClipboardValue();
|
||||
expect(copiedSourceName).to.be('"_source"');
|
||||
expect(copiedSourceName).to.be('Document');
|
||||
}
|
||||
|
||||
expect(await toasts.getToastCount()).to.be(1);
|
||||
|
|
|
@ -13,7 +13,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
|
|||
|
||||
describe('discover/group2', function () {
|
||||
before(async function () {
|
||||
await browser.setWindowSize(1300, 800);
|
||||
await browser.setWindowSize(1600, 1200);
|
||||
});
|
||||
|
||||
after(async function unloadMakelogs() {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
@ -99,9 +99,12 @@ function initChromiumOptions(browserType: Browsers, acceptInsecureCerts: boolean
|
|||
}
|
||||
|
||||
if (headlessBrowser === '1') {
|
||||
// Using the new headless mode (instead of `options.headless()`)
|
||||
// See: https://www.selenium.dev/blog/2023/headless-is-going-away/
|
||||
options.addArguments('headless=new');
|
||||
|
||||
// Use --disable-gpu to avoid an error from a missing Mesa library, as per
|
||||
// See: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
||||
options.headless();
|
||||
options.addArguments('disable-gpu');
|
||||
}
|
||||
|
||||
|
@ -111,7 +114,11 @@ function initChromiumOptions(browserType: Browsers, acceptInsecureCerts: boolean
|
|||
|
||||
if (remoteDebug === '1') {
|
||||
// Visit chrome://inspect in chrome to remotely view/debug
|
||||
options.headless();
|
||||
|
||||
// Using the new headless mode (instead of `options.headless()`)
|
||||
// See: https://www.selenium.dev/blog/2023/headless-is-going-away/
|
||||
options.addArguments('headless=new');
|
||||
|
||||
options.addArguments('disable-gpu', 'remote-debugging-port=9222');
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_hosts_processes'),
|
||||
kibanaServer.savedObjects.cleanStandardList(),
|
||||
]);
|
||||
await browser.setWindowSize(1600, 1200);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
|
|
@ -35,7 +35,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
it('should request clusters when zoomed to larger regions showing lots of data', async () => {
|
||||
await PageObjects.maps.setView(20, -90, 2);
|
||||
const { rawResponse: response } = await PageObjects.maps.getResponse();
|
||||
expect(response.aggregations.gridSplit.buckets.length).to.equal(17);
|
||||
expect(response.aggregations.gridSplit.buckets.length).to.equal(15);
|
||||
});
|
||||
|
||||
it('should request documents when query narrows data', async () => {
|
||||
|
|
|
@ -120,7 +120,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
const { lat, lon, zoom } = await PageObjects.maps.getView();
|
||||
expect(Math.round(lat)).to.equal(43);
|
||||
expect(Math.round(lon)).to.equal(-102);
|
||||
expect(Math.round(zoom)).to.equal(5);
|
||||
expect(Math.round(zoom)).to.equal(4);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
});
|
||||
|
||||
it('should not rerequest when pan changes do not move map view area outside of buffer', async () => {
|
||||
await PageObjects.maps.setView(DATA_CENTER_LAT + 10, DATA_CENTER_LON + 10, 1);
|
||||
await PageObjects.maps.setView(DATA_CENTER_LAT + 5, DATA_CENTER_LON + 5, 1);
|
||||
const afterTimestamp = await getRequestTimestamp();
|
||||
expect(afterTimestamp).to.equal(beforeTimestamp);
|
||||
});
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 64 KiB |
Binary file not shown.
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 135 KiB |
Loading…
Add table
Add a link
Reference in a new issue