Skip to content

Commit

Permalink
fix(deps): update dependency @grafana/e2e-selectors to ^11.5.0-218582 (
Browse files Browse the repository at this point in the history
…#1469)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Erik Sundell <[email protected]>
  • Loading branch information
renovate[bot] and sunker authored Jan 24, 2025
1 parent 657f4dd commit ac2fab7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/plugin-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dotenv": "^16.4.7"
},
"dependencies": {
"@grafana/e2e-selectors": "^11.5.0-216908",
"@grafana/e2e-selectors": "^11.5.0-218582",
"semver": "^7.5.4",
"uuid": "^11.0.2",
"yaml": "^2.3.4"
Expand Down
18 changes: 14 additions & 4 deletions packages/plugin-e2e/src/models/components/DataSourcePicker.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import * as semver from 'semver';
import { Locator } from '@playwright/test';
import { PluginTestCtx } from '../../types';
import { GrafanaPage } from '../pages/GrafanaPage';

export class DataSourcePicker extends GrafanaPage {
constructor(ctx: PluginTestCtx, private root?: Locator) {
constructor(
ctx: PluginTestCtx,
private root?: Locator
) {
super(ctx);
}

/**
* Sets the data source picker to the provided name
*/
async set(name: string) {
await this.getByGrafanaSelector(this.ctx.selectors.components.DataSourcePicker.container, { root: this.root })
.locator('input')
.fill(name);
let datasourcePicker = this.ctx.page.getByTestId(this.ctx.selectors.components.DataSourcePicker.inputV2);

if (semver.lt(this.ctx.grafanaVersion, '10.1.0')) {
datasourcePicker = this.getByGrafanaSelector(this.ctx.selectors.components.DataSourcePicker.container, {
root: this.root,
}).locator('input');
}

await datasourcePicker.fill(name);

// this is a hack to get the selection to work in 10.ish versions of Grafana.
// TODO: investigate if the select component can somehow be refactored so that its easier to test with playwright
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ test.describe('Test new alert rules', () => {
alertRuleEditPage,
selectors,
readProvisionedDataSource,
page,
}) => {
test.skip(semver.lt(grafanaVersion, '9.5.0'), skipMsg);
const { rows } = selectors.components.QueryEditorRows;
const ds = await readProvisionedDataSource({ fileName: 'testdatasource.yaml' });
const queryA = alertRuleEditPage.getAlertRuleQueryRow('A');
await queryA.datasource.set(ds.name);
const rowCount = await alertRuleEditPage.getByGrafanaSelector(rows).count();
semver.gte(grafanaVersion, '11.5.0') && (await page.getByLabel('Advanced options').nth(1).check());
await alertRuleEditPage.clickAddQueryRow();
await expect(alertRuleEditPage.getByGrafanaSelector(rows)).toHaveCount(rowCount + 1);
await alertRuleEditPage.clickAddQueryRow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ test('select timezone in timezone picker', async ({ gotoPanelEditPage, grafanaVe
});

test('collapse expanded options group', async ({ gotoPanelEditPage }) => {
const panelEdit = await gotoPanelEditPage({ dashboard: { uid: 'eda84f4d-0b3c-4e4d-815d-7fcb9aa702c2' }, id: '1' });
const panelEdit = await gotoPanelEditPage({ dashboard: { uid: 'be6sir7o1iccgb' }, id: '1' });
const dataLinksOptions = panelEdit.getCustomOptions('Data links');

expect(await dataLinksOptions.isExpanded()).toBeTruthy();
Expand All @@ -150,7 +150,7 @@ test('collapse expanded options group', async ({ gotoPanelEditPage }) => {
});

test('expand collapsed options group', async ({ gotoPanelEditPage }) => {
const panelEdit = await gotoPanelEditPage({ dashboard: { uid: 'eda84f4d-0b3c-4e4d-815d-7fcb9aa702c2' }, id: '1' });
const panelEdit = await gotoPanelEditPage({ dashboard: { uid: 'be6sir7o1iccgb' }, id: '1' });
const dataLinksOptions = panelEdit.getCustomOptions('Data links');

expect(await dataLinksOptions.isExpanded()).toBeTruthy();
Expand Down

0 comments on commit ac2fab7

Please sign in to comment.