mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Feat: timeGroup macro handling in VQB * Add tests * Add functions to SQL ds * Fix lint errors * Add feature toggle * Add rendering based on object * Fix lint * Fix CI failures * Fix tests * Address review comments * Add docs * Fix JSX runtime warnings * Remove docs part that mentions suggest more macros * Update docs/sources/shared/datasources/sql-query-builder-macros.md Co-authored-by: Jack Baldry <jack.baldry@grafana.com> * Add smoke test for this feature * lint * Add supported macros to influx * Add setupTests.ts to include in tsconfig.json * Import jest-dom instead of setupTests.ts --------- Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
24 lines
898 B
TypeScript
24 lines
898 B
TypeScript
import { PlaywrightTestArgs } from '@playwright/test';
|
|
|
|
import { PluginFixture } from '@grafana/plugin-e2e';
|
|
|
|
import { datasetResponse, fieldsResponse, tablesResponse } from './mocks/mysql.mocks';
|
|
|
|
export async function mockDataSourceRequest({ context, explorePage, selectors }: PlaywrightTestArgs & PluginFixture) {
|
|
await explorePage.datasource.set('gdev-mysql');
|
|
await context.route(selectors.apis.DataSource.queryPattern, async (route, request) => {
|
|
const refId = request.postDataJSON().queries[0].refId;
|
|
if (/fields-.*/g.test(refId)) {
|
|
return route.fulfill({ json: fieldsResponse(refId), status: 200 });
|
|
}
|
|
switch (refId) {
|
|
case 'tables':
|
|
return route.fulfill({ json: tablesResponse, status: 200 });
|
|
case 'datasets':
|
|
return route.fulfill({ json: datasetResponse, status: 200 });
|
|
default:
|
|
return route.continue();
|
|
}
|
|
});
|
|
}
|