Skip to content

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

Thong Kuah requested to merge optimise_incident_issue_spec into master

What does this MR do and why?

The find_all capybara selector by default waits for 30 seconds.

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

We already confirmed/waited that we are on the right page on previous step (have_content). So if we wait the default capybara wait time, it's wasted.

Before:

$ bin/rspec-stackprof --speedscope true spec/features/issues/incident_issue_spec.rb:37
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"=>[37]}}

Test environment set up in 7.650337 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-81757-ukwr4k
.

Finished in 1 minute 25.4 seconds (files took 8.36 seconds to load)
1 example, 0 failures

After:

$ bin/rspec spec/features/issues/incident_issue_spec.rb:37
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"=>[37]}}

Test environment set up in 7.289042 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-82964-aiyimi
.

Finished in 22.23 seconds (files took 9.42 seconds to load)
1 example, 0 failures

Related issue: #375004 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

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.

Merge request reports