Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Flaky end-to-end tests/timing issues #162

Closed
textbook opened this issue Jul 19, 2019 · 6 comments
Closed

Flaky end-to-end tests/timing issues #162

textbook opened this issue Jul 19, 2019 · 6 comments
Assignees

Comments

@textbook
Copy link
Contributor

While trying to upgrade the Node deps that cause audit warnings (foundation-sites, react-scripts* and serve), I hit some issues with what seem to be timings in the E2E tests, e.g.:

  1) Felicity Journey
     Failure/Error: expect(page).to have_content('The board will be cleared ready for your next retro and incomplete action items will be carried across.')
       expected to find text "The board will be cleared ready for your next retro and incomplete action items will be carried across." in "My Retro\nMENU\n0\nthis is the first item\n0\nYour team can add happy, meh or sad items to these columns. Why don't you try adding one now?\n0\nSelect an item to start a discussion. You\u2019ll notice a 5 minute timer, so be sure to keep the conversation on track.\n0\nWhen you've addressed the item, mark it as \"Done\".\n0\nthis is the last item\n0\nHave you addressed all retro items?\n0\nIf so, it's time to archive the board. You\u2019ll find the Archive button in the menu.\nAction items\nToday (July 19)\nAdd action items with a single owner (Owner\u2019s Name)\nTick off action items when complete (Owner's Name)\nOlder\nContact Us\nTerms & Conditions\nPrivacy Policy"

Adding a sleep seemed to improve things, which is why I thought it was a timing problem, but putting in explicit sleeps is a bit of an anti-pattern; we want to avoid things like this:

  def mark_all_retro_items_as_done
    sleep(0.3)
    find_all('div.retro-item').each do |retro_item|
      retro_item.click
      sleep(0.3)
      retro_item.find('.item-done').click
    end
  end

This is a tracking issue to give a place to report flaky tests (as Travis doesn't seem to give access to old builds when you restart them, so we need to copy those failures somewhere else) and figure out what and where needs improving.

* since upgraded in #161

@textbook
Copy link
Contributor Author

Currently failing for me locally in the Docker container:

Failures:

  1) Felicity Journey
     Failure/Error: retro_item.find('.item-done').click

     Capybara::ElementNotFound:
       Unable to find css ".item-done" within #<Capybara::Node::Element tag="div" path="/HTML/BODY[1]/DIV[1]/DIV[1]/DIV[1]/DIV[1]/SPAN[1]/DIV[1]/DIV[2]/DIV[1]/DIV[4]">
     # ./spec/spec_helper.rb:186:in `block in mark_all_retro_items_as_done'
     # ./spec/spec_helper.rb:183:in `mark_all_retro_items_as_done'
     # ./spec/felicity_journey_spec.rb:299:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:213:in `block (2 levels) in <top (required)>'

@textbook
Copy link
Contributor Author

textbook commented Jul 23, 2019

Failure in Travis for textbook:upgrade-web-deps

Failures:
  1) Felicity Journey
     Failure/Error: expect(page).to have_css('div.retro-item.discussed .item-text', text: 'this is a happy item')
       expected to find css "div.retro-item.discussed .item-text" but there were no matches
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-support-3.8.0/lib/rspec/support.rb:97:in `block in <module:Support>'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-support-3.8.0/lib/rspec/support.rb:106:in `notify_failure'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/fail_with.rb:35:in `fail_with'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:40:in `handle_failure'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:27:in `with_matcher'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/expectation_target.rb:65:in `to'
     # ./spec/felicity_journey_spec.rb:416:in `block (2 levels) in <top (required)>'

@textbook
Copy link
Contributor Author

Back to the archive issue after setting the global timeout to 20 seconds:

Failures:
  1) Felicity Journey
     Failure/Error: expect(page).to have_content('The board will be cleared ready for your next retro and incomplete action items will be carried across.')
       expected to find text "The board will be cleared ready for your next retro and incomplete action items will be carried across." in "My Retro\nMENU\n0\nthis is the first item\n0\nYour team can add happy, meh or sad items to these columns. Why don't you try adding one now?\n0\nSelect an item to start a discussion. You\u2019ll notice a 5 minute timer, so be sure to keep the conversation on track.\n0\nWhen you've addressed the item, mark it as \"Done\".\n0\nthis is the last item\n0\nHave you addressed all retro items?\n0\nIf so, it's time to archive the board. You\u2019ll find the Archive button in the menu.\nAction items\nToday (July 23)\nAdd action items with a single owner (Owner\u2019s Name)\nTick off action items when complete (Owner's Name)\nOlder\nContact Us\nTerms & Conditions\nPrivacy Policy"
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-support-3.8.0/lib/rspec/support.rb:97:in `block in <module:Support>'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-support-3.8.0/lib/rspec/support.rb:106:in `notify_failure'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/fail_with.rb:35:in `fail_with'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:40:in `handle_failure'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:27:in `with_matcher'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
     # /root/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/expectation_target.rb:65:in `to'
     # ./spec/felicity_journey_spec.rb:301:in `block (2 levels) in <top (required)>'

@textbook
Copy link
Contributor Author

textbook commented Aug 8, 2019

The issue with expect(page).to have_css('div.retro-item.discussed .item-text', text: 'this is a happy item') seemed to be a timing problem; adding a sleep between activating a retro item and attempting to click Done (see #175) seemed to make it much more stable. The archive issue still seems to occur (e.g. https://travis-ci.org/textbook/postfacto/builds/569271982) at a low frequency.

@textbook
Copy link
Contributor Author

The same failure as above but, controversially, not in Felicity's journey just came up in CI.

Failures:
  1) A Journey Of Two Participants Changing retro password and re-login for Peter
     Failure/Error: expect(page).to have_content 'The owner of this retro has chosen to protect it with a password.'
       expected to find text "The owner of this retro has chosen to protect it with a password." in "My Retro\nMENU\n0\nYour team can add happy, meh or sad items to these columns. Why don't you try adding one now?\n0\nSelect an item to start a discussion. You\u2019ll notice a 5 minute timer, so be sure to keep the conversation on track.\n0\nWhen you've addressed the item, mark it as \"Done\".\n0\nHave you addressed all retro items?\n0\nIf so, it's time to archive the board. You\u2019ll find the Archive button in the menu.\nAction items\nToday (October 25)\nAdd action items with a single owner (Owner\u2019s Name)\nTick off action items when complete (Owner's Name)\nOlder\nContact Us\nTerms & Conditions\nPrivacy Policy"
     # ./spec/a_journey_of_two_participants_journey_spec.rb:372:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:194:in `in_browser'
     # ./spec/a_journey_of_two_participants_journey_spec.rb:370:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:213:in `block (2 levels) in <top (required)>'

@j-lea
Copy link
Contributor

j-lea commented May 6, 2020

We have done some digging and think it is because the archive modal isn't appearing, not that the modal is appearing but the test isn't detecting it

When the test passes - the modal shows and all retro items have the discussed class.
Screenshot 2020-05-06 at 09 19 03

When the test fails - no modal and one of the retro items does not have the discussed class, so it makes sense that the criteria to show the modal hasn't been met.
Screenshot 2020-05-06 at 09 19 48

Whats weird is that the problem seems to always be with #retro-item-3?

j-lea pushed a commit that referenced this issue May 6, 2020
… more consistent (fixes #162)

Signed-off-by: Marco Garofalo <[email protected]>
j-lea referenced this issue in j-lea/postfacto May 21, 2020
… more consistent (fixes #162)

Signed-off-by: Marco Garofalo <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants