Add E2E smoke test (#1962)

creates a smoke test for the zabbix data source

closes https://github.com/grafana/data-sources/issues/194
This commit is contained in:
Gareth Dawson
2025-02-04 18:04:07 +07:00
committed by GitHub
parent 25354eea40
commit 525217ddad
4 changed files with 35 additions and 27 deletions

View File

@@ -43,9 +43,9 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.4", "@babel/core": "^7.21.4",
"@grafana/eslint-config": "^6.0.0", "@grafana/eslint-config": "^6.0.0",
"@grafana/plugin-e2e": "^1.14.6", "@grafana/plugin-e2e": "^1.17.1",
"@grafana/tsconfig": "^1.2.0-rc1", "@grafana/tsconfig": "^1.2.0-rc1",
"@playwright/test": "^1.48.0", "@playwright/test": "^1.50.1",
"@swc/core": "^1.3.90", "@swc/core": "^1.3.90",
"@swc/helpers": "^0.5.0", "@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.26", "@swc/jest": "^0.2.26",

View File

@@ -14,7 +14,7 @@ const pluginE2eAuth = `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`;
* See https://playwright.dev/docs/test-configuration. * See https://playwright.dev/docs/test-configuration.
*/ */
export default defineConfig<PluginOptions>({ export default defineConfig<PluginOptions>({
testDir: './tests', testDir: './tests/e2e',
/* Run tests in files in parallel */ /* Run tests in files in parallel */
fullyParallel: true, fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */ /* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -28,7 +28,7 @@ export default defineConfig<PluginOptions>({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:3000', baseURL: process.env.GRAFANA_URL || `http://localhost:${process.env.PORT || 3000}`,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry', trace: 'on-first-retry',

8
tests/e2e/smoke.test.ts Normal file
View File

@@ -0,0 +1,8 @@
import { test, expect } from '@grafana/plugin-e2e';
test('Smoke test: plugin loads', async ({ createDataSourceConfigPage, page }) => {
await createDataSourceConfigPage({ type: 'alexanderzobnin-zabbix-datasource' });
await expect(await page.getByText('Type: Zabbix', { exact: true })).toBeVisible();
await expect(await page.getByRole('heading', { name: 'Connection', exact: true })).toBeVisible();
});

View File

@@ -1040,10 +1040,10 @@
tslib "2.6.2" tslib "2.6.2"
typescript "5.3.3" typescript "5.3.3"
"@grafana/e2e-selectors@^11.5.0-216287": "@grafana/e2e-selectors@^11.5.0-221187":
version "11.5.0-216566" version "11.5.1"
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-216566.tgz#bec2387690e2a9046dcd97e29102fc22f72af11d" resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.1.tgz#334636ad9e030bf87efaa8dd3dac8b8b5c3b3291"
integrity sha512-uhMZxhVOsMjLIRNI7yJRXcfm+F1LXLITdCCkKNh5ATMLe67utpTKWK89Yi9534R0SN38i8w8ReChehetbR0gFA== integrity sha512-pvWax2RBAGarEoXdby5wftX6P+PZluWAF1ylN93OZfwJqvqVNbN1BHmYe2Y83HOKzhne9ML1kTH0KaJMiefaBA==
dependencies: dependencies:
"@grafana/tsconfig" "^2.0.0" "@grafana/tsconfig" "^2.0.0"
semver "7.6.3" semver "7.6.3"
@@ -1081,12 +1081,12 @@
ua-parser-js "^1.0.32" ua-parser-js "^1.0.32"
web-vitals "^3.1.1" web-vitals "^3.1.1"
"@grafana/plugin-e2e@^1.14.6": "@grafana/plugin-e2e@^1.17.1":
version "1.14.6" version "1.17.1"
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.14.6.tgz#3ad08b4fd5aadee8dfd9170c7bb6d5e31a67bb53" resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.17.1.tgz#a6e71044c65e66129fd25f7aa9171726441b4a6d"
integrity sha512-YnARXviUFI+Ez0ygi1CypBHZGY+rNIShI428Mnrj8bn48mr0lCeiI/V2NGsQUz5YJegIfP1JSb05gb/7t8avBQ== integrity sha512-2M2+9vHwvZ+TdfS4w35/BoeaKsIixa+Jxvkq4hhRQy1H6oslShBRpohLIIFvjoHxP5o7dTislDV4pv3ugftmQA==
dependencies: dependencies:
"@grafana/e2e-selectors" "^11.5.0-216287" "@grafana/e2e-selectors" "^11.5.0-221187"
semver "^7.5.4" semver "^7.5.4"
uuid "^11.0.2" uuid "^11.0.2"
yaml "^2.3.4" yaml "^2.3.4"
@@ -1792,12 +1792,12 @@
picocolors "^1.0.0" picocolors "^1.0.0"
tslib "^2.6.0" tslib "^2.6.0"
"@playwright/test@^1.48.0": "@playwright/test@^1.50.1":
version "1.49.1" version "1.50.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827" resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.50.1.tgz#027d00ca77ec79688764eb765cfe9a688807bf0b"
integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g== integrity sha512-Jii3aBg+CEDpgnuDxEp/h7BimHcUTDlpEtce89xEumlJ5ef2hqepZ+PWp1DDpYC/VO9fmWVI1IlEaoI5fK9FXQ==
dependencies: dependencies:
playwright "1.49.1" playwright "1.50.1"
"@popperjs/core@2.11.8", "@popperjs/core@^2.11.5": "@popperjs/core@2.11.8", "@popperjs/core@^2.11.5":
version "2.11.8" version "2.11.8"
@@ -7156,17 +7156,17 @@ pkg-dir@^4.2.0:
dependencies: dependencies:
find-up "^4.0.0" find-up "^4.0.0"
playwright-core@1.49.1: playwright-core@1.50.1:
version "1.49.1" version "1.50.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015" resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.50.1.tgz#6a0484f1f1c939168f40f0ab3828c4a1592c4504"
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg== integrity sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==
playwright@1.49.1: playwright@1.50.1:
version "1.49.1" version "1.50.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c" resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.50.1.tgz#2f93216511d65404f676395bfb97b41aa052b180"
integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA== integrity sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==
dependencies: dependencies:
playwright-core "1.49.1" playwright-core "1.50.1"
optionalDependencies: optionalDependencies:
fsevents "2.3.2" fsevents "2.3.2"