New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@grafana/plugin-e2e

Package Overview
Dependencies
Maintainers
23
Versions
410
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grafana/plugin-e2e - npm Package Compare versions

Comparing version 1.17.1 to 1.17.2-canary.1508.ee7f4b5.0

16

dist/models/pages/AlertRuleEditPage.d.ts

@@ -16,8 +16,20 @@ import { AlertRuleArgs, NavigateOptions, PluginTestCtx, RequestOptions } from '../../types';

get alertRuleNameField(): import("playwright-core").Locator;
get advancedModeSwitch(): import("playwright-core").Locator;
isAdvancedModeSupported(): Promise<boolean>;
enableAdvancedQueryMode(): Promise<void>;
disableAdvancedQueryMode(): Promise<void>;
getQueryRow(refId?: string): Promise<AlertRuleQuery>;
/**
* Returns an instance of the {@link AlertRuleQuery} class for the query row with the provided refId.
* @deprecated Use getQueryRow instead
* Returns an instance of the {@link AlertRuleQuery} class for a query in the query and expression step (step 2)
*
* @param refId is optional. If not provided, it will return query row with refId 'A' in Grafana versions <11.6.
* In Grafana versions >=11.6 where advanced mode is supported, it will return the default query if advanced mode
* is not enabled. If advanced mode is enabled, it will return the a query by refId.
*/
getAlertRuleQueryRow(refId: string): AlertRuleQuery;
getAlertRuleQueryRow(refId?: string): AlertRuleQuery;
/**
* Clicks the "Add query" button and returns an instance of the {@link AlertRuleQuery} class for the new query row.
*
* Since Grafana 11.6, this method is only available if advanced mode is enabled. Use enableQueryAdvancedMode() method to enable it.
*/

@@ -24,0 +36,0 @@ clickAddQueryRow(): Promise<AlertRuleQuery>;

@@ -40,2 +40,3 @@ "use strict";

const AlertRuleQuery_1 = require("../components/AlertRuleQuery");
const QUERY_AND_EXPRESSION_STEP_ID = '2';
class AlertRuleEditPage extends GrafanaPage_1.GrafanaPage {

@@ -66,6 +67,55 @@ ctx;

}
get advancedModeSwitch() {
return this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.stepAdvancedModeSwitch(QUERY_AND_EXPRESSION_STEP_ID));
}
async isAdvancedModeSupported() {
// why not check if alertingQueryAndExpressionsStepMode feature is enabled? then we'd have to update the code when the toggle is removed.
const count = await this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.stepAdvancedModeSwitch(QUERY_AND_EXPRESSION_STEP_ID)).count();
return count > 0;
}
/*
* Enables the advanced mode for the query and expression step.
* Only available in Grafana 11.6.0 and later. If advanced mode is not supported, this method will do nothing.
*/
async enableAdvancedQueryMode() {
const advancedModeSupported = await this.isAdvancedModeSupported();
if (!advancedModeSupported) {
console.log('Advanced query mode is not supported in this Grafana version. Ignoring the request.');
return;
}
await this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.stepAdvancedModeSwitch(QUERY_AND_EXPRESSION_STEP_ID)).check({ force: true });
}
/*
* Disabled the advanced mode for the query and expression step.
* Advanced mode is enabled by default in Grafana 11.6.0 and later.
*/
async disableAdvancedQueryMode() {
const advancedModeSupported = await this.isAdvancedModeSupported();
if (!advancedModeSupported) {
console.log('Advanced query mode is not supported in this Grafana version. Ignoring the request.');
return;
}
await this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.stepAdvancedModeSwitch(QUERY_AND_EXPRESSION_STEP_ID)).uncheck({ force: true });
}
async getQueryRow(refId = 'A') {
const advancedModeSupported = await this.isAdvancedModeSupported();
if (advancedModeSupported && !(await this.advancedModeSwitch.isChecked()) && refId === 'A') {
// return the default query row
return new AlertRuleQuery_1.AlertRuleQuery(this.ctx, this.ctx.page.getByTestId('query-editor-row'));
}
// return query by refId
const locator = this.getByGrafanaSelector(this.ctx.selectors.components.QueryEditorRows.rows).filter({
has: this.getByGrafanaSelector(this.ctx.selectors.components.QueryEditorRow.title(refId)),
});
return new AlertRuleQuery_1.AlertRuleQuery(this.ctx, locator);
}
/**
* Returns an instance of the {@link AlertRuleQuery} class for the query row with the provided refId.
* @deprecated Use getQueryRow instead
* Returns an instance of the {@link AlertRuleQuery} class for a query in the query and expression step (step 2)
*
* @param refId is optional. If not provided, it will return query row with refId 'A' in Grafana versions <11.6.
* In Grafana versions >=11.6 where advanced mode is supported, it will return the default query if advanced mode
* is not enabled. If advanced mode is enabled, it will return the a query by refId.
*/
getAlertRuleQueryRow(refId) {
getAlertRuleQueryRow(refId = 'A') {
const locator = this.getByGrafanaSelector(this.ctx.selectors.components.QueryEditorRows.rows).filter({

@@ -78,4 +128,10 @@ has: this.getByGrafanaSelector(this.ctx.selectors.components.QueryEditorRow.title(refId)),

* Clicks the "Add query" button and returns an instance of the {@link AlertRuleQuery} class for the new query row.
*
* Since Grafana 11.6, this method is only available if advanced mode is enabled. Use enableQueryAdvancedMode() method to enable it.
*/
async clickAddQueryRow() {
const advancedModeSupported = await this.isAdvancedModeSupported();
if (advancedModeSupported && !(await this.advancedModeSwitch.isChecked())) {
throw new Error('Since Grafana 11.6, you need to enable advanced mode to add queries. Use enableQueryAdvancedMode() method to enable it.');
}
await this.getByGrafanaSelector(this.ctx.selectors.components.QueryTab.addQuery).click();

@@ -82,0 +138,0 @@ const locator = this.getByGrafanaSelector(this.ctx.selectors.components.QueryEditorRows.rows).last();

4

package.json
{
"name": "@grafana/plugin-e2e",
"version": "1.17.1",
"version": "1.17.2-canary.1508.ee7f4b5.0",
"main": "./dist/index.js",

@@ -58,3 +58,3 @@ "types": "./dist/index.d.ts",

},
"gitHead": "eb261766bea8898f97d078b211338a8556e3985a"
"gitHead": "ee7f4b500cd53f157c893f689c103a680f9165bf"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc