Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search tests are flaky #4383

Open
2 tasks
domoscargin opened this issue Dec 17, 2024 · 0 comments
Open
2 tasks

Search tests are flaky #4383

domoscargin opened this issue Dec 17, 2024 · 0 comments
Labels
javascript Pull requests that update Javascript code tech debt

Comments

@domoscargin
Copy link
Contributor

What

Several of our PRs have failed due to mismatched tracking event data.

This appears to be a timing issue - we're awaiting the input to be typed, but retrieving the Google Tag Manager data layer object seems to jump the gun here and there.

The tests which seems particularly affected are "it should track if there are no results" and "it should block personally identifable information emails"

Investigation so far

Quite a few people seem to having similar issues: puppeteer/puppeteer#1648

Fixes tried

Using puppeteer's waitForFunction

async function typeText($element, text, page) {
  await $element.focus()
  await $element.type(text)
  await page.waitForFunction(
    (input, typedText) => input.value === typedText,
    {},
    $element,
    text
  )
}

Looping through the characters in the text

  • focus input element
  • type char
  • check input is equal to partial string
  • repeat till value complete

Delaying assignment of GoogleTagManagerDataLayer

Set up a promise that would only resolve the data layer when input.value is equal to the typed text.

Who needs to work on this

Developer

Who needs to review this

Developer

Done when

  • We have isolated the timing quirk
  • We have a robust way to account for it
@domoscargin domoscargin added awaiting triage Needs triaging by team javascript Pull requests that update Javascript code tech debt and removed awaiting triage Needs triaging by team labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code tech debt
Projects
None yet
Development

No branches or pull requests

1 participant