[v9.5.x] Chore: Update @grafana/e2e (#66880)
Chore: Update @grafana/e2e (#66365)
* Update e2e package
- Ensure health request is monitored for addDatasource flow
- Add custom timeout to configurePanel flow
* Make health check optional
(cherry picked from commit b2e32a70b9)
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
co-authored by
Andreas Christou
parent
e6eb1df488
commit
e9b2eb1607
@@ -50,6 +50,7 @@ function provisionAzureMonitorDatasources(datasources: AzureMonitorProvision[])
|
|||||||
expectedAlertMessage: 'Successfully connected to all Azure Monitor endpoints',
|
expectedAlertMessage: 'Successfully connected to all Azure Monitor endpoints',
|
||||||
// Reduce the timeout from 30s to error faster when an invalid alert message is presented
|
// Reduce the timeout from 30s to error faster when an invalid alert message is presented
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
|
awaitHealth: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export interface AddDataSourceConfig {
|
|||||||
skipTlsVerify: boolean;
|
skipTlsVerify: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
|
awaitHealth?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo this actually returns type `Cypress.Chainable<AddDaaSourceConfig>`
|
// @todo this actually returns type `Cypress.Chainable<AddDaaSourceConfig>`
|
||||||
@@ -40,8 +41,15 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
|
|||||||
skipTlsVerify,
|
skipTlsVerify,
|
||||||
type,
|
type,
|
||||||
timeout,
|
timeout,
|
||||||
|
awaitHealth,
|
||||||
} = fullConfig;
|
} = fullConfig;
|
||||||
|
|
||||||
|
if (awaitHealth) {
|
||||||
|
e2e()
|
||||||
|
.intercept(/health/)
|
||||||
|
.as('health');
|
||||||
|
}
|
||||||
|
|
||||||
e2e().logToConsole('Adding data source with name:', name);
|
e2e().logToConsole('Adding data source with name:', name);
|
||||||
e2e.pages.AddDataSource.visit();
|
e2e.pages.AddDataSource.visit();
|
||||||
e2e.pages.AddDataSource.dataSourcePluginsV2(type)
|
e2e.pages.AddDataSource.dataSourcePluginsV2(type)
|
||||||
@@ -76,6 +84,10 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
|
|||||||
|
|
||||||
e2e.pages.DataSource.saveAndTest().click();
|
e2e.pages.DataSource.saveAndTest().click();
|
||||||
|
|
||||||
|
if (awaitHealth) {
|
||||||
|
e2e().wait('@health', { timeout: timeout ?? e2e.config().defaultCommandTimeout });
|
||||||
|
}
|
||||||
|
|
||||||
// use the timeout passed in if it exists, otherwise, continue to use the default
|
// use the timeout passed in if it exists, otherwise, continue to use the default
|
||||||
e2e.pages.DataSource.alert()
|
e2e.pages.DataSource.alert()
|
||||||
.should('exist')
|
.should('exist')
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ interface ConfigurePanelOptional {
|
|||||||
panelTitle?: string;
|
panelTitle?: string;
|
||||||
timeRange?: TimeRangeConfig;
|
timeRange?: TimeRangeConfig;
|
||||||
visualizationName?: string;
|
visualizationName?: string;
|
||||||
|
timeout?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ConfigurePanelRequired {
|
interface ConfigurePanelRequired {
|
||||||
@@ -80,6 +81,7 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
|||||||
timeRange,
|
timeRange,
|
||||||
visitDashboardAtStart,
|
visitDashboardAtStart,
|
||||||
visualizationName,
|
visualizationName,
|
||||||
|
timeout,
|
||||||
} = fullConfig;
|
} = fullConfig;
|
||||||
|
|
||||||
if (visitDashboardAtStart) {
|
if (visitDashboardAtStart) {
|
||||||
@@ -161,7 +163,7 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
|||||||
e2e().wait('@chartData');
|
e2e().wait('@chartData');
|
||||||
|
|
||||||
// Wait for RxJS
|
// Wait for RxJS
|
||||||
e2e().wait(500);
|
e2e().wait(timeout ?? e2e.config().defaultCommandTimeout);
|
||||||
|
|
||||||
if (matchScreenshot) {
|
if (matchScreenshot) {
|
||||||
let visualization;
|
let visualization;
|
||||||
|
|||||||
Reference in New Issue
Block a user