[Dashboard] Fix flaky landing page test (#160066)

Closes https://github.com/elastic/kibana/issues/160057

## Summary

It **seems** like the failure was a one-off or, at the very least, very
rare - I [ran the test through the flaky test
runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2423)
without any changes and it passed 100 times. That being said, I was able
to replicate the failure locally by switching to the preset "Slow 3G"
network before running the test - this means, if the CI environment is
running especially slow for any given reason, this test has the
potential to fail again.

So, to be safe, I added an extra `await` for the Kibana **chrome** to
show up after every hard refresh - previously we were only waiting for
the header loading state to go away, which doesn't work when Kibana
itself is taking a little longer than expected to load and the Kibana
chrome (where the header loading state is located) isn't yet visible.

This **also** [passed the flaky test runner 100
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2425)
but, as a bonus, the test **passed locally** when throttling the network
using the same "Slow 3G" preset as before - hopefully this means that
the test is less likely to fail even when the CI environment is running
slow 👍

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Hannah Mudge 2023-06-20 14:21:29 -06:00 committed by GitHub
parent 8d67824556
commit 0fcd4e88d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,6 +121,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(false);
});
@ -133,6 +135,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(false);
});
@ -145,6 +149,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(true);
@ -165,6 +170,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(true);
@ -188,6 +194,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.awaitKibanaChrome();
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(false);