@grafana/e2e: API improvements (#23079)

* Minor changes

* Fixtures path is now relative to the project directory

* URL support module now has individual exports

* Scenario context timing issues resolved

... caused by being ran synchronously, instead of as part of Cypress' asynchronous queue.

* Scenario context API now supports multiple keys per function call

* addDataSource flow accepts a config argument

… and optionally checks datasource health status

* Added readProvisions command

* Added addPanel flow
This commit is contained in:
Steven Vachon
2020-03-26 12:15:58 -04:00
committed by GitHub
parent 13ab84f201
commit a4308fffe7
20 changed files with 226 additions and 105 deletions

View File

@@ -190,13 +190,17 @@ const assertAdding3dependantQueryVariablesScenario = (queryVariables: QueryVaria
for (let queryVariableIndex = 0; queryVariableIndex < queryVariables.length; queryVariableIndex++) {
const { name, label, query, options, selectedOption } = queryVariables[queryVariableIndex];
const asserts = queryVariables.slice(0, queryVariableIndex + 1);
createQueryVariable({
dataSourceName: e2e.context().get('lastAddedDataSource'),
name,
label,
query,
options,
selectedOption,
// @todo remove `@ts-ignore` when possible
// @ts-ignore
e2e.getScenarioContext().then(({ lastAddedDataSource }) => {
createQueryVariable({
dataSourceName: lastAddedDataSource,
name,
label,
query,
options,
selectedOption,
});
});
assertVariableTable(asserts);
@@ -565,7 +569,11 @@ e2e.scenario({
addScenarioDashBoard: true,
skipScenario: false,
scenario: () => {
e2e.flows.openDashboard(e2e.context().get('lastAddedDashboardUid'));
// @todo remove `@ts-ignore` when possible
// @ts-ignore
e2e.getScenarioContext().then(({ lastAddedDashboardUid }) => {
e2e.flows.openDashboard(lastAddedDashboardUid);
});
e2e.pages.Dashboard.Toolbar.toolbarItems('Dashboard settings').click();
e2e.pages.Dashboard.Settings.General.sectionItems('Variables').click();
e2e.pages.Dashboard.Settings.Variables.List.addVariableCTA().click();

View File

@@ -7,7 +7,11 @@ e2e.scenario({
addScenarioDashBoard: true,
skipScenario: false,
scenario: () => {
e2e.flows.openDashboard(e2e.context().get('lastAddedDashboardUid'));
// @todo remove `@ts-ignore` when possible
// @ts-ignore
e2e.getScenarioContext().then(({ lastAddedDashboardUid }) => {
e2e.flows.openDashboard(lastAddedDashboardUid);
});
e2e.pages.Dashboard.Toolbar.toolbarItems('Add panel').click();
e2e.pages.AddDashboard.ctaButtons('Add Query').click();