Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing system test #681

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Fix failing system test #681

wants to merge 5 commits into from

Conversation

nicolastemciuc
Copy link
Member

No description provided.

nicolastemciuc and others added 5 commits March 12, 2025 14:09
Move `assert_text` inside `assert_emails` block to ensure the test waits for the controller to process the request before asserting email delivery.

This prevents potential race conditions where the email might not be counted in time.
This way we ensures that the email field is present when we try to
fill it.
This way we ensure that the review is created/updated
Error:
```
Failure:
UserTest#test_can_sign_up [test/system/user_test.rb:47]:
expected to find text "alice@test.com" in
"menu\nMiCarrera\nsearch\ncloud_download\n0 créditos\nA\nBienvenido!
Marcá los cursos y exámenes que aprobaste para ver qué materias podés
cursar.\nLISTO\nBuilt by \nCedarcode". (However, it was found 1 time
including non-visible text.)

bin/rails test test/system/user_test.rb:9
```
The test was failing with the following error:

```
Error:
UserTest#test_can_edit_profile:
Capybara::ElementNotFound: Unable to find visible link or button "Editar Perfil"
    test/system/user_test.rb:135:in 'block in <class:UserTest>'
```

The issue is that there's a race condition between the application
loading the home page and capybara clicking on the user menu and it
having the `Editar Perfil` link. If capybara is too fast, it will click
on the user menu before the application loads so the click won't open
the menu and thus it won't find the button.

In order to fix this, we can wait until the text `Iniciaste sesión
correctamente` appears in the page, which will indicate when we can
continue with the rest of the actions.
@nicolastemciuc nicolastemciuc marked this pull request as ready for review March 12, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants