plugin-tools
                                
                                
                                
                                    plugin-tools copied to clipboard
                            
                            
                            
                        Plugin E2E: Add support for testing alert query
What this PR does / why we need it:
This PR makes it possible to write e2e tests that verifies that a backend data source plugin can return data frames in a format that is compatible with alerting.
The process for testing alerting compatibility is as follows:
- Use 
alertRuleEditPagefixture to open a new, empty alert rule edit page OR use thegotoAlertRuleEditPagefixture to open an already existing alert rule. - Get query editor row, set data source and fill in the query
 - Click the 
Previewbutton to evaluate the alert query. If successful, the data source is compatible with alerting. 
This AlertRuleEditPage model follows the same pattern as all the other page models - it can be instantiated with or without an id. As mentioned above, it's exposed through alertRuleEditPage fixture (new alert rules) and gotoAlertRuleEditPage fixture (existing alert rules). I've also added a readProvisionedAlertRule that makes it possible to read a provisioned alert rule.
In practice, I think this will be useful to check for regressions in backend data source plugins. In the past, it has happened that changes to the backend code and how the data frames are being constructed leads to breakages in alerting. Running e2e tests that checks for breakages should be able to catch these regressions.
Which issue(s) this PR fixes:
Part of https://github.com/grafana/plugin-tools/issues/796
Will follow up with a docs PR later.
📦 Published PR as canary version: Canary Versions
  :sparkles: Test out this PR locally via:
npm install @grafana/[email protected]
npm install @grafana/[email protected]
# or 
yarn add @grafana/[email protected]
yarn add @grafana/[email protected]
Hello! 👋 This repository uses Auto for releasing packages using PR labels.
✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.
@josmperez do you want to have a look at the docs?
@josmperez can you take a look at the docs?
:rocket: PR was released in @grafana/[email protected] :rocket: