Allow {force: true} option to disable error checking on select & select options
See original GitHub issueAllow {force: true}
to be passed to cy.select
(just as type & check commands), that disables error checking so that you can “select” a disabled select or option.
Example Code
index.html
<html>
<body>
<select id="disabled-select" disabled>
<option value="456">apples</option>
<option value="457">oranges</option>
<option value="458">bananas</option>
</select>
<select id="disabled-option">
<option value="456">apples</option>
<option value="457" disabled>oranges</option>
<option value="458">bananas</option>
</select>
</body>
</html>
spec.js
it('test disabled select', () => {
cy.visit('index.html')
cy.get('#disabled-select').select('oranges')
})
it('test disabled option', () => {
cy.visit('index.html')
cy.get('#disabled-option').select('oranges')
})
Issue Analytics
- State:
- Created 8 years ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Make {force:true} in click() function the default behavior
I am keep getting this visibility error (This element ''is not visible because its parent...) when trying to click links/buttons using the click( ......
Read more >fix this problem, or use {force: true} to disable error checking.
Since your element is covered by another element, you can use click({force: true}) , to disable the error checking and perform the click....
Read more >Allow {force: true} option to disable error checking on select & select ...
Allow {force: true} to be passed to cy.select (just as type & check commands), that disables error checking so that you can "select"...
Read more >select - Cypress Documentation
Passing { force: true } to .select() will override the actionability checks for selecting a disabled <select> . However, it will not override...
Read more >Usage Documentation - Tom Select
Or more exactly, the list of the values of the selected options. ... Setting closeAfterSelect to true will force the dropdown to close...
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 FreeTop 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
Top GitHub Comments
We have decided not to implement this
{force: true}
option because there is no way to retrieve the value from selected disabled options (due to the nature of jQuery’s.val
). Therefore, this would prevent verifying the actual values of the selected options and cause common assertions such ascy.select('foo', {force: true}).invoke('val').should('eq', 'foo')
to fail.would love to see this happen ❤️