enso/app/gui2/e2e/customExpect.ts
Adam Obuchowicz c69ba4ee70
Fix area select regression (#9197)
Fixes #9182

Now we are careful when to handle events - before or after updating intersected set.

Added general E2E and detailed unit tests for selecting.

Also discovered, that sometimes the test are running while nodes are not yet in right positions. Added an instruction ensuring the position is right.
2024-02-28 13:14:48 +00:00

20 lines
661 B
TypeScript

import { expect, type Locator } from 'playwright/test'
/** Ensures that at least one of the elements that the Locator points to,
* is an attached and visible DOM node. */
export function toExist(locator: Locator) {
// Counter-intuitive, but correct:
// https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-be-visible
return expect(locator.first()).toBeVisible()
}
export function toBeSelected(locator: Locator) {
return expect(locator).toHaveClass(/(?<=^| )selected(?=$| )/)
}
export module not {
export function toBeSelected(locator: Locator) {
return expect(locator).not.toHaveClass(/(?<=^| )selected(?=$| )/)
}
}