Skip to content

Commit

Permalink
handle annotations in older versions of Grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
sunker committed Dec 14, 2023
1 parent b281146 commit 3e5baa0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/plugin-e2e/src/models/AnnotationPage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Expect } from '@playwright/test';
import * as semver from 'semver';
import { PluginTestCtx } from '../types';
import { AnnotationEditPage } from './AnnotationEditPage';
import { GrafanaPage } from './GrafanaPage';
Expand All @@ -16,7 +17,12 @@ export class AnnotationPage extends GrafanaPage {

async clickAddNew() {
const { Dashboard } = this.ctx.selectors.pages;
await this.getByTestIdOrAriaLabel(Dashboard.Settings.Annotations.List.addAnnotationCTAV2).click();

if (semver.gte(this.ctx.grafanaVersion, '8.3.0')) {
await this.getByTestIdOrAriaLabel(Dashboard.Settings.Annotations.List.addAnnotationCTAV2).click();
} else {
await this.getByTestIdOrAriaLabel(Dashboard.Settings.Annotations.List.addAnnotationCTA).click();
}
return new AnnotationEditPage(this.ctx, this.expect);
}
}

0 comments on commit 3e5baa0

Please sign in to comment.