Files
grafana/e2e-playwright/dashboard-cujs/global-setup.spec.ts
Victor Marin 27b3137baf Dashboards: User journey E2Es (#109049)
* wip

* wip

* wip

* wip

* scope e2es

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* add dashboard view tests

* mods cujs

* wip refactor

* remove timeouts

* fixes

* betterer

* fixes

* refactor

* refactor

* fix

* use type instead of any

* betterer

* PR mods + codeowners

* CODEOWNERS

* readme lint
2025-09-04 15:17:54 +03:00

41 lines
1.2 KiB
TypeScript

import { test } from '@playwright/test';
import cujDashboardOne from '../dashboards/cujs/cuj-dashboard-1.json';
import cujDashboardTwo from '../dashboards/cujs/cuj-dashboard-2.json';
import cujDashboardThree from '../dashboards/cujs/cuj-dashboard-3.json';
import { setDashboardUIDs } from './dashboardUidsState';
const dashboards = [cujDashboardOne, cujDashboardTwo, cujDashboardThree];
// should be used with live instances that already have dashboards
// that match the test dashboard UIDs and format
const NO_DASHBOARD_IMPORT = Boolean(process.env.NO_DASHBOARD_IMPORT);
test.describe('Dashboard CUJS Global Setup', () => {
test('import test dashboards', async ({ request }) => {
const dashboardUIDs: string[] = [];
if (NO_DASHBOARD_IMPORT) {
return;
}
// Import all test dashboards
for (const dashboard of dashboards) {
const response = await request.post('/api/dashboards/import', {
data: {
dashboard,
folderUid: '',
overwrite: true,
inputs: [],
},
});
const responseBody = await response.json();
dashboardUIDs.push(responseBody.uid);
}
setDashboardUIDs(dashboardUIDs);
});
});