-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #14067 - Host#edit integration tests should wait for tasks
When you click on Host#edit Submit button, a few orchestration tasks will be created. After that, the show page will call (via AJAX) a few URLS to fetch 'overview', 'resources', 'nics', etc... to fill up the table on the left side. These are all irrelevant to tests that only concern the form, and pose a problem as we don't explicitly wait for them. Problem: The server we test on is not multithreaded, these tasks will run sequentially. Therefore, the default Capybara waiting time, or Capybara.default_max_time might not be enough to wait for all requests. Solution: We can wait until the #host-progress div has disappeared and wait for the Host#show ajax calls using wait_for_ajax
- Loading branch information
Showing
2 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module HostOrchestrationStubs | ||
extend ActiveSupport::Concern | ||
|
||
def click_on_submit | ||
click_button('Submit') | ||
wait_for_orchestration_requests # host-progress bar should disappear | ||
wait_for_ajax # wait for runtime/nics/etc.. ajax requests in Host#show | ||
assert page.has_link?('Edit') | ||
end | ||
|
||
def wait_for_orchestration_requests | ||
has_no_selector?("#host-progress", | ||
:visible => :all, | ||
:wait => 2 * Capybara.default_max_wait_time) | ||
end | ||
end |