The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/e2e/plugin-e2e/plugin-e2e-api-tests/as-admin-user/datasourceConfigPage.spec.ts

45 lines
2.0 KiB

E2E: Add plugin-e2e scenario verification tests (#79969) * add playwright test and plugin-e2e * run tests in ci * add ds config tests * add panel edit tests * add annotation test * add variable edit page tests * add explore page tests * add panel plugin tests * add readme * remove comments * fix broken test * remove user.json * remove newline in starlark * fix lint issue * ignore failure of playwright tests * update code owners * add detailed error messages in every expect * update message frame * fix link * upload report to gcp * echo url * add playwright developer guide * bump plugin-e2e * add custom provisioning dir * update plugin-e2e * remove not used imports * fix typo * minor fixes * use latest version of plugin-e2e * fix broken link * use latest plugin-e2e * add feature toggle scenario verification tests * bump version * use auth file from package * fix type error * add panel data assertions * rename parent dir and bump version * fix codeowners * reset files * remove not used file * update plugin-e2e * separate tests per role * pass prov dir * skip using provisioning fixture * wip * fix permission test * move to e2e dir * fix path to readme * post comment with report url * format starlark * post comment with report url * post comment with report url * fix token * make test fail * fix exit code * bump version * bump to latest plugin-e2e * revert reporting message * remove comments * readding report comment * change exit code * format starlark * force test to fail * add new step that posts comment * fix link * use latest playwright image * fix failing test * format starlark * remove unused fixture Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> --------- Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2 years ago
import { expect, test } from '@grafana/plugin-e2e';
import { formatExpectError } from '../errors';
test.describe('test createDataSourceConfigPage fixture, saveAndTest and toBeOK matcher', () => {
test('invalid credentials should return an error', async ({ createDataSourceConfigPage, page }) => {
const configPage = await createDataSourceConfigPage({ type: 'prometheus' });
await page.getByPlaceholder('http://localhost:9090').fill('http://localhost:9090');
await expect(
configPage.saveAndTest(),
formatExpectError('Expected save data source config to fail when Prometheus server is not running')
).not.toBeOK();
});
test('valid credentials should return a 200 status code', async ({ createDataSourceConfigPage, page }) => {
const configPage = await createDataSourceConfigPage({ type: 'prometheus' });
configPage.mockHealthCheckResponse({ status: 200 });
await page.getByPlaceholder('http://localhost:9090').fill('http://localhost:9090');
await expect(
configPage.saveAndTest(),
formatExpectError('Expected data source config to be successfully saved')
).toBeOK();
});
});
test.describe('test data source with frontend only health check', () => {
test('valid credentials should display a success alert on the page', async ({
createDataSourceConfigPage,
page,
selectors,
}) => {
const configPage = await createDataSourceConfigPage({ type: 'zipkin' });
const healthCheckPath = `${selectors.apis.DataSource.proxy(configPage.datasource.uid)}/api/v2/services`;
await page.route(healthCheckPath, async (route) => {
await route.fulfill({ status: 200, body: 'OK' });
});
await page.getByPlaceholder('http://localhost:9411').fill('http://localhost:9411');
await expect(configPage.saveAndTest({ path: healthCheckPath })).toBeOK();
E2E: Add plugin-e2e scenario verification tests (#79969) * add playwright test and plugin-e2e * run tests in ci * add ds config tests * add panel edit tests * add annotation test * add variable edit page tests * add explore page tests * add panel plugin tests * add readme * remove comments * fix broken test * remove user.json * remove newline in starlark * fix lint issue * ignore failure of playwright tests * update code owners * add detailed error messages in every expect * update message frame * fix link * upload report to gcp * echo url * add playwright developer guide * bump plugin-e2e * add custom provisioning dir * update plugin-e2e * remove not used imports * fix typo * minor fixes * use latest version of plugin-e2e * fix broken link * use latest plugin-e2e * add feature toggle scenario verification tests * bump version * use auth file from package * fix type error * add panel data assertions * rename parent dir and bump version * fix codeowners * reset files * remove not used file * update plugin-e2e * separate tests per role * pass prov dir * skip using provisioning fixture * wip * fix permission test * move to e2e dir * fix path to readme * post comment with report url * format starlark * post comment with report url * post comment with report url * fix token * make test fail * fix exit code * bump version * bump to latest plugin-e2e * revert reporting message * remove comments * readding report comment * change exit code * format starlark * force test to fail * add new step that posts comment * fix link * use latest playwright image * fix failing test * format starlark * remove unused fixture Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com> --------- Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2 years ago
await expect(
configPage,
formatExpectError('Expected data source config to display success alert after save')
).toHaveAlert('success', { hasNotText: 'Datasource updated' });
});
});