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 GobView Test #1116

Merged
merged 3 commits into from
Jul 25, 2023
Merged

Fix GobView Test #1116

merged 3 commits into from
Jul 25, 2023

Conversation

stilscher
Copy link
Member

The spuriously occuring crashes of the GobView tests automated with Selenium are due to a race. The race can be forced by letting the goblint-http server sleep for 10s before returning e.g. stats.marshalled.

When the GobView page is loaded, it first displays a spinner. After all files necessary for the initialization are marshalled including stats.marshalled), the DOM element with the spinner is updated (through React) to display the actual web page. The call browser.get(url) in the python selenium test opens the web page of the url and waits for the page to be loaded. Waiting for it to be loaded here means, that the property document.readyState will be complete before the next statement in the test is executed. This does however not indicate whether the page is fully loaded, dynamic updates through React might still happen after document.readyState == complete. The condition can be fulfilled even though the spinner is still being displayed.

This PR

  • sets an implicit wait of 10s for the selenium driver to make it less fragile towards races. An implicit wait will allow to repeatedly try to e.g. find a DOM element until it is either found or the time limit of the implicit wait is up. I also checked whether there could be more specific solutions. An implicit wait has the benefit that it does not slow down the test execution in general. Compared to an explicit wait it will help to make the test more robust in general. Actually checking whether the spinner was replaced would require to set some document property in GobView solely for testing (and I haven't tried if this approach would be feasible with js_of_ocaml).
  • changes the test to use the goblint-http server to serve the files instead of the previously used python http server

Closes #1085

@stilscher stilscher added the bug label Jul 20, 2023
@stilscher stilscher requested a review from sim642 July 20, 2023 16:04
@sim642 sim642 added the testing label Jul 25, 2023
@sim642 sim642 added this to the v2.2.0 milestone Jul 25, 2023
@stilscher stilscher merged commit cbff5cb into master Jul 25, 2023
16 checks passed
@stilscher stilscher deleted the gobview-test branch July 25, 2023 08:22
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.

Gobview tests regularly crash
2 participants