oncall-engine/grafana-plugin/e2e-tests/utils/modals.ts
Joey Orlando 9c0bc26680
Fix daily e2e tests GitHub Actions cron job (#3923)
# What this PR does

- fixes our e2e tests to work on all tested versions
- updates Grafana versions that we run the daily e2e tests against (bump
`10.0.2` to `10.0.11` + add `10.1.7` tags)
- updates the Slack status message format + change channel from
#irm-amixr-flux to #gops-oncall-dev

<img width="1479" alt="Screenshot 2024-02-24 at 08 30 06"
src="https://github.com/grafana/oncall/assets/9406895/f5cb91f8-12ce-4978-9c37-c72ee8a01e4b">


## NOTE
It looks like we have some e2e tests that fail under the following
circumstances:
- on Firefox or WebKit
- on Grafana 10.2 and 10.3 (once we fix these, we should [update our e2e
tests that run on all PR
builds](https://github.com/grafana/oncall/blob/dev/.github/workflows/linting-and-tests.yml#L325)
to run against `10.3.3` which is the current latest major version
available)

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2024-02-27 09:21:53 -05:00

17 lines
717 B
TypeScript

import { Page } from '@playwright/test';
/**
* in Grafana v9 the aria-label is "Close dialog"
* in Grafana v10.0 the aria-label is "Close dialogue"
* in Grafana v10.1 the aria-label is "Close"
* 🙄
*
* https://playwright.dev/docs/other-locators#css-elements-matching-one-of-the-conditions
*/
const POSSIBLE_CLOSE_MODAL_BUTTON_DIALOGUE_ARIA_LABELS = ['Close dialog', 'Close dialogue', 'Close'];
const CLOSE_MODAL_BUTTON_ARIA_LABEL_SELECTOR = POSSIBLE_CLOSE_MODAL_BUTTON_DIALOGUE_ARIA_LABELS.map(
(ariaLabel) => `button[aria-label="${ariaLabel}"]`
).join(', ');
export const closeModal = async (page: Page): Promise<void> =>
(await page.waitForSelector(CLOSE_MODAL_BUTTON_ARIA_LABEL_SELECTOR))?.click();