vendredi 6 juillet 2018

Using jQuery in Capybara tests

I'd like to ask your opinion about using jQuery in Capybara specs. Is it really simulating the real user interaction, or is it faking it?

  • Is using find("#my_checkbox[value='1']").set(true)

    the same as page.execute_script("$('#my_checkbox').prop('checked', true);") ?

  • Or find("#my_button").click

    the same as page.execute_script("$('#my_button').click();") ?

I know that the spec result will be the same, but I'm really wondering:

  • the real user won't use the JS browser's console to click on a button, so should we just replicate that without using jQuery in the specs?
  • what about the spec's performance and speed? Is there any advantage on using jQuery?

Aucun commentaire:

Enregistrer un commentaire