@grafana/create-plugin 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v4.9.0 (Thu Apr 25 2024)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Create plugin: update scaffolded tests when creating an app plugin [#892](https://github.com/grafana/plugin-tools/pull/892) ([@mckn](https://github.com/mckn))
6
+
7
+ #### Authors: 1
8
+
9
+ - Marcus Andersson ([@mckn](https://github.com/mckn))
10
+
11
+ ---
12
+
1
13
  # v4.8.0 (Wed Apr 24 2024)
2
14
 
3
15
  #### 🚀 Enhancement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -87,5 +87,5 @@
87
87
  "engines": {
88
88
  "node": ">=20"
89
89
  },
90
- "gitHead": "96389ff99fec497ed6b2ab509709d578ecaf13f0"
90
+ "gitHead": "d8db91c5320a7355d3ad6c9734157292fee769ab"
91
91
  }
@@ -1,7 +1,7 @@
1
1
  import { test, expect } from './fixtures';
2
2
 
3
3
  test('should be possible to save app configuration', async ({ appConfigPage, page }) => {
4
- const saveForm = page.getByRole('button', { name: /Save API settings/i });
4
+ const saveButton = page.getByRole('button', { name: /Save API settings/i });
5
5
 
6
6
  // reset the configured secret
7
7
  await page.getByRole('button', { name: /reset/i }).click();
@@ -14,6 +14,6 @@ test('should be possible to save app configuration', async ({ appConfigPage, pag
14
14
  // listen for the server response on the saved form
15
15
  const saveResponse = appConfigPage.waitForSettingsResponse();
16
16
 
17
- await saveForm.click();
17
+ await saveButton.click();
18
18
  await expect(saveResponse).toBeOK();
19
19
  });
@@ -1,26 +1,25 @@
1
- import pluginJson from '../src/plugin.json';
2
- import { test, expect } from '@grafana/plugin-e2e';
1
+ import { test, expect } from './fixtures';
3
2
  import { ROUTES } from '../src/constants';
4
3
 
5
4
  test.describe('navigating app', () => {
6
- test('page one should render successfully', async ({ page }) => {
7
- await page.goto(`/a/${pluginJson.id}/${ROUTES.One}`);
5
+ test('page one should render successfully', async ({ gotoPage, page }) => {
6
+ await gotoPage(`/${ROUTES.One}`);
8
7
  await expect(page.getByText('This is page one.')).toBeVisible();
9
8
  });
10
9
 
11
- test('page two should render successfully', async ({ page }) => {
12
- await page.goto(`/a/${pluginJson.id}/${ROUTES.Two}`);
10
+ test('page two should render successfully', async ({ gotoPage, page }) => {
11
+ await gotoPage(`/${ROUTES.Two}`);
13
12
  await expect(page.getByText('This is page two.')).toBeVisible();
14
13
  });
15
14
 
16
- test('page three should support an id parameter', async ({ page }) => {
17
- await page.goto(`/a/${pluginJson.id}/${ROUTES.Three}/123456`);
15
+ test('page three should support an id parameter', async ({ gotoPage, page }) => {
16
+ await gotoPage(`/${ROUTES.Three}/123456`);
18
17
  await expect(page.getByText('ID: 123456')).toBeVisible();
19
18
  });
20
19
 
21
- test('page three should render sucessfully', async ({ page }) => {
20
+ test('page three should render sucessfully', async ({ gotoPage, page }) => {
22
21
  // wait for page to successfully render
23
- await page.goto(`/a/${pluginJson.id}/${ROUTES.One}`);
22
+ await gotoPage(`/${ROUTES.One}`);
24
23
  await expect(page.getByText('This is page one.')).toBeVisible();
25
24
 
26
25
  // navigating to page four with full width layout without sidebar menu
@@ -1,19 +1,26 @@
1
- import { AppConfigPage, test as base } from '@grafana/plugin-e2e';
1
+ import { AppConfigPage, AppPage, test as base } from '@grafana/plugin-e2e';
2
2
  import pluginJson from '../src/plugin.json';
3
3
 
4
- type AppTestFixture = { appConfigPage: AppConfigPage };
4
+ type AppTestFixture = {
5
+ appConfigPage: AppConfigPage;
6
+ gotoPage: (path?: string) => Promise<AppPage>;
7
+ };
5
8
 
6
9
  export const test = base.extend<AppTestFixture>({
7
- appConfigPage: async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
8
- const configPage = new AppConfigPage(
9
- { page, selectors, grafanaVersion, request, testInfo },
10
- {
10
+ appConfigPage: async ({ gotoAppConfigPage }, use) => {
11
+ const configPage = await gotoAppConfigPage({
12
+ pluginId: pluginJson.id,
13
+ });
14
+ await use(configPage);
15
+ },
16
+ gotoPage: async ({ gotoAppPage }, use) => {
17
+ await use((path) =>
18
+ gotoAppPage({
19
+ path,
11
20
  pluginId: pluginJson.id,
12
- }
21
+ })
13
22
  );
14
- await configPage.goto();
15
- await use(configPage);
16
23
  },
17
24
  });
18
25
 
19
- export { expect } from '@grafana/plugin-e2e';
26
+ export { expect } from '@grafana/plugin-e2e';