From 25bcbb7d8e076dba58b9435c0628de85a3fdf740 Mon Sep 17 00:00:00 2001 From: Vicky Lee <36230812+vickyyyyyyy@users.noreply.github.com> Date: Thu, 4 Feb 2021 10:59:38 +0000 Subject: [PATCH] test: add support for timeout to be passed in for addDatasource (#30736) * add support for timeout to be passed in for addDatasource * fix merge update --- packages/grafana-e2e/src/flows/addDataSource.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/grafana-e2e/src/flows/addDataSource.ts b/packages/grafana-e2e/src/flows/addDataSource.ts index 3ef75cb75d7..5b15464cffc 100644 --- a/packages/grafana-e2e/src/flows/addDataSource.ts +++ b/packages/grafana-e2e/src/flows/addDataSource.ts @@ -13,6 +13,7 @@ export interface AddDataSourceConfig { name: string; skipTlsVerify: boolean; type: string; + timeout?: number; } // @todo this actually returns type `Cypress.Chainable` @@ -40,6 +41,7 @@ export const addDataSource = (config?: Partial) => { name, skipTlsVerify, type, + timeout, } = fullConfig; e2e().logToConsole('Adding data source with name:', name); @@ -75,8 +77,13 @@ export const addDataSource = (config?: Partial) => { form(); e2e.pages.DataSource.saveAndTest().click(); - e2e.pages.DataSource.alert().should('exist').contains(expectedAlertMessage); // assertion + // use the timeout passed in if it exists, otherwise, continue to use the default + e2e.pages.DataSource.alert() + .should('exist') + .contains(expectedAlertMessage, { + timeout: timeout ?? e2e.config().defaultCommandTimeout, + }); e2e().logToConsole('Added data source with name:', name); return e2e()