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

Check on cy.check() for hidden input field type=radio when {force: true} #1376

Closed
pgroot91 opened this issue Feb 26, 2018 · 3 comments
Closed
Assignees
Milestone

Comments

@pgroot91
Copy link

pgroot91 commented Feb 26, 2018

  • Operating System: Windows 10
  • Cypress Version: 2.0.3
  • Browser Version: Chrome 64 (64bits) latest

Is this a Feature or Bug?

Bug[ish]>?

Current behavior:

The error message describes and advice you to use {force: true} but this doesn't seem to work the error keeps showing.

Not sure if i'm doing something wrong here?

Radio button with CSS property: visibility:hidden throwing a error

CypressError: cy.check() failed because this element is not visible:

This element '<input#buying-type-auction>' is not visible because it has CSS property: 'visibility: hidden'

Fix this problem, or use {force: true} to disable error checking.

https://on.cypress.io/element-cannot-be-interacted-with

<div class="buying-types">
      <input type="radio" id="buying-type-auction" name="buying_type" value="AUCTION">
      <label for="buying-type-auction" class="buying-type">
        <span>Auction</span>
        <small>Bid to reach your audience for the lowest possible price</small>
      </label>
      <input type="radio" id="buying-type-reserved" name="buying_type" value="RESERVED">
      <label for="buying-type-reserved" class="buying-type">
        <span>Reach and frequency</span>
        <small>Pay a fixed price to predictably reach your brand's audience</small>
      </label>
</div>
cy.get('input#buying-type-auction[name="buying_type"]', {force: true}).not('[disabled]')
    .check({force: true}).should('be.checked')

Desired behavior:

Skipping the error? or updating the information with correct information?

Anyway this solved my issue and not doing the check anymore.
cy.get('input[id="buying-type-auction"]:checked').not('[disabled]')
cy.get('input[id="buying-type-reserved"]:not(:checked)').not('[disabled]')

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Feb 26, 2018
@vedmant
Copy link

vedmant commented Sep 19, 2018

I have the same issue cy.get('[value=no-deposit]').check({force: true}) and it still complains that "CypressError: cy.check() failed because this element is not visible".

"cypress": "^3.1.0"

@guitassinari
Copy link

guitassinari commented Oct 11, 2018

I had the same problem and I investigated a bit.
It seems to me that the problem is right here

image

I am no expert in coffee script but, as far as I can tell, it looks like isNoop() checks if the action requested by the user (cy.check() or cy.uncheck()) is really needed (no need to check if the element is already checked, the same for uncheck).

The problem is that when isNoop() returns true it ensures visibility even when { force: true } is passed, which then throws an error.

I hope it helps solving the issue.

@jennifer-shehane jennifer-shehane added stage: ready for work The issue is reproducible and in scope and removed stage: needs investigating Someone from Cypress needs to look at this labels Nov 19, 2018
@jennifer-shehane jennifer-shehane changed the title [input] Check hidden input field type=radio {force: true} Check on cy.check() for hidden input field type=radio when {force: true} Nov 19, 2018
@lilaconlee lilaconlee added this to the Sprint 12 milestone Nov 26, 2018
@jennifer-shehane jennifer-shehane added stage: pending release and removed stage: ready for work The issue is reproducible and in scope labels Nov 27, 2018
@brian-mann
Copy link
Member

Released in 3.1.3.

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

6 participants