Skip to content

Don't need to wait for find_all to assert we have zero items

Thong Kuah requested to merge optimize_waiting_capybara_find_all into master

What does this MR do and why?

We already wait_for_requests previously, so we don't need to waste 30 seconds waiting for something that won't ever appear

Screenshots or screen recordings

Before:

$ bundle exec rspec spec/features/issues/incident_issue_spec.rb:91
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true, :locations=>{"./spec/features/issues/incident_issue_spec.rb"=>[91]}}

Test environment set up in 7.384104 seconds
Starting the Capybara driver server...
Capybara starting Puma...
* Version 5.6.5 , codename: Birdie's Version
* Min threads: 0, max threads: 4
* Listening on unix:///var/folders/gr/1dm_jlrd4g9_724jr3dmrrtm0000gn/T/20220922-94815-14iuv6i
.

Finished in 56.85 seconds (files took 7.78 seconds to load)
1 example, 0 failures

[TEST PROF INFO] Time spent in factories: 00:01.110 (1.93% of total time)
Failed to write to log, write log/workhorse-test.log: file already closed

After:

$ bundle exec rspec spec/features/issues/incident_issue_spec.rb:91
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true, :locations=>{"./spec/features/issues/incident_issue_spec.rb"=>[91]}}

Test environment set up in 8.462516 seconds
Starting the Capybara driver server...
Capybara starting Puma...
* Version 5.6.5 , codename: Birdie's Version
* Min threads: 0, max threads: 4
* Listening on unix:///var/folders/gr/1dm_jlrd4g9_724jr3dmrrtm0000gn/T/20220922-94645-mx7fnx
.

Finished in 27.57 seconds (files took 7.93 seconds to load)
1 example, 0 failures

[TEST PROF INFO] Time spent in factories: 00:01.110 (3.92% of total time)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Thong Kuah

Merge request reports