Cypress should not allow selecting a disabled option within a disabled fieldset
See original GitHub issueCurrent 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)
<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>
cy.get('select')
.filter('#selectBox')
.select(3)
.find(':selected')
.should('contain', 0)
Versions
cy: 3.5 os: windows 10 browser: chrome 78
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to check disabled item in a <select> - cypress
Im trying to write a test that should check if an item in a is disabled. The item is visible, but not clickable,...
Read more ><fieldset>: The Field Set element - HTML - MDN Web Docs
Disabled fieldset This example shows a disabled <fieldset> with two controls inside it. Note how both the controls are disabled due to...
Read more >fix this problem, or use {force: true} to disable error checking.
We have decided not to implement this {force: true} option because there is no way to retrieve the value from selected disabled options...
Read more >How to Check if Your Buttons Are Disabled or Not In Cypress
To check if your buttons are disabled in Cypress or not, you can use the should('be.disabled') or should('not.be.enabled') assertions.
Read more >Cross Browser Compatibility of disabled attribute of the ...
Note: On Mozilla Firefox 95,disabled attribute of the fieldset element is Fully Supported. Let's say that if you plan to use this feature,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Released in
7.2.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v7.2.0, please open a new issue.