Skip to content

Commit f07c0d4

Browse files
authored
Add E2E smoke test (#74)
1 parent 5268268 commit f07c0d4

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
77
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
8+
"e2e": "yarn playwright test",
89
"test": "jest --watch --onlyChanged",
910
"test:ci": "jest --passWithNoTests --maxWorkers 4",
1011
"typecheck": "tsc --noEmit",
@@ -19,9 +20,9 @@
1920
"devDependencies": {
2021
"@babel/core": "^7.21.4",
2122
"@grafana/eslint-config": "^6.0.0",
22-
"@grafana/plugin-e2e": "^1.14.6",
23+
"@grafana/plugin-e2e": "^1.16.0",
2324
"@grafana/tsconfig": "^1.2.0-rc1",
24-
"@playwright/test": "^1.48.0",
25+
"@playwright/test": "^1.50.0",
2526
"@swc/core": "^1.3.90",
2627
"@swc/helpers": "^0.5.0",
2728
"@swc/jest": "^0.2.26",

playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const pluginE2eAuth = `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`;
1414
* See https://playwright.dev/docs/test-configuration.
1515
*/
1616
export default defineConfig<PluginOptions>({
17-
testDir: './tests',
17+
testDir: './tests/e2e',
1818
/* Run tests in files in parallel */
1919
fullyParallel: true,
2020
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -28,7 +28,7 @@ export default defineConfig<PluginOptions>({
2828
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2929
use: {
3030
/* Base URL to use in actions like `await page.goto('/')`. */
31-
baseURL: 'http://localhost:3000',
31+
baseURL: process.env.GRAFANA_URL || `http://localhost:${process.env.PORT || 3000}`,
3232

3333
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3434
trace: 'on-first-retry',

tests/e2e/smoke.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { test, expect } from '@grafana/plugin-e2e';
2+
3+
test('Smoke test: plugin loads', async ({ createDataSourceConfigPage, page }) => {
4+
await createDataSourceConfigPage({ type: 'grafana-yugabyte-datasource' });
5+
6+
await expect(await page.getByText('Type: Yugabyte', { exact: true })).toBeVisible();
7+
await expect(await page.getByRole('heading', { name: 'Connection', exact: true })).toBeVisible();
8+
});

yarn.lock

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,10 +1002,10 @@
10021002
tslib "2.6.2"
10031003
typescript "5.3.3"
10041004

1005-
"@grafana/e2e-selectors@^11.5.0-216287":
1006-
version "11.5.0-216566"
1007-
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-216566.tgz#bec2387690e2a9046dcd97e29102fc22f72af11d"
1008-
integrity sha512-uhMZxhVOsMjLIRNI7yJRXcfm+F1LXLITdCCkKNh5ATMLe67utpTKWK89Yi9534R0SN38i8w8ReChehetbR0gFA==
1005+
"@grafana/e2e-selectors@^11.5.0-216908":
1006+
version "11.5.0-219385"
1007+
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-219385.tgz#31ef5f4dc82e4b771c0090f258219255d0e465d0"
1008+
integrity sha512-aSFk6Xh3Dk3K4ohLk9TTZHtEfNvjT0Kdf4ghVkilpGTvHo9D1RimTj+U2BJRInhffOWQHR5dMP8qpKPhFjW7Iw==
10091009
dependencies:
10101010
"@grafana/tsconfig" "^2.0.0"
10111011
semver "7.6.3"
@@ -1043,12 +1043,12 @@
10431043
ua-parser-js "^1.0.32"
10441044
web-vitals "^4.0.1"
10451045

1046-
"@grafana/plugin-e2e@^1.14.6":
1047-
version "1.14.6"
1048-
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.14.6.tgz#3ad08b4fd5aadee8dfd9170c7bb6d5e31a67bb53"
1049-
integrity sha512-YnARXviUFI+Ez0ygi1CypBHZGY+rNIShI428Mnrj8bn48mr0lCeiI/V2NGsQUz5YJegIfP1JSb05gb/7t8avBQ==
1046+
"@grafana/plugin-e2e@^1.16.0":
1047+
version "1.16.0"
1048+
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.16.0.tgz#9b44ac9465b1b9e50ea2ec5848fb96d42d3a6dd1"
1049+
integrity sha512-bBoIm9CmdbldWi0xLnqNPcEXujOMCBfj/74x4o6sDjSu99aq9wZVKdcRqYF+R9CiXIHx6mhMIR1bvnd06GWlcA==
10501050
dependencies:
1051-
"@grafana/e2e-selectors" "^11.5.0-216287"
1051+
"@grafana/e2e-selectors" "^11.5.0-216908"
10521052
semver "^7.5.4"
10531053
uuid "^11.0.2"
10541054
yaml "^2.3.4"
@@ -1645,12 +1645,12 @@
16451645
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
16461646
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
16471647

1648-
"@playwright/test@^1.48.0":
1649-
version "1.49.1"
1650-
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827"
1651-
integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==
1648+
"@playwright/test@^1.50.0":
1649+
version "1.50.0"
1650+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.50.0.tgz#25c63a09f833f89da4d54ad67db7900359e2d11d"
1651+
integrity sha512-ZGNXbt+d65EGjBORQHuYKj+XhCewlwpnSd/EDuLPZGSiEWmgOJB5RmMCCYGy5aMfTs9wx61RivfDKi8H/hcMvw==
16521652
dependencies:
1653-
playwright "1.49.1"
1653+
playwright "1.50.0"
16541654

16551655
"@popperjs/[email protected]", "@popperjs/core@^2.11.5":
16561656
version "2.11.8"
@@ -6677,17 +6677,17 @@ pkg-dir@^4.2.0:
66776677
dependencies:
66786678
find-up "^4.0.0"
66796679

6680-
playwright-core@1.49.1:
6681-
version "1.49.1"
6682-
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015"
6683-
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==
6680+
playwright-core@1.50.0:
6681+
version "1.50.0"
6682+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.50.0.tgz#28dd6a1488211c193933695ed337a5b44d46867c"
6683+
integrity sha512-CXkSSlr4JaZs2tZHI40DsZUN/NIwgaUPsyLuOAaIZp2CyF2sN5MM5NJsyB188lFSSozFxQ5fPT4qM+f0tH/6wQ==
66846684

6685-
playwright@1.49.1:
6686-
version "1.49.1"
6687-
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c"
6688-
integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==
6685+
playwright@1.50.0:
6686+
version "1.50.0"
6687+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.50.0.tgz#ccaf334f948d78139922844de55a18f8ae785410"
6688+
integrity sha512-+GinGfGTrd2IfX1TA4N2gNmeIksSb+IAe589ZH+FlmpV3MYTx6+buChGIuDLQwrGNCw2lWibqV50fU510N7S+w==
66896689
dependencies:
6690-
playwright-core "1.49.1"
6690+
playwright-core "1.50.0"
66916691
optionalDependencies:
66926692
fsevents "2.3.2"
66936693

0 commit comments

Comments
 (0)