mirror of
https://github.com/enso-org/enso.git
synced 2024-12-21 01:01:42 +03:00
736134e491
Fixes #11604 Most issues were caused by a problem with Project List flooding the network with its requests - this was fixed on develop. But one assertion was flaky - it assumed we will see the "real" run result on `write` node, but sometimes it is immediately overwritten by dry run. But the most important part of this PR is adding traces to Electron packages - it's should be much easier now to debug E2E test failures. Also renamed the previously misnamed "E2E tests" to "[GUI] integration tests".
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { expect as baseExpect, type Locator } from 'playwright/test'
|
|
|
|
export const expect = baseExpect.extend({
|
|
/**
|
|
* Ensures that at least one of the elements that the Locator points to,
|
|
* is an attached and visible DOM node.
|
|
*/
|
|
async toExist(locator: Locator) {
|
|
// Counter-intuitive, but correct:
|
|
// https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-be-visible
|
|
const assertionName = 'toExist'
|
|
let pass: boolean
|
|
try {
|
|
await expect(locator.first()).toBeVisible()
|
|
pass = true
|
|
} catch {
|
|
pass = false
|
|
}
|
|
|
|
const message = () =>
|
|
this.utils.matcherHint(assertionName, locator, '', {
|
|
isNot: this.isNot,
|
|
})
|
|
|
|
return {
|
|
message,
|
|
pass,
|
|
name: assertionName,
|
|
}
|
|
},
|
|
|
|
async toBeSelected(locator: Locator) {
|
|
const assertionName = 'toBeSelected'
|
|
let pass: boolean
|
|
try {
|
|
await baseExpect(locator).toHaveClass(/(?<=^| )selected(?=$| )/, { timeout: 50 })
|
|
pass = true
|
|
} catch {
|
|
// Do not log the error.
|
|
pass = false
|
|
}
|
|
|
|
const message = () =>
|
|
this.utils.matcherHint(assertionName, locator, '', {
|
|
isNot: this.isNot,
|
|
})
|
|
|
|
return {
|
|
message,
|
|
pass,
|
|
name: assertionName,
|
|
}
|
|
},
|
|
})
|