Skip to content

Commit

Permalink
Docs: Clarify some points in documentation and typedocs (#831)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Sundell <[email protected]>
  • Loading branch information
adamyeats and sunker authored Mar 22, 2024
1 parent de33fbe commit f786e08
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docusaurus/docs/e2e-test-a-plugin/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default defineConfig({
name: 'run-tests',
use: {
...devices['Desktop Chrome'],
// @grafana/plugin-e2e writes the auth state to this file,
// the path should not be modified
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['auth'],
Expand Down Expand Up @@ -83,6 +85,8 @@ export default defineConfig<PluginOptions>({
testDir: './tests/viewer',
use: {
...devices['Desktop Chrome'],
// @grafana/plugin-e2e writes the auth state to this file,
// the path should not be modified
storageState: 'playwright/.auth/viewer.json',
},
dependencies: ['createViewerUserAndAuthenticate'],
Expand Down
13 changes: 13 additions & 0 deletions docusaurus/docs/e2e-test-a-plugin/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export default defineConfig({
name: 'run-tests',
use: {
...devices['Desktop Chrome'],
// @grafana/plugin-e2e writes the auth state to this file,
// the path should not be modified
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['auth'],
Expand All @@ -131,6 +133,17 @@ To prevent these files from being version controlled, you can add the following
/playwright/.auth/
```

The `@grafana/plugin-e2e` package also exports a type named `PluginOptions` that you can use to extend the Playwright configuration with the `@grafana/plugin-e2e` specific options.

```ts title="playwright.config.ts"
import { defineConfig } from '@playwright/test';
import type { PluginOptions } from '@grafana/plugin-e2e';

export default defineConfig<PluginOptions>({
...
});
```

### Step 4: Start Grafana

Start up the latest version of Grafana on your local machine like this:
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/e2e-test-a-plugin/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sidebar_position: 1

# Introduction to plugin E2E testing

[`@grafana/plugin-e2e`](https://www.npmjs.com/package/@grafana/plugin-e2e?activeTab=readme) is a testing tool designed specifically for Grafana plugin developers. It extends [`Playwright test`](https://playwright.dev/) capabilities with relevant fixtures, models, and expect matchers; enabling comprehensive end-to-end testing of Grafana plugins across multiple versions of Grafana. This package simplifies the testing process, ensuring your plugin is robust and compatible with various Grafana environments.
[`@grafana/plugin-e2e`](https://www.npmjs.com/package/@grafana/plugin-e2e?activeTab=readme) is designed specifically for Grafana plugin developers. It extends [`@playwright/test`](https://playwright.dev/) capabilities with relevant fixtures, models, and expect matchers; enabling comprehensive end-to-end testing of Grafana plugins across multiple versions of Grafana. This package simplifies the testing process, ensuring your plugin is robust and compatible with various Grafana environments.

:::warning
The `@grafana/plugin-e2e` tool is still in beta and subject to breaking changes.
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-e2e/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export type CreateDataSourceArgs<T = any> = {

export type CreateDataSourcePageArgs = {
/**
* The data source type to create
* The data source type to create. This corresponds to the unique id of the data source plugin (`id` in `plugin.json`).
*/
type: string;
/**
Expand Down

0 comments on commit f786e08

Please sign in to comment.