Make health check optional

This commit is contained in:
Andreas Christou
2023-04-12 13:13:33 +01:00
parent 155fcae4aa
commit 91f66d61e1
2 changed files with 11 additions and 4 deletions
@@ -50,6 +50,7 @@ function provisionAzureMonitorDatasources(datasources: AzureMonitorProvision[])
expectedAlertMessage: 'Successfully connected to all Azure Monitor endpoints',
// Reduce the timeout from 30s to error faster when an invalid alert message is presented
timeout: 10000,
awaitHealth: true,
});
}
@@ -14,6 +14,7 @@ export interface AddDataSourceConfig {
skipTlsVerify: boolean;
type: string;
timeout?: number;
awaitHealth?: boolean;
}
// @todo this actually returns type `Cypress.Chainable<AddDaaSourceConfig>`
@@ -40,11 +41,14 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
skipTlsVerify,
type,
timeout,
awaitHealth,
} = fullConfig;
e2e()
.intercept(/health/)
.as('health');
if (awaitHealth) {
e2e()
.intercept(/health/)
.as('health');
}
e2e().logToConsole('Adding data source with name:', name);
e2e.pages.AddDataSource.visit();
@@ -80,7 +84,9 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
e2e.pages.DataSource.saveAndTest().click();
e2e().wait('@health', { timeout: timeout ?? e2e.config().defaultCommandTimeout });
if (awaitHealth) {
e2e().wait('@health', { timeout: timeout ?? e2e.config().defaultCommandTimeout });
}
// use the timeout passed in if it exists, otherwise, continue to use the default
e2e.pages.DataSource.alert()