question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version 102 of Firefox causes flaky tests when using `cy.type()` (only headless)

See original GitHub issue

Current behavior

If I’m running some of our tests in headless mode (or simply it’s running in our pipeline) Firefox 102 causes the following error when I use cy.type() even though the element is not disabled and it has no issue inside Chrome:

 1) Adding new Something
       should create a new something:
     CypressError: `cy.type()` failed because it targeted a disabled element.

The element typed into was:

  > <input matinput="" class="mat-input-element mat-form-field-autofill-control ng-pristine ng-invalid cdk-text-field-autofill-monitored ng-star-inserted ng-touched" ng-reflect-id="formly_1_input_name_0" type="text" ng-reflect-type="text" ng-reflect-required="true" ng-reflect-error-state-matcher="[object Object]" ng-reflect-form="[object Object]" ng-reflect-field="[object Object]" tabindex="0" ng-reflect-placeholder="name" data-testid="somethingNameInput" id="formly_1_input_name_0" required="" data-placeholder="name" aria-required="true" aria-describedby="mat-error-0">

Ensure the element does not have an attribute named `disabled` before typing into it.

https://on.cypress.io/type
  ../driver/src/cy/commands/actions/type.ts/__webpack_exports__.default/type/handleFocused/onReady/<@https://localhost:8080/__cypress/runner/cypress_runner.js:152266:86
  tryCatcher@https://localhost:8080/__cypress/runner/cypress_runner.js:13012:23
  ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromiseFromHandler@https://localhost:8080/__cypress/runner/cypress_runner.js:10947:31
  ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise@https://localhost:8080/__cypress/runner/cypress_runner.js:11004:18
  ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise0@https://localhost:8080/__cypress/runner/cypress_runner.js:11049:10
  ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromises@https://localhost:8080/__cypress/runner/cypress_runner.js:11129:18
  _drainQueueStep@https://localhost:8080/__cypress/runner/cypress_runner.js:7719:12
  _drainQueue@https://localhost:8080/__cypress/runner/cypress_runner.js:7712:24
  ../../node_modules/bluebird/js/release/async.js/</Async.prototype._drainQueues@https://localhost:8080/__cypress/runner/cypress_runner.js:7728:16
  ../../node_modules/bluebird/js/release/async.js/</Async/this.drainQueues@https://localhost:8080/__cypress/runner/cypress_runner.js:7598:14
  From Your Spec Code:
      shouldFn@https://localhost:8080/__cypress/runner/cypress_runner.js:152956:18
      should@https://localhost:8080/__cypress/runner/cypress_runner.js:153074:23
      ../driver/src/cy/assertions.ts/create/injectAssertion/<@https://localhost:8080/__cypress/runner/cypress_runner.js:148027:39
      assertions@https://localhost:8080/__cypress/runner/cypress_runner.js:148391:16
      tryCatcher@https://localhost:8080/__cypress/runner/cypress_runner.js:13012:23
      gotValue@https://localhost:8080/__cypress/runner/cypress_runner.js:12156:18
      gotAccum@https://localhost:8080/__cypress/runner/cypress_runner.js:12143:25
      tryCatcher@https://localhost:8080/__cypress/runner/cypress_runner.js:13012:23
      ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromiseFromHandler@https://localhost:8080/__cypress/runner/cypress_runner.js:10947:31
      ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise@https://localhost:8080/__cypress/runner/cypress_runner.js:11004:18
      ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromiseCtx@https://localhost:8080/__cypress/runner/cypress_runner.js:11041:10
      _drainQueueStep@https://localhost:8080/__cypress/runner/cypress_runner.js:7723:12
      _drainQueue@https://localhost:8080/__cypress/runner/cypress_runner.js:7712:24
      ../../node_modules/bluebird/js/release/async.js/</Async.prototype._drainQueues@https://localhost:8080/__cypress/runner/cypress_runner.js:7728:16
      ../../node_modules/bluebird/js/release/async.js/</Async/this.drainQueues@https://localhost:8080/__cypress/runner/cypress_runner.js:7598:14

First, it happened in 9.6.0 then I upgraded to 10.3.0, but it was still the same issue and then I tried to run the exact same test with Firefox 101 and then it was successful.

One more thing that could be useful is that we are using angular with nx and I discovered that this issue (probably only) happens when we use Formly. If I’m running it in the browser with npx cypress open then it runs correctly.

Desired behavior

It should be able to type into a field using Firefox 102 without any issue just like in chrome.

Test code to reproduce

I’ll try my best to reproduce this issue in a different repo very soon. Edit: https://github.com/ducktordanny/cypress-firefox-flakiness

Cypress Version

10.3.0

Other

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
tbiethmancommented, Jul 25, 2022

@jpveooys @ducktordanny thank you both for the example reproductions. I pulled these down and confirmed your findings. It’s pretty obvious there’s something going wrong here.

2reactions
naomi-lgbtcommented, Jul 13, 2022

We’re facing a similar issue over at freeCodeCamp - the rollout of Firefox 102 seems to cause a couple of our tests to fail but only in headless mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests fail in headless chrome and firefox but pass in ... - GitHub
Current behavior: When I run a specific test in headless in either chrome 81 ... but when I run the same test headless...
Read more >
cy.type() failed because it targeted a disabled element
Timed out retrying: cy.type() failed because this element is not visible. has ... of Firefox causes flaky tests when using `cy.type()` (only headless)#22760....
Read more >
Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where urls within SASS/SCSS files were not being correctly resolved which could result in incomplete styling....
Read more >
Cypress Best Practices For Test Automation - LambdaTest
To sign in programmatically, we need to use another Cypress command called Cypress request cy.request(). The method makes HTTP requests ...
Read more >
Reactjs cypress on firefox: Error: Could not find url target in ...
But, I can use Firefox nightly. script "test:e2e:firefox": "npx cypress run --headless --browser firefox:nightly",.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found