oncall-engine/grafana-plugin/e2e-tests/pluginInitialization/configuration.test.ts
Dominik Broj df6f7af8a5
chore: adjust dir names to irm (#4989)
# What this PR does

- rename utils to helpers
- rename types.ts to app-types.ts

## Which issue(s) this PR closes

Related to
https://raintank-corp.slack.com/archives/C0762D6EUDV/p1725477060488709
https://raintank-corp.slack.com/archives/C0762D6EUDV/p1724936143487849

TL;DR
IRM needs imported modules from oncall/incident to have uniq absolute
import paths

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-09-05 14:51:29 +00:00

36 lines
1.5 KiB
TypeScript

import { PLUGIN_CONFIG } from 'helpers/consts';
import { test, expect } from '../fixtures';
import { goToGrafanaPage } from '../utils/navigation';
test.describe('Plugin configuration', () => {
test('Admin user can see currently applied URL', async ({ adminRolePage: { page } }) => {
await goToGrafanaPage(page, PLUGIN_CONFIG);
await page.waitForLoadState('networkidle');
const currentlyAppliedURL = await page.getByTestId('oncall-api-url-input').inputValue();
expect(currentlyAppliedURL).toBe('http://oncall-dev-engine:8080');
});
test('Admin user can see error when invalid OnCall API URL is entered and plugin is reconnected', async ({
adminRolePage: { page },
}) => {
await goToGrafanaPage(page, PLUGIN_CONFIG);
await page.waitForLoadState('networkidle');
const correctURLAppliedByDefault = await page.getByTestId('oncall-api-url-input').inputValue();
// show client-side validation errors
const urlInput = page.getByTestId('oncall-api-url-input');
await urlInput.fill('');
await page.getByText('URL is required').waitFor();
await urlInput.fill('invalid-url-format:8080');
await page.getByText('URL is invalid').waitFor();
// apply back correct url and verify plugin connected again
await urlInput.fill(correctURLAppliedByDefault);
await page.waitForTimeout(500);
await page.getByTestId('connect-plugin').click();
await page.waitForLoadState('networkidle');
await page.getByText('Plugin is connected').waitFor();
});
});