mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Dashboard] Fix flaky snapshot test (#169415)
Closes https://github.com/elastic/kibana/issues/167942
## Summary
This PR fixes the attached flaky test by ensuring that everything on the
page has loaded before taking the snapshot. Because these snapshot tests
are on an empty dashboard, the previous call to `waitForRenderComplete`
(which ensures each **panel** has been rendered/loaded) didn't actually
do anything; so, I replaced it with individual `waitFor` calls that
ensure the dashboard is in (approximately) the correct state before the
screenshot is taken.
### [Flaky Test
Runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3632)

### 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:
parent
dce8eedf56
commit
b8ecaa22d1
1 changed files with 13 additions and 2 deletions
|
@ -29,6 +29,8 @@ export default function ({
|
|||
const kibanaServer = getService('kibanaServer');
|
||||
const dashboardPanelActions = getService('dashboardPanelActions');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
|
||||
describe('dashboard snapshots', function describeIndexTests() {
|
||||
before(async function () {
|
||||
|
@ -96,6 +98,15 @@ export default function ({
|
|||
});
|
||||
|
||||
describe('compare controls snapshot', async () => {
|
||||
const waitForPageReady = async () => {
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await retry.waitFor('page ready for screenshot', async () => {
|
||||
const queryBarVisible = await testSubjects.exists('globalQueryBar');
|
||||
const controlGroupVisible = await testSubjects.exists('controls-group-wrapper');
|
||||
return queryBarVisible && controlGroupVisible;
|
||||
});
|
||||
};
|
||||
|
||||
before(async () => {
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.dashboard.clickNewDashboard();
|
||||
|
@ -115,6 +126,7 @@ export default function ({
|
|||
});
|
||||
|
||||
it('in light mode', async () => {
|
||||
await waitForPageReady();
|
||||
const percentDifference = await screenshot.compareAgainstBaseline(
|
||||
'dashboard_controls_light',
|
||||
updateBaselines
|
||||
|
@ -127,8 +139,7 @@ export default function ({
|
|||
'theme:darkMode': true,
|
||||
});
|
||||
await browser.refresh();
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
|
||||
await waitForPageReady();
|
||||
const percentDifference = await screenshot.compareAgainstBaseline(
|
||||
'dashboard_controls_dark',
|
||||
updateBaselines
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue