Skip to content

Commit d585d24

Browse files
committed
Fix tests for configuration
1 parent b037b45 commit d585d24

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

e2e/configuration.spec.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,29 @@ test.describe('Configuration tests', () => {
100100
*/
101101

102102
test('"Save & test" should fail when configuration is invalid', async ({
103+
readProvisionedDataSource,
104+
gotoDataSourceConfigPage,
105+
}) => {
106+
const ds = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({
107+
fileName: 'datasources.yml',
108+
});
109+
const configPage = await gotoDataSourceConfigPage(ds.uid);
110+
await expect(configPage.saveAndTest()).not.toBeOK();
111+
await expect(configPage).toHaveAlert('error', {
112+
hasText: /.*there was an error returned querying the prometheus api/i,
113+
});
114+
});
115+
116+
test('"Save & test" should fail when url is empty', async ({
103117
createDataSourceConfigPage,
104118
readProvisionedDataSource,
105119
}) => {
106120
const ds = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({
107121
fileName: 'datasources.yml',
108122
});
109123
const configPage = await createDataSourceConfigPage({ type: ds.type });
110-
await expect(configPage.saveAndTest()).not.toBeOK();
111-
await expect(configPage).toHaveAlert('error', { hasText: 'empty url' });
124+
await configPage.getByGrafanaSelector(selectors.pages.DataSource.saveAndTest).click();
125+
await expect(configPage).toHaveAlert('error', {hasText: /invalid URL/i});
112126
});
113127

114128
test('it should allow a user to add the version when the Prom type is selected', async ({

0 commit comments

Comments
 (0)