mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
@grafana/e2e: timing improvements (#27861)
This commit is contained in:
parent
7c2999709c
commit
1c865b5bcb
@ -127,23 +127,15 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo instead wait for '@pluginModule'
|
// @todo instead wait for '@pluginModule' if not already loaded
|
||||||
e2e().wait(2000);
|
e2e().wait(2000);
|
||||||
|
|
||||||
// There is no usable data when the query is empty,
|
|
||||||
// and Cypress had an issue with some plugins where the request wasn't noticed, despite occuring in manual tests
|
|
||||||
if (isEdit) {
|
|
||||||
// Avoid cache flakiness (where @chartData isn't requested)
|
|
||||||
// @todo this may not be necessary anymore
|
|
||||||
e2e()
|
|
||||||
.get('.refresh-picker-buttons .btn')
|
|
||||||
.first()
|
|
||||||
.click({ force: true });
|
|
||||||
|
|
||||||
e2e().wait('@chartData');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isExplore) {
|
if (!isExplore) {
|
||||||
|
if (!isEdit) {
|
||||||
|
// Fields could be covered due to an empty query editor
|
||||||
|
closeRequestErrors();
|
||||||
|
}
|
||||||
|
|
||||||
// `panelTitle` is needed to edit the panel, and unlikely to have its value changed at that point
|
// `panelTitle` is needed to edit the panel, and unlikely to have its value changed at that point
|
||||||
const changeTitle = panelTitle && !isEdit;
|
const changeTitle = panelTitle && !isEdit;
|
||||||
|
|
||||||
@ -164,6 +156,9 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
|||||||
e2e.components.PluginVisualization.item(visualizationName)
|
e2e.components.PluginVisualization.item(visualizationName)
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
|
// @todo wait for '@pluginModule' if not a core visualization and not already loaded
|
||||||
|
e2e().wait(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consistently closed
|
// Consistently closed
|
||||||
@ -245,6 +240,25 @@ const closeOptionsGroup = (name: string): any =>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const closeRequestErrors = () => {
|
||||||
|
e2e().wait(1000); // emulate `cy.get()` for nested errors
|
||||||
|
e2e()
|
||||||
|
.get('app-notifications-list')
|
||||||
|
.then($elm => {
|
||||||
|
// Avoid failing when none are found
|
||||||
|
const selector = '[aria-label="Alert error"]:contains("Failed to call resource")';
|
||||||
|
const numErrors = $elm.find(selector).length;
|
||||||
|
|
||||||
|
for (let i = 0; i < numErrors; i++) {
|
||||||
|
e2e()
|
||||||
|
.get(selector)
|
||||||
|
.first()
|
||||||
|
.find('button')
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const getOptionsGroup = (name: string) => e2e().get(`.options-group:has([aria-label="Options group Panel ${name}"])`);
|
const getOptionsGroup = (name: string) => e2e().get(`.options-group:has([aria-label="Options group Panel ${name}"])`);
|
||||||
|
|
||||||
// @todo this actually returns type `Cypress.Chainable`
|
// @todo this actually returns type `Cypress.Chainable`
|
||||||
|
Loading…
Reference in New Issue
Block a user