mirror of
https://github.com/grafana/grafana.git
synced 2025-09-16 07:42:44 +08:00

* 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
41 lines
1.2 KiB
TypeScript
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);
|
|
});
|
|
});
|