Skip to content

Commit

Permalink
test: Scroll the screen to make element visible in the viewport befor…
Browse files Browse the repository at this point in the history
…e clicking it in E2E (#3719)

Co-authored-by: kyle-ssg <[email protected]>
Co-authored-by: Matthew Elwell <[email protected]>
  • Loading branch information
3 people authored Apr 4, 2024
1 parent 8ad7f04 commit b8d0736
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/e2e/helpers.cafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ export type Rule = {
export const setText = async (selector: string, text: string) => {
logUsingLastSection(`Set text ${selector} : ${text}`)
if (text) {
return t
return t
.selectText(selector)
.pressKey('delete')
.selectText(selector) // Prevents issue where input tabs out of focus
.typeText(selector, `${text}`)
} else {
return t.selectText(selector) // Prevents issue where input tabs out of focus
return t
.selectText(selector) // Prevents issue where input tabs out of focus
.pressKey('delete')
}
}
Expand Down Expand Up @@ -80,6 +81,7 @@ export const gotoFeatures = async () => {
export const click = async (selector: string) => {
await waitForElementVisible(selector)
await t
.scrollIntoView(selector)
.expect(Selector(selector).hasAttribute('disabled'))
.notOk('ready for testing', { timeout: 5000 })
.hover(selector)
Expand Down

0 comments on commit b8d0736

Please sign in to comment.