Skip to content

Commit

Permalink
adds unsuccessfull configEditor scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
MGJamJam committed Jul 25, 2024
1 parent 5ce366a commit 5fd2f3e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion e2e/configurationEditor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@grafana/plugin-e2e';
import { BitmovinDataSourceOptions } from '../src/types/grafanaTypes';

test('"Save & test" should be successful when configuration is valid', async ({
test('should save and test valid configuration', async ({
createDataSourceConfigPage,
readProvisionedDataSource,
page,
Expand All @@ -26,3 +26,22 @@ test('"Save & test" should be successful when configuration is valid', async ({

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.locator(`#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');
});

0 comments on commit 5fd2f3e

Please sign in to comment.