Skip to content

Commit

Permalink
Add E2E smoke test (#1962)
Browse files Browse the repository at this point in the history
creates a smoke test for the zabbix data source

closes grafana/data-sources#194
  • Loading branch information
gwdawson authored Feb 4, 2025
1 parent 25354ee commit 525217d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"devDependencies": {
"@babel/core": "^7.21.4",
"@grafana/eslint-config": "^6.0.0",
"@grafana/plugin-e2e": "^1.14.6",
"@grafana/plugin-e2e": "^1.17.1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@playwright/test": "^1.48.0",
"@playwright/test": "^1.50.1",
"@swc/core": "^1.3.90",
"@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.26",
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const pluginE2eAuth = `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`;
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig<PluginOptions>({
testDir: './tests',
testDir: './tests/e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -28,7 +28,7 @@ export default defineConfig<PluginOptions>({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* 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 */
trace: 'on-first-retry',
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -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();
});
46 changes: 23 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1040,10 +1040,10 @@
tslib "2.6.2"
typescript "5.3.3"

"@grafana/e2e-selectors@^11.5.0-216287":
version "11.5.0-216566"
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-216566.tgz#bec2387690e2a9046dcd97e29102fc22f72af11d"
integrity sha512-uhMZxhVOsMjLIRNI7yJRXcfm+F1LXLITdCCkKNh5ATMLe67utpTKWK89Yi9534R0SN38i8w8ReChehetbR0gFA==
"@grafana/e2e-selectors@^11.5.0-221187":
version "11.5.1"
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.1.tgz#334636ad9e030bf87efaa8dd3dac8b8b5c3b3291"
integrity sha512-pvWax2RBAGarEoXdby5wftX6P+PZluWAF1ylN93OZfwJqvqVNbN1BHmYe2Y83HOKzhne9ML1kTH0KaJMiefaBA==
dependencies:
"@grafana/tsconfig" "^2.0.0"
semver "7.6.3"
Expand Down Expand Up @@ -1081,12 +1081,12 @@
ua-parser-js "^1.0.32"
web-vitals "^3.1.1"

"@grafana/plugin-e2e@^1.14.6":
version "1.14.6"
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.14.6.tgz#3ad08b4fd5aadee8dfd9170c7bb6d5e31a67bb53"
integrity sha512-YnARXviUFI+Ez0ygi1CypBHZGY+rNIShI428Mnrj8bn48mr0lCeiI/V2NGsQUz5YJegIfP1JSb05gb/7t8avBQ==
"@grafana/plugin-e2e@^1.17.1":
version "1.17.1"
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.17.1.tgz#a6e71044c65e66129fd25f7aa9171726441b4a6d"
integrity sha512-2M2+9vHwvZ+TdfS4w35/BoeaKsIixa+Jxvkq4hhRQy1H6oslShBRpohLIIFvjoHxP5o7dTislDV4pv3ugftmQA==
dependencies:
"@grafana/e2e-selectors" "^11.5.0-216287"
"@grafana/e2e-selectors" "^11.5.0-221187"
semver "^7.5.4"
uuid "^11.0.2"
yaml "^2.3.4"
Expand Down Expand Up @@ -1792,12 +1792,12 @@
picocolors "^1.0.0"
tslib "^2.6.0"

"@playwright/test@^1.48.0":
version "1.49.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827"
integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==
"@playwright/test@^1.50.1":
version "1.50.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.50.1.tgz#027d00ca77ec79688764eb765cfe9a688807bf0b"
integrity sha512-Jii3aBg+CEDpgnuDxEp/h7BimHcUTDlpEtce89xEumlJ5ef2hqepZ+PWp1DDpYC/VO9fmWVI1IlEaoI5fK9FXQ==
dependencies:
playwright "1.49.1"
playwright "1.50.1"

"@popperjs/[email protected]", "@popperjs/core@^2.11.5":
version "2.11.8"
Expand Down Expand Up @@ -7156,17 +7156,17 @@ pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"

playwright-core@1.49.1:
version "1.49.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015"
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==
playwright-core@1.50.1:
version "1.50.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.50.1.tgz#6a0484f1f1c939168f40f0ab3828c4a1592c4504"
integrity sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==

playwright@1.49.1:
version "1.49.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c"
integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==
playwright@1.50.1:
version "1.50.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.50.1.tgz#2f93216511d65404f676395bfb97b41aa052b180"
integrity sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==
dependencies:
playwright-core "1.49.1"
playwright-core "1.50.1"
optionalDependencies:
fsevents "2.3.2"

Expand Down

0 comments on commit 525217d

Please sign in to comment.