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

Ace editor (cloud 9) fails cy.type() with element is covered #1818

Closed
harshithmullapudi opened this issue May 30, 2018 · 11 comments
Closed

Ace editor (cloud 9) fails cy.type() with element is covered #1818

harshithmullapudi opened this issue May 30, 2018 · 11 comments

Comments

@harshithmullapudi
Copy link

harshithmullapudi commented May 30, 2018

Is this a Feature or Bug?

Cannot type in textarea using Cypress.

Current behavior:

As it has cover of div elements cypress gives an error.

Desired behavior:

Cypress should be able to type in the ace editor

screenshot_20180530_145628
This is the error that occurs if we use textarea with cypress type

@harshithmullapudi

This comment has been minimized.

@jennifer-shehane
Copy link
Member

You are using https://ace.c9.io/? Could you reproduce this issue, maybe trying to type on their example site, so that we have a reproducible example?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label May 30, 2018
@harshithmullapudi
Copy link
Author

harshithmullapudi commented May 30, 2018

Yeah I have tried the same in website ( https://ace.c9.io/ ) and encountered the same problem
Tried to type in textarea using the class of text area which is '.ace_text-input'

cy.get(".ace_text-input").first().type("#include")

And the cypress error is
screenshot_20180530_152637

@jennifer-shehane jennifer-shehane added stage: needs investigating Someone from Cypress needs to look at this and removed stage: needs information Not enough info to reproduce the issue labels May 30, 2018
@kartikupreti
Copy link

kartikupreti commented Jun 5, 2018

yeah even I faced the same issue, but since I have it only in one text box I worked around as below-

cy
  .window()
  .its('myjs.path.expressionEditor' as any)
  .invoke('value', 'text to be entered');

Hope it helps you

@kuceb
Copy link
Contributor

kuceb commented Jun 29, 2018

this seems like a visibility bug, so I'm removing this from the cy.type() improvements epic.

@ronlawrence3
Copy link

ronlawrence3 commented Jul 11, 2018

I had the thought to use cy.focused() to work around this issue...

Clicking on the ace editor, while this focuses the input in the real browser, seems to have no impact in cypress.

So, I tried having my application expose a button to programmatically bring up the editor's search dialog. Then I made cypress close it, which left the editor focused. then I used cy.focused() to type.
This worked great, but only in chrome or electron, not in headless.
Unfortunately, this will cause a failure in our CI system, so will not work.

Any other ideas for a workaround? I'm not sure how to use the window workaround above...

@jhoobergs
Copy link

jhoobergs commented Jul 18, 2018

It works fine by using {force: true} on the type command.

@kuceb
Copy link
Contributor

kuceb commented Jul 18, 2018

@ronlawrence3 I'll look into the failure in headless, it's probably a window focus issue

@jennifer-shehane jennifer-shehane changed the title Data testing on Ace editor on .type() says failed element is not visible, but el is visible Jun 11, 2019
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jun 11, 2019

This one is tricky. It actually is being covered by the other element,

it('should type in input', function () {
  cy.visit('https://ace.c9.io/build/kitchen-sink.html')
  cy.get(".ace_text-input").first().focus().type("foo bar")
})

ace editor also has some fun focus logic of their own

    var focusEditor = function(e) {
        var windowBlurred = !document.hasFocus || !document.hasFocus()
            || !editor.isFocused() && document.activeElement == (editor.textInput && editor.textInput.getElement());
        if (windowBlurred)
            window.focus();
        editor.focus();
    };

@debel27
Copy link

debel27 commented Aug 21, 2019

This one is tricky. It actually is being covered by the other element,

it('should type in input', function () {
  cy.visit('https://ace.c9.io/build/kitchen-sink.html')
  cy.get(".ace_text-input").first().focus().type("foo bar")
})

It works perfectly for me! Thanks, I was banging my head against the wall with this

@kuceb kuceb changed the title on .type() says failed element is not visible, but el is visible Ace editor (cloud 9) fails cy.type() with element is covered Aug 29, 2019
@kuceb
Copy link
Contributor

kuceb commented Aug 29, 2019

closing this since it's not a visibility bug, and has a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants