Search code examples
automated-testse2e-testingtestcafebrowser-automationweb-testing

What is expected behavior when Testcafe clicks on a disabled button or type text into readonly input


What is the expected behavior of the Testcafe in those two cases:

  1. await t.click(Button with 'disabled` parameter)
  2. await t.typeText(Input with 'readonly' parameter)

Should Testcafe throw an error or just skip actions? Currently, in those cases, Testcafe just skips those steps and move forward.

I know that I can use something like

await t.expect(input.hasAttribute('readonly').notOk().typeText(input,'text');

It would be very helpful if Testcafe automatically does this verification.


Solution

  • Skipping actions with disabled/readonly elements is the expected behavior.

    I agree that in some scenarios it makes sense to verify that the target element is enabled and writable. However, actions with disabled/readonly elements are not technically invalid, and they may be intended in certain test cases.

    I have created an issue on GitHub for further discussion: https://github.com/DevExpress/testcafe/issues/4106.