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

QE: handle errors occurring during a page reload #8110

Conversation

NamelessOne91
Copy link
Contributor

@NamelessOne91 NamelessOne91 commented Jan 8, 2024

What does this PR change?

Introduce a reusable function to reload pages and handle the case in which a TimeoutError is raised during a page reload, resulting in no screenshot being available for a failed scenario.

GUI diff

No difference.

  • DONE

Documentation

  • No documentation needed: only internal and user invisible changes

  • DONE

Test coverage

  • Cucumber tests were edited

  • DONE

Links

Issue(s): https://github.com/SUSE/spacewalk/issues/22208
Backport Manager 4.3: https://github.com/SUSE/spacewalk/pull/23602

  • DONE

Changelogs

  • No changelog needed

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

@NamelessOne91 NamelessOne91 self-assigned this Jan 8, 2024
Copy link
Contributor

github-actions bot commented Jan 8, 2024

👋 Hello! Thanks for contributing to our project.
Acceptance tests will take some time (aprox. 1h), please be patient ☕
You can see the progress at the end of this page and at https://github.com/uyuni-project/uyuni/pull/8110/checks
Once tests finish, if they fail, you can check 👀 the cucumber report. See the link at the output of the action.
You can also check the artifacts section, which contains the logs at https://github.com/uyuni-project/uyuni/pull/8110/checks.

If you are unsure the failing tests are related to your code, you can check the "reference jobs". These are jobs that run on a scheduled time with code from master. If they fail for the same reason as your build, it means the tests or the infrastructure are broken. If they do not fail, but yours do, it means it is related to your code.

Reference tests:

KNOWN ISSUES

Sometimes the build can fail when pulling new jar files from download.opensuse.org . This is a known limitation. Given this happens rarely, when it does, all you need to do is rerun the test. Sorry for the inconvenience.

For more tips on troubleshooting, see the troubleshooting guide.

Happy hacking!
⚠️ You should not merge if acceptance tests fail to pass. ⚠️

@maximenoel8
Copy link
Contributor

Thanks for the effort Paolo. It will improve drastically our comfort of life to have this screenshot back !

@NamelessOne91
Copy link
Contributor Author

NamelessOne91 commented Jan 18, 2024

I don't like the catching and re-throwing of errors but ATM it should to the work and avoid introducing further complexity in repeat_until_timeout

@NamelessOne91 NamelessOne91 marked this pull request as ready for review January 18, 2024 10:34
@NamelessOne91 NamelessOne91 requested a review from a team as a code owner January 18, 2024 10:34
Copy link
Contributor

@Bischoff Bischoff left a comment

Choose a reason for hiding this comment

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

just one noobish question

testsuite/features/step_definitions/navigation_steps.rb Outdated Show resolved Hide resolved
@NamelessOne91 NamelessOne91 force-pushed the timeout_error_during_page_refresh branch from 7aed23f to b0ca216 Compare January 18, 2024 12:45
@NamelessOne91 NamelessOne91 changed the title QE: handle TimeoutError occurring during a page reload QE: handle errors occurring during a page reload Jan 18, 2024
end
rescue ScriptError, TimeoutError => e
# an error may be raised while the page still (re)loads, making no screenshot available
find('#page-body', wait: 3)
Copy link
Member

@srbarrios srbarrios Jan 18, 2024

Choose a reason for hiding this comment

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

Maybe instead of waiting here, we should be waiting in the After method, just before we take the screenshot.

But in any case, we are already waiting some time before taking any screenshots, probably even too much...!

https://github.com/uyuni-project/uyuni/blob/master/testsuite/features/support/env.rb#L138

As we are waiting twice the default_max_wait_time.

If we look at has_content APIDoc:
https://www.rubydoc.info/github/jnicklas/capybara/master/Capybara%2FNode%2FMatchers:has_content

@nodeg FYI ^

Copy link
Contributor Author

@NamelessOne91 NamelessOne91 Jan 22, 2024

Choose a reason for hiding this comment

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

Right, it's much better indeed to have this kind of stuff in the After method.

Regarding the waits: when the failure happens in cases where we are not dealing with bootstrapping minions (as when checking the events history), this and condition will probably short circuit due to lazy evaluation.

click_button('Details') if has_content?('Bootstrap Minions') && has_content?('Details')

Maybe we can check for the exception which lead to a failure and use it to determine whether to force another wait, or not.
Something like:

find('#page-body', wait: 3) if scenario.exception.is_a?(TimeoutError)

Assuming the problem is actually not having enough time for the page to load.

@maximenoel8
Copy link
Contributor

maximenoel8 commented Jan 25, 2024

Hi @NamelessOne91 , what is the status of this PR?
It will help a lot to have it in uyuni and spacewalk to help debugging when we hit the timeout !

@NamelessOne91
Copy link
Contributor Author

Hi @NamelessOne91 , what is the status of this PR? It will help a lot to have it in uyuni and spacewalk to help debugging when we hit the timeout !

Hi @maximenoel8
I've focused on fixing other testsuite issues or flaky tests lately, this PR has been on hold for a while.

I'm not sure the issue is just not having enough time to reload the page before a screenshot is taken, see Oscar's comment.
We can still try to implement an additional wait, in the After method, when a scenario failed due to a TimeoutError and see if that makes things better.,

@NamelessOne91 NamelessOne91 force-pushed the timeout_error_during_page_refresh branch from b0ca216 to 3d0e29a Compare January 31, 2024 13:31
Copy link
Member

@srbarrios srbarrios left a comment

Choose a reason for hiding this comment

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

Once Rubocop issue is fixed, LGTM.

@NamelessOne91 NamelessOne91 force-pushed the timeout_error_during_page_refresh branch from 3d0e29a to 66d01f3 Compare January 31, 2024 13:47
@deneb-alpha deneb-alpha merged commit 2187c60 into uyuni-project:master Jan 31, 2024
24 checks passed
@NamelessOne91 NamelessOne91 deleted the timeout_error_during_page_refresh branch February 9, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants