| ... | @@ -15,7 +15,9 @@ module QA |
... | @@ -15,7 +15,9 @@ module QA |
|
|
element :mirror_repository_button
|
|
element :mirror_repository_button
|
|
|
element :mirror_repository_url_cell
|
|
element :mirror_repository_url_cell
|
|
|
element :mirror_last_update_at_cell
|
|
element :mirror_last_update_at_cell
|
|
|
|
element :mirror_error_badge
|
|
|
element :mirrored_repository_row
|
|
element :mirrored_repository_row
|
|
|
|
element :copy_public_key_button
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
view 'app/views/projects/mirrors/_mirror_repos_form.html.haml' do
|
|
view 'app/views/projects/mirrors/_mirror_repos_form.html.haml' do
|
| ... | @@ -24,6 +26,17 @@ module QA |
... | @@ -24,6 +26,17 @@ module QA |
|
|
|
|
|
|
|
view 'app/views/shared/_remote_mirror_update_button.html.haml' do
|
|
view 'app/views/shared/_remote_mirror_update_button.html.haml' do
|
|
|
element :update_now_button
|
|
element :update_now_button
|
|
|
|
element :updating_button
|
|
|
|
end
|
|
|
|
|
|
|
|
view 'app/views/projects/mirrors/_ssh_host_keys.html.haml' do
|
|
|
|
element :detect_host_keys
|
|
|
|
element :fingerprints_list
|
|
|
|
end
|
|
|
|
|
|
|
|
view 'app/views/projects/mirrors/_authentication_method.html.haml' do
|
|
|
|
element :authentication_method
|
|
|
|
element :password
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def repository_url=(value)
|
|
def repository_url=(value)
|
| ... | @@ -35,17 +48,40 @@ module QA |
... | @@ -35,17 +48,40 @@ module QA |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def mirror_direction=(value)
|
|
def mirror_direction=(value)
|
|
|
raise ArgumentError, "Mirror direction must be :push or :pull" unless [:push, :pull].include? value
|
|
raise ArgumentError, "Mirror direction must be 'Push' or 'Pull'" unless %w(Push Pull).include? value
|
|
|
|
|
|
|
|
select_element(:mirror_direction, value)
|
|
select_element(:mirror_direction, value)
|
|
|
|
|
|
|
|
# Changing the mirror direction causes the fields below to change,
|
|
|
|
# and that change is animated, so we need to wait for the animation
|
|
|
|
# to complete otherwise changes to those fields could fail
|
|
|
|
wait_for_animated_element :authentication_method
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def authentication_method=(value)
|
|
def authentication_method=(value)
|
|
|
raise ArgumentError, "Authentication method must be :password or :none" unless [:password, :none].include? value
|
|
raise ArgumentError, "Authentication method must be 'SSH public key', 'Password', or 'None'" unless %w(Password None SSH\ public\ key).include? value
|
|
|
|
|
|
|
|
select_element(:authentication_method, value)
|
|
select_element(:authentication_method, value)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
def public_key(url)
|
|
|
|
row_index = find_repository_row_index url
|
|
|
|
|
|
|
|
within_element_by_index(:mirrored_repository_row, row_index) do
|
|
|
|
find_element(:copy_public_key_button)['data-clipboard-text']
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def detect_host_keys
|
|
|
|
click_element :detect_host_keys
|
|
|
|
|
|
|
|
# The host key detection process is interrupted if we navigate away
|
|
|
|
# from the page before the fingerprint appears.
|
|
|
|
wait(max: 5) do
|
|
|
|
find_element(:fingerprints_list).has_text? /.*/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
def mirror_repository
|
|
def mirror_repository
|
|
|
click_element :mirror_repository_button
|
|
click_element :mirror_repository_button
|
|
|
end
|
|
end
|
| ... | @@ -54,7 +90,9 @@ module QA |
... | @@ -54,7 +90,9 @@ module QA |
|
|
row_index = find_repository_row_index url
|
|
row_index = find_repository_row_index url
|
|
|
|
|
|
|
|
within_element_by_index(:mirrored_repository_row, row_index) do
|
|
within_element_by_index(:mirrored_repository_row, row_index) do
|
|
|
click_element :update_now_button
|
|
# When a repository is first mirrored, the update process might
|
|
|
|
# already be started, so the button is already "clicked"
|
|
|
|
click_element :update_now_button unless has_element? :updating_button
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
# Wait a few seconds for the sync to occur and then refresh the page
|
|
# Wait a few seconds for the sync to occur and then refresh the page
|
| ... | @@ -72,16 +110,19 @@ module QA |
... | @@ -72,16 +110,19 @@ module QA |
|
|
# Fail early if the page still shows that there has been no update
|
|
# Fail early if the page still shows that there has been no update
|
|
|
within_element_by_index(:mirrored_repository_row, row_index) do
|
|
within_element_by_index(:mirrored_repository_row, row_index) do
|
|
|
find_element(:mirror_last_update_at_cell, wait: 0).assert_no_text('Never')
|
|
find_element(:mirror_last_update_at_cell, wait: 0).assert_no_text('Never')
|
|
|
|
assert_no_element(:mirror_error_badge)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
private
|
|
private
|
|
|
|
|
|
|
|
def find_repository_row_index(target_url)
|
|
def find_repository_row_index(target_url)
|
|
|
all_elements(:mirror_repository_url_cell).index do |url|
|
|
wait(max: 5, reload: false) do
|
|
|
# The url might be a sanitized url but the target_url won't be so
|
|
all_elements(:mirror_repository_url_cell).index do |url|
|
|
|
# we compare just the paths instead of the full url
|
|
# The url might be a sanitized url but the target_url won't be so
|
|
|
URI.parse(url.text).path == target_url.path
|
|
# we compare just the paths instead of the full url
|
|
|
|
URI.parse(url.text).path == target_url.path
|
|
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
| ... | |
... | |
| ... | | ... | |