Using force: true
on inputs appears to be confusing rather than helpful.
It usually silences the actual problem instead of providing a way to overcome it.
See Cypress Core Concepts.
If enabling this rule, it's recommended to set the severity to warn
.
This rule disallows using the force
option on:.click()
,
.dblclick()
, .type()
,
.rightclick()
, .select()
,
.focus()
, .check()
,
and .trigger()
.
Examples of incorrect code for this rule:
cy.get('button').click({force: true})
cy.get('button').dblclick({force: true})
cy.get('input').type('somth', {force: true})
cy.get('div').find('.foo').find('.bar').trigger('change', {force: true})
cy.get('input').trigger('click', {force: true})
cy.get('input').rightclick({force: true})
cy.get('input').check({force: true})
cy.get('input').select({force: true})
cy.get('input').focus({force: true})
Examples of correct code for this rule:
cy.get('button').click()
cy.get('button').click({multiple: true})
cy.get('button').dblclick()
cy.get('input').type('somth')
cy.get('input').trigger('click', {anyoption: true})
cy.get('input').rightclick({anyoption: true})
cy.get('input').check()
cy.get('input').select()
cy.get('input').focus()
If you don't mind using { force: true }
with action commands, then turn this rule off.