-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
19 additions
and
62 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 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 |
---|---|---|
@@ -1,31 +1,9 @@ | ||
import { test, expect } from '@grafana/plugin-e2e'; | ||
import { MyDataSourceOptions, MySecureJsonData } from '../src/types'; | ||
|
||
test('smoke: should render config editor', async ({ createDataSourceConfigPage, readProvisionedDataSource, page }) => { | ||
const ds = await readProvisionedDataSource({ fileName: 'datasources.yml' }); | ||
await createDataSourceConfigPage({ type: ds.type }); | ||
await expect(page.getByLabel('Path')).toBeVisible(); | ||
}); | ||
test('"Save & test" should be successful when configuration is valid', async ({ | ||
createDataSourceConfigPage, | ||
readProvisionedDataSource, | ||
page, | ||
}) => { | ||
const ds = await readProvisionedDataSource<MyDataSourceOptions, MySecureJsonData>({ fileName: 'datasources.yml' }); | ||
const configPage = await createDataSourceConfigPage({ type: ds.type }); | ||
await page.getByRole('textbox', { name: 'Path' }).fill(ds.jsonData.path ?? ''); | ||
await page.getByRole('textbox', { name: 'API Key' }).fill(ds.secureJsonData?.apiKey ?? ''); | ||
await expect(configPage.saveAndTest()).toBeOK(); | ||
}); | ||
|
||
test('"Save & test" should fail when configuration is invalid', async ({ | ||
createDataSourceConfigPage, | ||
readProvisionedDataSource, | ||
page, | ||
}) => { | ||
const ds = await readProvisionedDataSource<MyDataSourceOptions, MySecureJsonData>({ fileName: 'datasources.yml' }); | ||
const configPage = await createDataSourceConfigPage({ type: ds.type }); | ||
await page.getByRole('textbox', { name: 'Path' }).fill(ds.jsonData.path ?? ''); | ||
await expect(configPage.saveAndTest()).not.toBeOK(); | ||
await expect(configPage).toHaveAlert('error', { hasText: 'API key is missing' }); | ||
await expect(page.getByLabel('Base Url')).toBeVisible(); | ||
await expect(page.getByLabel('Pipeline')).toBeVisible(); | ||
await expect(page.getByLabel('API Key')).toBeVisible(); | ||
}); |
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