summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-09-11 13:45:29 +1000
committerMark Lapierre <mlapierre@gitlab.com>2019-09-11 16:16:51 +1000
commit148f4889bbd6210223cf8f99f62f0c074d138af0 (patch)
tree7eafbbf47307cf06f1ca6592dc5fe4da2215f6b7
parent28292d516abb33aeaf7e5bfaf94679d1317bd284 (diff)
downloadgitlab-ce-qa-ml-pull-mirroring-test.tar.gz
Backport changes from EE mirroring testqa-ml-pull-mirroring-test
-rw-r--r--app/views/projects/mirrors/_mirror_repos.html.haml6
-rw-r--r--qa/qa/page/project/settings/mirroring_repositories.rb10
-rw-r--r--qa/qa/resource/repository/project_push.rb4
3 files changed, 11 insertions, 9 deletions
diff --git a/app/views/projects/mirrors/_mirror_repos.html.haml b/app/views/projects/mirrors/_mirror_repos.html.haml
index 84f0900d9c1..104c68919f0 100644
--- a/app/views/projects/mirrors/_mirror_repos.html.haml
+++ b/app/views/projects/mirrors/_mirror_repos.html.haml
@@ -49,12 +49,12 @@
= render_if_exists 'projects/mirrors/table_pull_row'
- @project.remote_mirrors.each_with_index do |mirror, index|
- next if mirror.new_record?
- %tr.qa-mirrored-repository-row.rspec-mirrored-repository-row{ class: ('bg-secondary' if mirror.disabled?) }
- %td.qa-mirror-repository-url= mirror.safe_url || _('Invalid URL')
+ %tr.rspec-mirrored-repository-row{ class: ('bg-secondary' if mirror.disabled?), data: { qa_selector: 'mirrored_repository_row' } }
+ %td{ data: { qa_selector: 'mirror_repository_url_cell' } }= mirror.safe_url || _('Invalid URL')
%td= _('Push')
%td
= mirror.last_update_started_at.present? ? time_ago_with_tooltip(mirror.last_update_started_at) : _('Never')
- %td.qa-mirror-last-update-at= mirror.last_update_at.present? ? time_ago_with_tooltip(mirror.last_update_at) : _('Never')
+ %td{ data: { qa_selector: 'mirror_last_update_at_cell' } }= mirror.last_update_at.present? ? time_ago_with_tooltip(mirror.last_update_at) : _('Never')
%td
- if mirror.disabled?
= render 'projects/mirrors/disabled_mirror_badge'
diff --git a/qa/qa/page/project/settings/mirroring_repositories.rb b/qa/qa/page/project/settings/mirroring_repositories.rb
index e3afaceda80..441235afca8 100644
--- a/qa/qa/page/project/settings/mirroring_repositories.rb
+++ b/qa/qa/page/project/settings/mirroring_repositories.rb
@@ -13,8 +13,8 @@ module QA
view 'app/views/projects/mirrors/_mirror_repos.html.haml' do
element :mirror_repository_url_input
element :mirror_repository_button
- element :mirror_repository_url
- element :mirror_last_update_at
+ element :mirror_repository_url_cell
+ element :mirror_last_update_at_cell
element :mirrored_repository_row
end
@@ -64,21 +64,21 @@ module QA
wait(interval: 1) do
within_element_by_index(:mirrored_repository_row, row_index) do
- last_update = find_element(:mirror_last_update_at, wait: 0)
+ last_update = find_element(:mirror_last_update_at_cell, wait: 0)
last_update.has_text?('just now') || last_update.has_text?('seconds')
end
end
# Fail early if the page still shows that there has been no update
within_element_by_index(:mirrored_repository_row, row_index) do
- find_element(:mirror_last_update_at, wait: 0).assert_no_text('Never')
+ find_element(:mirror_last_update_at_cell, wait: 0).assert_no_text('Never')
end
end
private
def find_repository_row_index(target_url)
- all_elements(:mirror_repository_url).index do |url|
+ all_elements(:mirror_repository_url_cell).index do |url|
# The url might be a sanitized url but the target_url won't be so
# we compare just the paths instead of the full url
URI.parse(url.text).path == target_url.path
diff --git a/qa/qa/resource/repository/project_push.rb b/qa/qa/resource/repository/project_push.rb
index e98880ce195..b2d9c0f8bae 100644
--- a/qa/qa/resource/repository/project_push.rb
+++ b/qa/qa/resource/repository/project_push.rb
@@ -4,11 +4,12 @@ module QA
module Resource
module Repository
class ProjectPush < Repository::Push
+ attr_accessor :project_name
attr_writer :wait_for_push
attribute :project do
Project.fabricate! do |resource|
- resource.name = 'project-with-code'
+ resource.name = project_name
resource.description = 'Project with repository'
end
end
@@ -19,6 +20,7 @@ module QA
@commit_message = "This is a test commit"
@branch_name = 'master'
@new_branch = true
+ @project_name = 'project-with-code'
@wait_for_push = true
end