Plugin E2E: Add more api tests (#94073)

* add tests

* bump plugin-e2e

* use range

* update lock file
This commit is contained in:
Erik Sundell 2024-10-02 11:55:04 +02:00 committed by GitHub
parent 763163603c
commit d6d51f0316
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 7 deletions

View File

@ -0,0 +1,15 @@
import { expect, test } from '@grafana/plugin-e2e';
const REACT_TABLE_DASHBOARD = { uid: 'U_bZIMRMk' };
test('add panel in already existing dashboard', async ({ gotoDashboardPage, page }) => {
const dashboardPage = await gotoDashboardPage(REACT_TABLE_DASHBOARD);
await dashboardPage.addPanel();
await expect(page.url()).toContain('editPanel');
});
test('add panel in new dashboard', async ({ dashboardPage, page }) => {
const panelEditPage = await dashboardPage.addPanel();
await expect(panelEditPage.panel.locator).toBeVisible();
await expect(page.url()).toContain('editPanel');
});

View File

@ -1,4 +1,4 @@
import { DashboardPage, expect, test } from '@grafana/plugin-e2e'; import { expect, test } from '@grafana/plugin-e2e';
import { formatExpectError } from '../errors'; import { formatExpectError } from '../errors';
import { successfulDataQuery } from '../mocks/queries'; import { successfulDataQuery } from '../mocks/queries';
@ -8,6 +8,7 @@ const PANEL_TITLE = 'Table panel E2E test';
const TABLE_VIZ_NAME = 'Table'; const TABLE_VIZ_NAME = 'Table';
const STANDARD_OTIONS_CATEGORY = 'Standard options'; const STANDARD_OTIONS_CATEGORY = 'Standard options';
const DISPLAY_NAME_LABEL = 'Display name'; const DISPLAY_NAME_LABEL = 'Display name';
const REACT_TABLE_DASHBOARD = { uid: 'U_bZIMRMk' };
test.describe('query editor query data', () => { test.describe('query editor query data', () => {
test('query data response should be OK when query is valid', async ({ panelEditPage }) => { test('query data response should be OK when query is valid', async ({ panelEditPage }) => {
@ -84,3 +85,9 @@ test.describe('edit panel plugin settings', () => {
).toBeVisible(); ).toBeVisible();
}); });
}); });
test('backToDashboard method should navigate to dashboard page', async ({ gotoPanelEditPage, page }) => {
const panelEditPage = await gotoPanelEditPage({ dashboard: REACT_TABLE_DASHBOARD, id: '4' });
await panelEditPage.backToDashboard();
await expect(page.url()).not.toContain('editPanel');
});

View File

@ -79,7 +79,7 @@
"@emotion/eslint-plugin": "11.12.0", "@emotion/eslint-plugin": "11.12.0",
"@grafana/eslint-config": "7.0.0", "@grafana/eslint-config": "7.0.0",
"@grafana/eslint-plugin": "link:./packages/grafana-eslint-rules", "@grafana/eslint-plugin": "link:./packages/grafana-eslint-rules",
"@grafana/plugin-e2e": "^1.8.2", "@grafana/plugin-e2e": "^1.8.3",
"@grafana/tsconfig": "^2.0.0", "@grafana/tsconfig": "^2.0.0",
"@manypkg/get-packages": "^2.2.0", "@manypkg/get-packages": "^2.2.0",
"@playwright/test": "1.47.2", "@playwright/test": "1.47.2",

View File

@ -3949,16 +3949,16 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@grafana/plugin-e2e@npm:^1.8.2": "@grafana/plugin-e2e@npm:^1.8.3":
version: 1.8.2 version: 1.8.3
resolution: "@grafana/plugin-e2e@npm:1.8.2" resolution: "@grafana/plugin-e2e@npm:1.8.3"
dependencies: dependencies:
semver: "npm:^7.5.4" semver: "npm:^7.5.4"
uuid: "npm:^10.0.0" uuid: "npm:^10.0.0"
yaml: "npm:^2.3.4" yaml: "npm:^2.3.4"
peerDependencies: peerDependencies:
"@playwright/test": ^1.41.2 "@playwright/test": ^1.41.2
checksum: 10/33afac70ec9a926d41f2cc1a07f818f3705e63a33d5c9ce85569b19ec585fed1d8e863a9320c54ca6dc96f8c1e20699bb6ad44714e91ba895c3c937395aa9b16 checksum: 10/bb13d8e9fd6dc5ebb7deb7f3e57ac31c13a6f163337c2eb744a5671a38944ea7c81298bd9c1a65b8d53e1392429a16347134ae215fbda3babc9c4d563312a0bf
languageName: node languageName: node
linkType: hard linkType: hard
@ -18943,7 +18943,7 @@ __metadata:
"@grafana/lezer-logql": "npm:0.2.6" "@grafana/lezer-logql": "npm:0.2.6"
"@grafana/monaco-logql": "npm:^0.0.7" "@grafana/monaco-logql": "npm:^0.0.7"
"@grafana/o11y-ds-frontend": "workspace:*" "@grafana/o11y-ds-frontend": "workspace:*"
"@grafana/plugin-e2e": "npm:^1.8.2" "@grafana/plugin-e2e": "npm:^1.8.3"
"@grafana/prometheus": "workspace:*" "@grafana/prometheus": "workspace:*"
"@grafana/runtime": "workspace:*" "@grafana/runtime": "workspace:*"
"@grafana/saga-icons": "workspace:*" "@grafana/saga-icons": "workspace:*"