Skip to content

Fix flaky spec in authentication#13827

Merged
alecslupu merged 3 commits intodevelopfrom
test/flaky-authentication-fix
Jan 13, 2025
Merged

Fix flaky spec in authentication#13827
alecslupu merged 3 commits intodevelopfrom
test/flaky-authentication-fix

Conversation

@andreslucena
Copy link
Copy Markdown
Member

@andreslucena andreslucena commented Jan 10, 2025

🎩 What? Why?

Lately we've seen some flaky related to Authentication happen a lot in CI.

This is the stacktrace:

  1) Authentication when a user is already registered Log Out logs out the user
     Failure/Error:
       within_user_menu do
         click_on("Log out")
       end

     Capybara::ElementNotFound:
       Unable to find id "trigger-dropdown-account" within #<Capybara::Node::Element tag="div" path="/HTML/BODY[1]/DIV[2]/HEADER[1]/DIV[1]/DIV[2]/DIV[1]">

     [Screenshot Image]: file:///home/runner/work/decidim/decidim/spec/decidim_dummy_app/tmp/screenshots/failures_r_spec_example_groups_authentication_when_a_user_is_already_registered_log_out_logs_out_the_user_563.png

     [Screenshot HTML]: file:///home/runner/work/decidim/decidim/spec/decidim_dummy_app/tmp/screenshots/failures_r_spec_example_groups_authentication_when_a_user_is_already_registered_log_out_logs_out_the_user_563.html


     # /home/runner/work/decidim/decidim/decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb:16:in `block in within_user_menu'
     # /home/runner/work/decidim/decidim/decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb:15:in `within_user_menu'
     # ./spec/system/authentication_spec.rb:581:in `block (4 levels) in <top (required)>'

I'm not able to reproduce this locally, but I think the problem lies in another example of this same file, as the problem that I saw was that the user wasn't actually logged in in these examples:


My theory is that it wasn't logged in because it was locked in an example before.

Another theory, is that as it happened in other flakys, the run is too fast and we should wait between the login_as and the actual session being logged in. I'm not so sure why this doesn't happen more in other specs (maybe it's the same culprit in other flakys? Maybe we should be extra aware about this misbehavior)

📌 Related Issues

Testing

As it is a flaky that can't be reproduced locally (or at least I can't do it), I'll re-run the relevant job ("[CI] Core - System specs") at least 5 times to see if it happens again.

♥️ Thank you!

@andreslucena andreslucena added flaky spec type: fix PRs that implement a fix for a bug labels Jan 10, 2025
github-actions[bot]
github-actions bot previously approved these changes Jan 10, 2025
@andreslucena andreslucena marked this pull request as draft January 10, 2025 10:57
@andreslucena
Copy link
Copy Markdown
Member Author

@alecslupu I think this is working. I re-run this 10 time and it doesn't seem to happen anymore.

Screenshot of the last GH actions runs for this change

The first failure is already fixed with #13820

@andreslucena andreslucena marked this pull request as ready for review January 13, 2025 11:59
@alecslupu alecslupu added release: v0.29 Issues or PRs that need to be tackled for v0.29 release: v0.28 Issues or PRs that need to be tackled for v0.28 labels Jan 13, 2025
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alecslupu alecslupu merged commit e0e1ebc into develop Jan 13, 2025
@alecslupu alecslupu deleted the test/flaky-authentication-fix branch January 13, 2025 13:28
entantoencuanto added a commit that referenced this pull request Jan 14, 2025
* develop: (27 commits)
  WCAG navigation submenu (#13796)
  Update gem dependencies (part 3) (#13849)
  Prevent notifications for deleted users (#13812)
  Retries NPM installation a couple times to prevent network timeouts (#13831)
  Update gem dependencies (part 2) (#13839)
  Enhance signature pdf export (#13778)
  Fix HexaPDF dependency (#13834)
  Fix flaky spec in authentication (#13827)
  Merge upload field for documents and image on proposal admin form (#13735)
  Update gem dependencies (#13835)
  Upgrade erb_lint to 0.8.0 (#13833)
  Fix flaky spec in geocoder (#13820)
  Refactor modules mounting routes (#13294)
  Upgrade check-spelling action (#13825)
  Add missing images in the custom registration emails from meetings (#13632)
  Add missing translations (#13793)
  Fix proposal map performance with hundreds of markers (#13798)
  Create multiple surveys within same Survey component (#13420)
  Accountability bulk actions (#13730)
  Improve UI for sorting options on comments (#13670)
  ...
rsdeus pushed a commit to octree-gva/decidim that referenced this pull request Jan 15, 2025
antopalidi pushed a commit to openpoke/decidim that referenced this pull request Feb 12, 2025
andreslucena added a commit that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flaky spec module: core release: v0.28 Issues or PRs that need to be tackled for v0.28 release: v0.29 Issues or PRs that need to be tackled for v0.29 type: fix PRs that implement a fix for a bug

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants