Skip to content

Fix Capybara/TestidFinders cops

Miguel Rincon requested to merge 422558-mrincon-resolve-testid-exceptions into master

What does this MR do and why?

Fix most Capybara/TestidFinders cops that were left over after we merged !129664 (merged)

I used the following replacement patterns:

(?:page.)?within '\[data-testid="([a-z_-]+)"\]'
within_testid('$1')

(?:page.)?within\("\[data-testid='([a-z_-]+)'\]"\)
within_testid('$1')

(?:page.)?within\('\[data-testid="([a-z_-]+)"\]'\)
within_testid('$1')

(?:page.)?find\('\[data-testid="([a-z_-]+)"\]'\)
find_by_testid('$1')

(?:page.)?find\("\[data-testid='([a-z_-]+)'\]"\)
find_by_testid('$1')

Can't change our own cop code!

git checkout rubocop/ spec/rubocop

Screenshots or screen recordings

NA

How to set up and validate locally

A green pipeline 💚

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #422558 (closed)

Edited by Miguel Rincon

Merge request reports