-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/AN-4120 playwright e2e tests (#93)
* add playwright and delete cypress * add first queryEditor playwright test * check for header and start and end date * set minuteIntervalLimitInMilliseconds to 3h1min * add defaultPercentileValue * add ids for testing to ui elements in Query Editor * improve and add more test QueryEditor test cases * update yarn.lock * delete example test file * add e2e test github workflow * delete console.log and comment Firefox and Safari tests * fix package conflicts * fix intervalUtils test * update yarn to latest version * delete deprecated --prefer-offline flag * install @typescript-eslint/eslint-plugin * delete enableGlobalCache flag in yarnrc * Revert "delete enableGlobalCache flag in yarnrc" This reverts commit 8962cba. * Revert "install @typescript-eslint/eslint-plugin" This reverts commit 6a070fe. * Revert "delete deprecated --prefer-offline flag" This reverts commit a9c7620. * Revert "update yarn to latest version" This reverts commit 31e0272. * add resolutions to solve conflicting package versions * delete playwright.yml workflow * fix should send correct query for time series and table data * fix should send correct query for percentile selection * add filter test * add groupBy and orderBy tests * add queryEditorId to element ids * add tests to check if data is correctly displayed * add test for config editor * deletes commented code in playwright config * include e2e workflow in the ci workflow * delete interval and percentile changes as they were addressed in other PRs * format * adds unsuccessfull configEditor scenario * regenerate yarn.lock and delete resolutions in package.json * Revert "regenerate yarn.lock and delete resolutions in package.json" This reverts commit 146e89d. * substitute id with data-testid for elements with HTMLElement Attributes
- Loading branch information
Showing
19 changed files
with
1,951 additions
and
3,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { test, expect } from '@grafana/plugin-e2e'; | ||
import { BitmovinDataSourceOptions } from '../src/types/grafanaTypes'; | ||
|
||
test('should save and test valid configuration', async ({ | ||
createDataSourceConfigPage, | ||
readProvisionedDataSource, | ||
page, | ||
selectors, | ||
}) => { | ||
await page.route('*/**/analytics/licenses', async (route) => { | ||
await route.fulfill({ status: 200, body: 'OK' }); | ||
}); | ||
const ds = await readProvisionedDataSource<BitmovinDataSourceOptions>({ fileName: 'datasources.yml' }); | ||
const configPage = await createDataSourceConfigPage({ type: ds.type }); | ||
|
||
await page.getByTestId(`config-editor-${configPage.datasource.name}_api-key-input`).fill('test-api-key'); | ||
await page.getByTestId(`config-editor-${configPage.datasource.name}_tenant-org-id-input`).fill('test-tenant-org-id'); | ||
|
||
const queryPromise = page.waitForRequest('*/**/analytics/licenses'); | ||
await configPage.getByGrafanaSelector(selectors.pages.DataSource.saveAndTest).click(); | ||
const queryRequest = await queryPromise; | ||
|
||
expect(queryRequest.headers()['x-api-client']).toBe('analytics-grafana-datasource'); | ||
expect(queryRequest.headers()['x-api-key']).toBe('test-api-key'); | ||
expect(queryRequest.headers()['x-tenant-org-id']).toBe('test-tenant-org-id'); | ||
|
||
expect(configPage).toHaveAlert('success'); | ||
}); | ||
|
||
test('should not save invalid configuration', async ({ | ||
createDataSourceConfigPage, | ||
readProvisionedDataSource, | ||
page, | ||
selectors, | ||
}) => { | ||
const ds = await readProvisionedDataSource<BitmovinDataSourceOptions>({ fileName: 'datasources.yml' }); | ||
const configPage = await createDataSourceConfigPage({ type: ds.type }); | ||
|
||
await page.getByTestId(`config-editor-${configPage.datasource.name}_api-key-input`).fill('grafana-invalid-api-key'); | ||
|
||
const responsePromise = page.waitForResponse('*/**/analytics/licenses'); | ||
await configPage.getByGrafanaSelector(selectors.pages.DataSource.saveAndTest).click(); | ||
const response = await responsePromise; | ||
|
||
expect(response.status()).toBe(403); | ||
expect(configPage).toHaveAlert('error'); | ||
}); |
Oops, something went wrong.