Chore: Move to Cypress 12 and decouple cypress from @grafana/e2e (#74084)

* update drone to use cypress 12 image

* upgrade cypress to 12 in core

* cypress config actually valid

* update @grafana/e2e imports and add lint rule

* ignore grafana-e2e from betterer now it's deprecated

* fix remaining type errors

* fix failing tests

* remove unnecessary tsconfig

* remove unnecessary comment

* update enterprise suite commands to work

* add cypress config to CODEOWNERS

* export setTimeRange in utils

* remove @grafana/e2e from core deps

* try running the command through yarn

* move CMD to scripts

* Update cloud-data-sources e2e image

* Update paths

---------

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
Ashley Harrison
2023-09-08 16:51:59 +01:00
committed by GitHub
co-authored by Andreas Christou
parent e7a2c95586
commit 0f2f25c5d9
116 changed files with 11747 additions and 223 deletions
+51
View File
@@ -0,0 +1,51 @@
import { e2e } from '../index';
import { fromBaseUrl } from '../support/url';
export interface DeleteDashboardConfig {
quick?: boolean;
title: string;
uid: string;
}
export const deleteDashboard = ({ quick = false, title, uid }: DeleteDashboardConfig) => {
e2e().logToConsole('Deleting dashboard with uid:', uid);
if (quick) {
quickDelete(uid);
} else {
uiDelete(uid, title);
}
e2e().logToConsole('Deleted dashboard with uid:', uid);
e2e.getScenarioContext().then(({ addedDashboards }: any) => {
e2e.setScenarioContext({
addedDashboards: addedDashboards.filter((dashboard: DeleteDashboardConfig) => {
return dashboard.title !== title && dashboard.uid !== uid;
}),
});
});
};
const quickDelete = (uid: string) => {
e2e().request('DELETE', fromBaseUrl(`/api/dashboards/uid/${uid}`));
};
const uiDelete = (uid: string, title: string) => {
e2e.pages.Dashboard.visit(uid);
e2e.components.PageToolbar.item('Dashboard settings').click();
e2e.pages.Dashboard.Settings.General.deleteDashBoard().click();
e2e.pages.ConfirmModal.delete().click();
e2e.flows.assertSuccessNotification();
e2e.pages.Dashboards.visit();
// @todo replace `e2e.pages.Dashboards.dashboards` with this when argument is empty
if (e2e.components.Search.dashboardItems) {
e2e.components.Search.dashboardItems().each((item) => e2e().wrap(item).should('not.contain', title));
} else {
e2e()
.get('[aria-label^="Dashboard search item "]')
.each((item) => e2e().wrap(item).should('not.contain', title));
}
};