Improve E2E test performance by using waits more efficiently
In https://gitlab.com/gitlab-org/gitlab-ce/issues/46074 we discussed changing default_max_wait_time
to 0 but decided that the problem we were actually trying to solve was that we were forcing Capybara to wait unnecessarily.
Proposal
-
Add wait/predicate/performance best practices to QA docs -
Identify the places where we're forcing Capybara to wait, and either use predicate methods (e.g., has_element?
) appropriately or eliminate them entirely. -
Review usage of predicate methods to determine if they should be assertions (i.e., should an exception be raised if the predicate returns false
?)
For example:
def has_merge_options?
has_css?(element_selector_css(:merge_moment_dropdown))
end
def merge_immediately
if has_merge_options?
click_element :merge_moment_dropdown
click_element :merge_immediately_option
else
click_element :merge_button
end
end
Every time has_merge_options?
returns false there a delay that doesn't need to occur. We should know whether a test needs to use the dropdown or not, so there's no need for has_merge_options?
.
/cc @gl-quality