When end-to-end testing Grafana plugins, a best practice is to use the @grafana/plugin-e2e
testing tool. The @grafana/plugin-e2e
tool extends @playwright/test
capabilities with relevant fixtures, models, and expect matchers. Use it to enable comprehensive end-to-end testing of Grafana plugins across multiple versions of Grafana.
Note: To learn more, refer to our documentation on plugin development and end-to-end plugin testing.
You can add Playwright end-to-end tests for plugins to the e2e/plugin-e2e
directory.
Add a new directory that has the name as your plugin here
. This is the directory where your plugin tests will be kept.
Playwright uses projects to logically group tests together. All tests in a project share the same configuration.
In the Playwright config file, add a new project item. Make sure the name
and the testDir
subdirectory match the name of the directory that contains your plugin tests.
Add 'authenticate'
to the list of dependencies and specify 'playwright/.auth/admin.json'
as the storage state to ensure that all tests in your project will start already authenticated as an admin user. If you want to use a different role for and perhaps test RBAC for some of your tests, refer to our documentation.
{
name: 'mysql',
testDir: path.join(testDirRoot, '/mysql'),
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['authenticate'],
},
Update the CODEOWNERS file so that your team is owner of the tests in the directory you added in step 1.
yarn e2e:playwright
runs all Playwright tests. Optionally, you can provide the --project mysql
argument to run tests in a specific project.
The yarn e2e:playwright
script assumes you have Grafana running on localhost:3000
. You may change this with an environment variable:
HOST=127.0.0.1 PORT=3001 yarn e2e:playwright
The yarn e2e:playwright:server
starts a Grafana development server on port 3001 and runs the Playwright tests.
You can provision the development server with the devenv dashboards, data sources, and apps.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )