enso/app/gui2/e2e/customExpect.ts
Adam Obuchowicz 1a8b82e237
Another set of small fixes (#8946)
* `Enter` key accepts the edit in Numeric and Text input
* Newly added node are selected
* Placement of new nodes takes opened visualizations into account.

[Screencast from 2024-02-02 13-02-26.webm](https://github.com/enso-org/enso/assets/3919101/0f328824-1cbc-4b07-988e-dbf17b94dc2f)
2024-02-02 18:11:28 +01:00

14 lines
513 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(?=$| )/)
}