Commit ddef2f1f authored by Sanad Liaquat's avatar Sanad Liaquat

Update GitHub Import test

Removes the unnecessary :orchestrated tag and updates a few
selectors. Also wait_for_success for import before proceeding.
The test is currently placed in quarantine because of a bug.
parent 20d84d80
...@@ -219,7 +219,7 @@ export default { ...@@ -219,7 +219,7 @@ export default {
:class="classNameBindings" :class="classNameBindings"
:data-award-url="note.toggle_award_path" :data-award-url="note.toggle_award_path"
:data-note-id="note.id" :data-note-id="note.id"
class="note note-wrapper" class="note note-wrapper qa-noteable-note-item"
> >
<div v-once class="timeline-icon"> <div v-once class="timeline-icon">
<user-avatar-link <user-avatar-link
......
...@@ -77,8 +77,8 @@ module QA ...@@ -77,8 +77,8 @@ module QA
page.evaluate_script('xhr.status') == 200 page.evaluate_script('xhr.status') == 200
end end
def find_element(name, text_filter = nil, wait: Capybara.default_max_wait_time) def find_element(name, text: nil, wait: Capybara.default_max_wait_time)
find(element_selector_css(name), wait: wait, text: text_filter) find(element_selector_css(name), wait: wait, text: text)
end end
def all_elements(name) def all_elements(name)
...@@ -109,8 +109,8 @@ module QA ...@@ -109,8 +109,8 @@ module QA
element.select value.to_s.capitalize element.select value.to_s.capitalize
end end
def has_element?(name, wait: Capybara.default_max_wait_time) def has_element?(name, text: nil, wait: Capybara.default_max_wait_time)
has_css?(element_selector_css(name), wait: wait) has_css?(element_selector_css(name), wait: wait, text: text)
end end
def has_no_element?(name, wait: Capybara.default_max_wait_time) def has_no_element?(name, wait: Capybara.default_max_wait_time)
......
...@@ -45,7 +45,7 @@ module QA ...@@ -45,7 +45,7 @@ module QA
private private
def select_kind(kind) def select_kind(kind)
retry_on_exception(sleep_interval: 1.0) do QA::Support::Retrier.retry_on_exception(sleep_interval: 1.0) do
within_element(:new_project_or_subgroup_dropdown) do within_element(:new_project_or_subgroup_dropdown) do
# May need to click again because it is possible to click the button quicker than the JS is bound # May need to click again because it is possible to click the button quicker than the JS is bound
wait(reload: false) do wait(reload: false) do
......
...@@ -29,12 +29,19 @@ module QA ...@@ -29,12 +29,19 @@ module QA
choose_test_namespace(full_path) choose_test_namespace(full_path)
set_path(full_path, name) set_path(full_path, name)
import_project(full_path) import_project(full_path)
wait_for_success
end end
private private
def within_repo_path(full_path) def within_repo_path(full_path)
page.within(%Q(tr[data-qa-repo-path="#{full_path}"])) do wait(reload: false) do
has_element?(:project_import_row, text: full_path)
end
project_import_row = find_element(:project_import_row, text: full_path)
within(project_import_row) do
yield yield
end end
end end
...@@ -44,18 +51,24 @@ module QA ...@@ -44,18 +51,24 @@ module QA
click_element :project_namespace_select click_element :project_namespace_select
end end
select_item(Runtime::Namespace.path) search_and_select(Runtime::Namespace.path)
end end
def set_path(full_path, name) def set_path(full_path, name)
within_repo_path(full_path) do within_repo_path(full_path) do
fill_in 'path', with: name fill_element(:project_path_field, name)
end end
end end
def import_project(full_path) def import_project(full_path)
within_repo_path(full_path) do within_repo_path(full_path) do
click_button 'Import' click_element(:import_button)
end
end
def wait_for_success
wait(max: 60, interval: 1.0, reload: false) do
page.has_content?('Done', wait: 1.0)
end end
end end
end end
......
...@@ -23,6 +23,10 @@ module QA ...@@ -23,6 +23,10 @@ module QA
element :filter_options element :filter_options
end end
view 'app/assets/javascripts/notes/components/noteable_note.vue' do
element :noteable_note_item
end
# Adds a comment to an issue # Adds a comment to an issue
# attachment option should be an absolute path # attachment option should be an absolute path
def comment(text, attachment: nil) def comment(text, attachment: nil)
...@@ -36,6 +40,12 @@ module QA ...@@ -36,6 +40,12 @@ module QA
click_element :comment_button click_element :comment_button
end end
def has_comment?(comment_text)
wait(reload: false) do
has_element?(:noteable_note_item, text: comment_text)
end
end
def select_comments_only_filter def select_comments_only_filter
select_filter_with_text('Show comments only') select_filter_with_text('Show comments only')
end end
...@@ -54,7 +64,7 @@ module QA ...@@ -54,7 +64,7 @@ module QA
retry_on_exception do retry_on_exception do
click_body click_body
click_element :discussion_filter click_element :discussion_filter
find_element(:filter_options, text).click find_element(:filter_options, text: text).click
end end
end end
end end
......
...@@ -43,7 +43,7 @@ module QA::Page ...@@ -43,7 +43,7 @@ module QA::Page
end end
def go_to_job(job_name) def go_to_job(job_name)
find_element(:job_link, job_name).click find_element(:job_link, text: job_name).click
end end
def go_to_first_job def go_to_first_job
......
...@@ -33,14 +33,14 @@ module QA ...@@ -33,14 +33,14 @@ module QA
def find_fingerprint(title) def find_fingerprint(title)
within_project_deploy_keys do within_project_deploy_keys do
find_element(:key, title) find_element(:key, text: title)
.find(element_selector_css(:key_fingerprint)).text .find(element_selector_css(:key_fingerprint)).text
end end
end end
def has_key?(title, fingerprint) def has_key?(title, fingerprint)
within_project_deploy_keys do within_project_deploy_keys do
find_element(:key, title) find_element(:key, text: title)
.has_css?(element_selector_css(:key_fingerprint), text: fingerprint) .has_css?(element_selector_css(:key_fingerprint), text: fingerprint)
end end
end end
......
...@@ -4,7 +4,7 @@ require 'securerandom' ...@@ -4,7 +4,7 @@ require 'securerandom'
module QA module QA
module Resource module Resource
class ProjectImportedFromGithub < Project class ProjectImportedFromGithub < Base
attr_accessor :name attr_accessor :name
attr_writer :personal_access_token, :github_repository_path attr_writer :personal_access_token, :github_repository_path
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
context 'Manage', :orchestrated, :github do # https://gitlab.com/gitlab-org/gitlab-ce/issues/58158
context 'Manage', :github, :quarantine do
describe 'Project import from GitHub' do describe 'Project import from GitHub' do
let(:imported_project) do let(:imported_project) do
Resource::ProjectImportedFromGithub.fabricate! do |project| Resource::ProjectImportedFromGithub.fabricate! do |project|
...@@ -48,20 +49,26 @@ module QA ...@@ -48,20 +49,26 @@ module QA
end end
def verify_issues_import def verify_issues_import
Page::Project::Menu.act { click_issues } QA::Support::Retrier.retry_on_exception do
expect(page).to have_content('This is a sample issue') Page::Project::Menu.act { click_issues }
expect(page).to have_content('This is a sample issue')
click_link 'This is a sample issue' click_link 'This is a sample issue'
expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.') expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.')
# Comments # Comments
expect(page).to have_content('This is a comment from @rymai.') comment_text = 'This is a comment from @rymai.'
Page::Issuable::Sidebar.perform do |issuable| Page::Project::Issue::Show.perform do |issue_page|
expect(issuable).to have_label('enhancement') expect(issue_page).to have_comment(comment_text)
expect(issuable).to have_label('help wanted') end
expect(issuable).to have_label('good first issue')
Page::Issuable::Sidebar.perform do |issuable|
expect(issuable).to have_label('enhancement')
expect(issuable).to have_label('help wanted')
expect(issuable).to have_label('good first issue')
end
end end
end end
......
...@@ -33,9 +33,9 @@ module QA ...@@ -33,9 +33,9 @@ module QA
exists exists
end end
def find_element(name, text_filter = nil, wait: Capybara.default_max_wait_time) def find_element(name, text: nil, wait: Capybara.default_max_wait_time)
msg = ["finding :#{name}"] msg = ["finding :#{name}"]
msg << %Q(with text_filter "#{text_filter}") if text_filter msg << %Q(with text "#{text}") if text
msg << "(wait: #{wait})" msg << "(wait: #{wait})"
log(msg.compact.join(' ')) log(msg.compact.join(' '))
...@@ -76,10 +76,15 @@ module QA ...@@ -76,10 +76,15 @@ module QA
super super
end end
def has_element?(name, wait: Capybara.default_max_wait_time) def has_element?(name, text: nil, wait: Capybara.default_max_wait_time)
found = super found = super
log("has_element? :#{name} returned #{found}") msg = ["has_element? :#{name}"]
msg << %Q(with text "#{text}") if text
msg << "(wait: #{wait})"
msg << "returned: #{found}"
log(msg.compact.join(' '))
found found
end end
......
...@@ -62,10 +62,10 @@ describe QA::Support::Page::Logging do ...@@ -62,10 +62,10 @@ describe QA::Support::Page::Logging do
.to output(/found :element/).to_stdout_from_any_process .to output(/found :element/).to_stdout_from_any_process
end end
it 'logs find_element with text_filter' do it 'logs find_element with text' do
expect { subject.find_element(:element, 'foo') } expect { subject.find_element(:element, text: 'foo') }
.to output(/finding :element with text_filter "foo"/).to_stdout_from_any_process .to output(/finding :element with text "foo"/).to_stdout_from_any_process
expect { subject.find_element(:element, 'foo') } expect { subject.find_element(:element, text: 'foo') }
.to output(/found :element/).to_stdout_from_any_process .to output(/found :element/).to_stdout_from_any_process
end end
...@@ -81,7 +81,12 @@ describe QA::Support::Page::Logging do ...@@ -81,7 +81,12 @@ describe QA::Support::Page::Logging do
it 'logs has_element?' do it 'logs has_element?' do
expect { subject.has_element?(:element) } expect { subject.has_element?(:element) }
.to output(/has_element\? :element returned true/).to_stdout_from_any_process .to output(/has_element\? :element \(wait: 2\) returned: true/).to_stdout_from_any_process
end
it 'logs has_element? with text' do
expect { subject.has_element?(:element, text: "some text") }
.to output(/has_element\? :element with text \"some text\" \(wait: 2\) returned: true/).to_stdout_from_any_process
end end
it 'logs has_no_element?' do it 'logs has_no_element?' do
......
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