-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cypress tells Input is disabled, but it isn't, while typing #5827
Comments
Hey @mszkudelski, I eventually got this to fail on a run within Chrome in Cypress 3.6.1 during I was not able to replicate this in 3.7.0 (but it's difficult since it's intermittent and I have to reun many times), can you confirm if you have seen this error in 3.7.0? |
I have the same problem with an input field in version 3.7.0 when running tests with cypress run, with cypress open it works |
Hi @jennifer-shehane, I'm sorry for mistake, but in reproduction project I use 3.7.0 version of Cypress. So bug appears in version 3.6.1 (in my real project) and 3.7.0 (in repro project). |
Hi, |
Same with 3.8.1, seems to be random. |
After investigation, I think I have found the reason that causes this error. When Cypress wishes to type into an input, it scrolls first to it. To be sure, I tried to delete this sticky header and then restart my tests. |
Just tacking onto this if anybody experiences this from the cypress ui - I found that, for whatever reason, if I disable/enable the auto scrolling toggle, it will successfully run. I have to do this each time I re-run a test :/ but it's getting me through! |
@jennifer-shehane I am seeing this frustratingly frequently when working with long iframes. Is there a potential targeted release for this defect? Thanks in advance |
Can you please share the code you used to delete the header? |
It looks like this:
|
Thank you very much however this is not resolving the issue for me. I shall await Cypress releasing a fix version for this issue |
The workaround mentioned by @scridget in #5827 (comment) worked for me too. |
I have the same issue now. Cypress v4.5.0 is installed in my project and the same error with input typing test case occurs. I'm looking forward to the fixed version. 😄 |
I got it solved on Cypress V4.5.0 by adding a .focus() before typing. |
I have the same issue with cypress 4.7.0. The |
{ force: true } worked for me, thanks! |
I have bypassed type and I am instead using invoke("text") with args to set the text of the text box as opposed to type. It is a workaround on text boxes that I find to be continually problematic |
Encountered this same issue with Cypress 4.11.0. |
The cause of the problem is that the app is not fully loaded. One of the workaround is to use |
Just experienced this in 5.1.0 :( Working around it with .focus().type() UPDATE: It still happens intermittently :( |
Hey, i was having same issue for me this worked -> |
If this is a Cypress issue, I think it's quite bothersome. The issue stays alive over multiple cypress versions already. |
I encouter this issue frequently in inputs inside of an open shadow dom. |
I am using the 5.4.0 version, I had the same issue when I tried to emulate the device iPhone x etc, the workaround mentioned by @Saharshdeep is worked for me. |
I made a work around for this problem, this problem mostly seems to happen when you try to type into an input box right after typing in some other input box cy.get("firstInputSelector").type("My First Input text");
cy.get("someHeaderSelector").clear({ force: true }); // A force click somewhere outside the form
cy.wait(200);
cy.get("secondInputSelector").type("My Second Input text"); This solution works smoothly for me and the tests don't break intermittently. |
I was facing this exact issue. What I did is here - cy.get('input[name="password"]').click()
cy.get('input[name="password"]').type(password) This works totally fine. |
Email TextBox is hidden, also its parent is hidden than it worked for me. cy.get(":nth-child(2) > :nth-child(1) > :nth-child(1) > .cognito-asf > :nth-child(3) > #signInFormUsername").should('be.visible').click({force:true});
cy.get(":nth-child(2) > :nth-child(1) > :nth-child(1) > .cognito-asf > :nth-child(3) > #signInFormUsername").type(this.data.Email); |
There has been one reproducible example given in this issue: https://github.com/mszkudelski/cypress-bug-repro. That issue is due to the timing when loading the page. When the input is attempted to be typed into - the element is disabled. If you throw a debugger right were we check the disabled attribute - you can see the element is not finished rendering to the page. This is not an issue with Cypress that we can solve on our side. Cypress has no way of knowing whether the page is fully loaded - intended for a user to type or not. If you have an issue that you think falls outside of this example, please provide a reproducible example so that we can evaluate and see whether there is a bug with Cypress falsely attributing an input as disabled at the time of the action. At the moment, this will be closed as 'wontfix' from the example provided. it('test ', function () {
cy.visit('https://app.bas24.pl/');
cy.location('href').should('contain', 'app.bas24.pl');
cy.get('input[name="username"]')
.type('a').should('have.value', 'a')
}); RecommendationSo, some ways to test this are to:
cy.get('input[name="username"]')
.should('not.be.disabled')
.type('asdasddd')
cy.get('input[name="username"]')
.should('not.be.disabled')
.type('asdasddd', { force: true })
|
worked for me! Thanks! |
@jennifer-shehane Is this something where I can submit a bug repo? |
I Solved the issue with adding
|
This issue is still present in 13.7.3..The element is clearly not disabled but when typing on it it says the element is disabled. |
I am also running into this in Cypress 13.9.0. Tl;dr: The solution for me was to add waits before the type call, since my React app was still re-rendering and Cypress wasn't waiting for it. Ironically, I tried calling
This error is even more frustrating because Cypress is showing me that the element does not have the In my case, it appears to be because my React app is re-rendering and Cypress gets lost in the mix somewhere. At no point during my render is that input disabled, but if I include hard waits to ensure that the page is done rendering, it passes. Given Cypress's emphasis on not needing to explicitly wait for things, this is not what I expected to have to do. |
Current behavior:
I'd like to test login page on Ionic (v3) website. But when I invoke method
.type
there appears error:Error does not occurs always. Test fails is about 20-25% runs. Analysing Cypress' source code I realized that it can behave that way because Input is not focused. I was looking at file: https://github.com/cypress-io/cypress/blob/70ef58bede981567732697c8b79fe7642ab164cf/packages/driver/src/cy/commands/actions/type.js from 407 line.
So I added method
.focus
before.type
. But then I am given another error:which means that not every character was typed into input (propably every, but not second)
Desired behavior:
I assume that I have done everything right, and there is no problem with my website, so expected result would be not to got any error using method
.type
. Otherwise, please tell if I'm doing anything incorrectSteps to reproduce: (app code and test code)
Here is reproduction project that test my application:
https://github.com/mszkudelski/cypress-bug-repro
You can use npm script or use my bash
script.sh
that runs spec 20 times and log result inlog.txt
file.Versions
Cypress: 3.6.1,
operating system: MacOs 10.15.1
browser: Electron headless and Chrome
The text was updated successfully, but these errors were encountered: