Show timeout in Capybara slow finder message

What does this MR do and why?

This MR improves the exception message of Capybara's slow finder and adds the timeout reached.

For example, Timeout (10s) reached while running a waiting Capybara finder..

Refs https://gitlab.com/gitlab-org/gitlab/-/jobs/3135376257#L2191

Closes #376696 (closed)

Before

  1) Identity Verification signing up verifying the code successfully confirms the user and shows the verification successful page
     Got 1 failure and 1 other error:

     1.1) Failure/Error:
            expect(page).to have_selector(
              "meta[http-equiv='refresh'][content='3; url=..#{users_sign_up_welcome_path}']", visible: :hidden
            )

            expected to find css "meta[http-equiv='refresh'][content='3; url=../users/sign_up/welcome']" but there were no matchesTimeout reached while running a waiting Capybara finder. Consider using a non-waiting finder.
            See https://www.cloudbees.com/blog/faster-rails-tests

After

  1) Identity Verification signing up verifying the code successfully confirms the user and shows the verification successful page
     Got 1 failure and 1 other error:

     1.1) Failure/Error:
            expect(page).to have_selector(
              "meta[http-equiv='refresh'][content='3; url=..#{users_sign_up_welcome_path}']", visible: :hidden
            )

            expected to find css "meta[http-equiv='refresh'][content='3; url=../users/sign_up/welcome']" but there were no matches

            Timeout (10s) reached while running a waiting Capybara finder.
            Consider using a non-waiting finder.

            See https://www.cloudbees.com/blog/faster-rails-tests

How to set up and validate locally

bin/rspec spec/support_specs/capybara_slow_finder_spec.rb

git checkout f33fd974d7faaf37c7cda45344ccf92cf9ce045c^ ee/spec/features/users/identity_verification_spec.rb

bin/rspec ee/spec/features/users/identity_verification_spec.rb

MR acceptance checklist

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

Edited by Peter Leitzen

Merge request reports

Loading