Skip to content

Commit

Permalink
Add E2E smoke test (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyeats authored Jan 24, 2025
1 parent 5268268 commit f07c0d4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
"e2e": "yarn playwright test",
"test": "jest --watch --onlyChanged",
"test:ci": "jest --passWithNoTests --maxWorkers 4",
"typecheck": "tsc --noEmit",
Expand All @@ -19,9 +20,9 @@
"devDependencies": {
"@babel/core": "^7.21.4",
"@grafana/eslint-config": "^6.0.0",
"@grafana/plugin-e2e": "^1.14.6",
"@grafana/plugin-e2e": "^1.16.0",
"@grafana/tsconfig": "^1.2.0-rc1",
"@playwright/test": "^1.48.0",
"@playwright/test": "^1.50.0",
"@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.spec.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: 'grafana-yugabyte-datasource' });

await expect(await page.getByText('Type: Yugabyte', { 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 @@ -1002,10 +1002,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-216908":
version "11.5.0-219385"
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-219385.tgz#31ef5f4dc82e4b771c0090f258219255d0e465d0"
integrity sha512-aSFk6Xh3Dk3K4ohLk9TTZHtEfNvjT0Kdf4ghVkilpGTvHo9D1RimTj+U2BJRInhffOWQHR5dMP8qpKPhFjW7Iw==
dependencies:
"@grafana/tsconfig" "^2.0.0"
semver "7.6.3"
Expand Down Expand Up @@ -1043,12 +1043,12 @@
ua-parser-js "^1.0.32"
web-vitals "^4.0.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.16.0":
version "1.16.0"
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.16.0.tgz#9b44ac9465b1b9e50ea2ec5848fb96d42d3a6dd1"
integrity sha512-bBoIm9CmdbldWi0xLnqNPcEXujOMCBfj/74x4o6sDjSu99aq9wZVKdcRqYF+R9CiXIHx6mhMIR1bvnd06GWlcA==
dependencies:
"@grafana/e2e-selectors" "^11.5.0-216287"
"@grafana/e2e-selectors" "^11.5.0-216908"
semver "^7.5.4"
uuid "^11.0.2"
yaml "^2.3.4"
Expand Down Expand Up @@ -1645,12 +1645,12 @@
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==

"@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.0":
version "1.50.0"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.50.0.tgz#25c63a09f833f89da4d54ad67db7900359e2d11d"
integrity sha512-ZGNXbt+d65EGjBORQHuYKj+XhCewlwpnSd/EDuLPZGSiEWmgOJB5RmMCCYGy5aMfTs9wx61RivfDKi8H/hcMvw==
dependencies:
playwright "1.49.1"
playwright "1.50.0"

"@popperjs/[email protected]", "@popperjs/core@^2.11.5":
version "2.11.8"
Expand Down Expand Up @@ -6677,17 +6677,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.0:
version "1.50.0"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.50.0.tgz#28dd6a1488211c193933695ed337a5b44d46867c"
integrity sha512-CXkSSlr4JaZs2tZHI40DsZUN/NIwgaUPsyLuOAaIZp2CyF2sN5MM5NJsyB188lFSSozFxQ5fPT4qM+f0tH/6wQ==

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.0:
version "1.50.0"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.50.0.tgz#ccaf334f948d78139922844de55a18f8ae785410"
integrity sha512-+GinGfGTrd2IfX1TA4N2gNmeIksSb+IAe589ZH+FlmpV3MYTx6+buChGIuDLQwrGNCw2lWibqV50fU510N7S+w==
dependencies:
playwright-core "1.49.1"
playwright-core "1.50.0"
optionalDependencies:
fsevents "2.3.2"

Expand Down

0 comments on commit f07c0d4

Please sign in to comment.