Skip to content

Commit 1ecdf54

Browse files
authored
Add E2E smoke test (#314)
1 parent 93b4b88 commit 1ecdf54

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
"devDependencies": {
4646
"@babel/core": "^7.21.4",
4747
"@grafana/eslint-config": "^8.0.0",
48-
"@grafana/plugin-e2e": "^1.14.6",
48+
"@grafana/plugin-e2e": "^1.16.0",
4949
"@grafana/tsconfig": "^2.0.0",
50-
"@playwright/test": "^1.48.0",
50+
"@playwright/test": "^1.50.0",
5151
"@stylistic/eslint-plugin-ts": "^2.9.0",
5252
"@swc/core": "^1.3.90",
5353
"@swc/helpers": "^0.5.0",

playwright.config.ts

Lines changed: 3 additions & 3 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',
@@ -49,4 +49,4 @@ export default defineConfig<PluginOptions>({
4949
dependencies: ['auth'],
5050
},
5151
],
52-
});
52+
});

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-bigquery-datasource' });
5+
6+
await expect(await page.getByText('Type: Google BigQuery', { exact: true })).toBeVisible();
7+
await expect(await page.locator('legend', { hasText: 'Authentication' })).toBeVisible();
8+
});

yarn.lock

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,10 +1005,10 @@
10051005
tslib "2.6.2"
10061006
typescript "5.3.3"
10071007

1008-
"@grafana/e2e-selectors@^11.5.0-216287":
1009-
version "11.5.0-216566"
1010-
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-216566.tgz#bec2387690e2a9046dcd97e29102fc22f72af11d"
1011-
integrity sha512-uhMZxhVOsMjLIRNI7yJRXcfm+F1LXLITdCCkKNh5ATMLe67utpTKWK89Yi9534R0SN38i8w8ReChehetbR0gFA==
1008+
"@grafana/e2e-selectors@^11.5.0-216908":
1009+
version "11.5.0-219385"
1010+
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-219385.tgz#31ef5f4dc82e4b771c0090f258219255d0e465d0"
1011+
integrity sha512-aSFk6Xh3Dk3K4ohLk9TTZHtEfNvjT0Kdf4ghVkilpGTvHo9D1RimTj+U2BJRInhffOWQHR5dMP8qpKPhFjW7Iw==
10121012
dependencies:
10131013
"@grafana/tsconfig" "^2.0.0"
10141014
semver "7.6.3"
@@ -1042,12 +1042,12 @@
10421042
resolved "https://registry.yarnpkg.com/@grafana/google-sdk/-/google-sdk-0.1.2.tgz#711436b4a32e6060eed2faa8882b118129e492f0"
10431043
integrity sha512-E4q2bhdP3s+ezMamu5d+4kzGktMNax5K3CDsUB4vpb7vkYTbnJhyxzTOY/2Vt4/TMN9MV1AN3zuLzcx9+yXtMQ==
10441044

1045-
"@grafana/plugin-e2e@^1.14.6":
1046-
version "1.14.6"
1047-
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.14.6.tgz#3ad08b4fd5aadee8dfd9170c7bb6d5e31a67bb53"
1048-
integrity sha512-YnARXviUFI+Ez0ygi1CypBHZGY+rNIShI428Mnrj8bn48mr0lCeiI/V2NGsQUz5YJegIfP1JSb05gb/7t8avBQ==
1045+
"@grafana/plugin-e2e@^1.16.0":
1046+
version "1.16.0"
1047+
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.16.0.tgz#9b44ac9465b1b9e50ea2ec5848fb96d42d3a6dd1"
1048+
integrity sha512-bBoIm9CmdbldWi0xLnqNPcEXujOMCBfj/74x4o6sDjSu99aq9wZVKdcRqYF+R9CiXIHx6mhMIR1bvnd06GWlcA==
10491049
dependencies:
1050-
"@grafana/e2e-selectors" "^11.5.0-216287"
1050+
"@grafana/e2e-selectors" "^11.5.0-216908"
10511051
semver "^7.5.4"
10521052
uuid "^11.0.2"
10531053
yaml "^2.3.4"
@@ -1679,12 +1679,12 @@
16791679
picocolors "^1.0.0"
16801680
tslib "^2.6.0"
16811681

1682-
"@playwright/test@^1.48.0":
1683-
version "1.49.1"
1684-
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827"
1685-
integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==
1682+
"@playwright/test@^1.50.0":
1683+
version "1.50.0"
1684+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.50.0.tgz#25c63a09f833f89da4d54ad67db7900359e2d11d"
1685+
integrity sha512-ZGNXbt+d65EGjBORQHuYKj+XhCewlwpnSd/EDuLPZGSiEWmgOJB5RmMCCYGy5aMfTs9wx61RivfDKi8H/hcMvw==
16861686
dependencies:
1687-
playwright "1.49.1"
1687+
playwright "1.50.0"
16881688

16891689
"@popperjs/core@2.11.8", "@popperjs/core@^2.11.5":
16901690
version "2.11.8"
@@ -7427,17 +7427,17 @@ pkg-dir@^4.2.0:
74277427
dependencies:
74287428
find-up "^4.0.0"
74297429

7430-
playwright-core@1.49.1:
7431-
version "1.49.1"
7432-
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015"
7433-
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==
7430+
playwright-core@1.50.0:
7431+
version "1.50.0"
7432+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.50.0.tgz#28dd6a1488211c193933695ed337a5b44d46867c"
7433+
integrity sha512-CXkSSlr4JaZs2tZHI40DsZUN/NIwgaUPsyLuOAaIZp2CyF2sN5MM5NJsyB188lFSSozFxQ5fPT4qM+f0tH/6wQ==
74347434

7435-
playwright@1.49.1:
7436-
version "1.49.1"
7437-
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c"
7438-
integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==
7435+
playwright@1.50.0:
7436+
version "1.50.0"
7437+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.50.0.tgz#ccaf334f948d78139922844de55a18f8ae785410"
7438+
integrity sha512-+GinGfGTrd2IfX1TA4N2gNmeIksSb+IAe589ZH+FlmpV3MYTx6+buChGIuDLQwrGNCw2lWibqV50fU510N7S+w==
74397439
dependencies:
7440-
playwright-core "1.49.1"
7440+
playwright-core "1.50.0"
74417441
optionalDependencies:
74427442
fsevents "2.3.2"
74437443

0 commit comments

Comments
 (0)