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 should not allow selecting a disabled option within a disabled fieldset #5951
Comments
I see that you are using an older version of Cypress. Before I dive in to completely recreate the issue, could you update to the current version of Cypress and let me know if this is still happening for you? Your issue may have already been fixed. Thanks! |
I have tested this with version 3.8.0 downloaded this morning and the issue is still there. |
@SSmale Please provide the pure html + css + js to reproduce this. The below code does not produce the behavior you are saying. We'll have to close the issue without a way to run this.
<!DOCTYPE html>
<html>
<body>
<fieldset _ngcontent-c15="" class="nopadding" disabled="">
<div _ngcontent-c15="" class="form-group">
<label _ngcontent-c15="" for="selectBox">Test Select</label>
<select _ngcontent-c15="" class="form-control ng-valid ng-untouched ng-pristine" formcontrolname="selectBox"
id="selectBox" ng-reflect-name="selectBox">
<option _ngcontent-c15="" disabled="true" value="0: undefined" hidden="">
Select Version
</option>
<option _ngcontent-c15="" value="1" ng-reflect-value="1">1</option>
<option _ngcontent-c15="" value="2" ng-reflect-value="2">2</option>
<option _ngcontent-c15="" value="3" ng-reflect-value="3">3</option>
<option _ngcontent-c15="" value="4" ng-reflect-value="4">4</option>
<option _ngcontent-c15="" value="5" ng-reflect-value="5">5</option>
<option _ngcontent-c15="" value="6" ng-reflect-value="6">6</option>
<option _ngcontent-c15="" value="7" ng-reflect-value="7">7</option>
<option _ngcontent-c15="" value="8" ng-reflect-value="8">8</option>
<option _ngcontent-c15="" value="9" ng-reflect-value="9">9</option>
<option _ngcontent-c15="" value="10" ng-reflect-value="10">10</option>
</select>
</div>
</fieldset>
</body>
</html> it('selects', function () {
cy.visit('index.html')
cy.get('select')
.filter('#selectBox')
.select(3)
.find(':selected')
.should('contain', 0)
}) |
the select should be a string not a number |
I can recreate this. This likely has to do with us not considering a fieldset that is disabled - that it will disable all selects within it. it('selects', () => {
cy.visit('index.html')
cy.get('select').find(':selected').should('contain', 1)
cy.get('select').select('3').find(':selected').should('contain', 1)
}) <html>
<body>
<fieldset disabled="">
<select>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</fieldset>
</body>
</html> |
The code for this is done in cypress-io/cypress#15682, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
If you disable a form group it is still possible to change the value of a select input inside
Desired behavior:
the select input is disabled so should error telling you it is unchangeable, similar to the not visible error
Steps to reproduce: (app code and test code)
Versions
cy: 3.5
os: windows 10
browser: chrome 78
The text was updated successfully, but these errors were encountered: