Replace click_body with native mouse events

parent 54c2546c
- return unless can?(current_user, :archive_project, @project)
.sub-section
.sub-section{ data: { qa_selector: 'archive_project_content' } }
%h4.warning-title
- if @project.archived?
= _('Unarchive project')
......
......@@ -44,10 +44,6 @@ module QA
wait_for_requests
end
def click_body
page.find("body").click
end
def wait_until(max_duration: 60, sleep_interval: 0.1, reload: true, raise_on_failure: true)
Support::Waiter.wait_until(max_duration: max_duration, sleep_interval: sleep_interval, raise_on_failure: raise_on_failure) do
yield || (reload && refresh && false)
......@@ -145,6 +141,15 @@ module QA
end
end
# Use this to simulate moving the pointer to an element's coordinate
# and sending a click event.
# This is a helpful workaround when there is a transparent element overlapping
# the target element and so, normal `click_element` on target would raise
# Selenium::WebDriver::Error::ElementClickInterceptedError
def click_element_coordinates(name)
page.driver.browser.action.move_to(find_element(name).native).click.perform
end
# replace with (..., page = self.class)
def click_element(name, page = nil, **kwargs)
wait_for_requests
......
......@@ -17,6 +17,7 @@ module QA
view 'app/views/projects/settings/_archive.html.haml' do
element :archive_project_link
element :unarchive_project_link
element :archive_project_content
end
view 'app/views/projects/_export.html.haml' do
......@@ -45,7 +46,7 @@ module QA
# Retry added here due to seldom seen inconsistent UI state issue:
# https://gitlab.com/gitlab-org/gitlab/-/issues/231242
retry_on_exception do
click_body
click_element_coordinates(:archive_project_content)
expand_select_list
# Workaround for a failure to search when there are no spaces around the /
# https://gitlab.com/gitlab-org/gitlab/-/issues/218965
......
......@@ -64,6 +64,12 @@ module QA
super
end
def click_element_coordinates(name)
log(%Q(clicking the coordinates of :#{name}))
super
end
def click_element(name, page = nil, **kwargs)
msg = ["clicking :#{name}"]
msg << ", expecting to be at #{page.class}" if page
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment