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 {
:class="classNameBindings"
:data-award-url="note.toggle_award_path"
:data-note-id="note.id"
class="note note-wrapper"
class="note note-wrapper qa-noteable-note-item"
>
<div v-once class="timeline-icon">
<user-avatar-link
......
......@@ -77,8 +77,8 @@ module QA
page.evaluate_script('xhr.status') == 200
end
def find_element(name, text_filter = nil, wait: Capybara.default_max_wait_time)
find(element_selector_css(name), wait: wait, text: text_filter)
def find_element(name, text: nil, wait: Capybara.default_max_wait_time)
find(element_selector_css(name), wait: wait, text: text)
end
def all_elements(name)
......@@ -109,8 +109,8 @@ module QA
element.select value.to_s.capitalize
end
def has_element?(name, wait: Capybara.default_max_wait_time)
has_css?(element_selector_css(name), wait: wait)
def has_element?(name, text: nil, wait: Capybara.default_max_wait_time)
has_css?(element_selector_css(name), wait: wait, text: text)
end
def has_no_element?(name, wait: Capybara.default_max_wait_time)
......
......@@ -45,7 +45,7 @@ module QA
private
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
# May need to click again because it is possible to click the button quicker than the JS is bound
wait(reload: false) do
......
......@@ -29,12 +29,19 @@ module QA
choose_test_namespace(full_path)
set_path(full_path, name)
import_project(full_path)
wait_for_success
end
private
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
end
end
......@@ -44,18 +51,24 @@ module QA
click_element :project_namespace_select
end
select_item(Runtime::Namespace.path)
search_and_select(Runtime::Namespace.path)
end
def set_path(full_path, name)
within_repo_path(full_path) do
fill_in 'path', with: name
fill_element(:project_path_field, name)
end
end
def import_project(full_path)
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
......
......@@ -23,6 +23,10 @@ module QA
element :filter_options
end
view 'app/assets/javascripts/notes/components/noteable_note.vue' do
element :noteable_note_item
end
# Adds a comment to an issue
# attachment option should be an absolute path
def comment(text, attachment: nil)
......@@ -36,6 +40,12 @@ module QA
click_element :comment_button
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
select_filter_with_text('Show comments only')
end
......@@ -54,7 +64,7 @@ module QA
retry_on_exception do
click_body
click_element :discussion_filter
find_element(:filter_options, text).click
find_element(:filter_options, text: text).click
end
end
end
......
......@@ -43,7 +43,7 @@ module QA::Page
end
def go_to_job(job_name)
find_element(:job_link, job_name).click
find_element(:job_link, text: job_name).click
end
def go_to_first_job
......
......@@ -33,14 +33,14 @@ module QA
def find_fingerprint(title)
within_project_deploy_keys do
find_element(:key, title)
find_element(:key, text: title)
.find(element_selector_css(:key_fingerprint)).text
end
end
def has_key?(title, fingerprint)
within_project_deploy_keys do
find_element(:key, title)
find_element(:key, text: title)
.has_css?(element_selector_css(:key_fingerprint), text: fingerprint)
end
end
......
......@@ -4,7 +4,7 @@ require 'securerandom'
module QA
module Resource
class ProjectImportedFromGithub < Project
class ProjectImportedFromGithub < Base
attr_accessor :name
attr_writer :personal_access_token, :github_repository_path
......
# frozen_string_literal: true
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
let(:imported_project) do
Resource::ProjectImportedFromGithub.fabricate! do |project|
......@@ -48,6 +49,7 @@ module QA
end
def verify_issues_import
QA::Support::Retrier.retry_on_exception do
Page::Project::Menu.act { click_issues }
expect(page).to have_content('This is a sample issue')
......@@ -56,7 +58,11 @@ module QA
expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.')
# Comments
expect(page).to have_content('This is a comment from @rymai.')
comment_text = 'This is a comment from @rymai.'
Page::Project::Issue::Show.perform do |issue_page|
expect(issue_page).to have_comment(comment_text)
end
Page::Issuable::Sidebar.perform do |issuable|
expect(issuable).to have_label('enhancement')
......@@ -64,6 +70,7 @@ module QA
expect(issuable).to have_label('good first issue')
end
end
end
def verify_merge_requests_import
Page::Project::Menu.act { click_merge_requests }
......
......@@ -33,9 +33,9 @@ module QA
exists
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 << %Q(with text_filter "#{text_filter}") if text_filter
msg << %Q(with text "#{text}") if text
msg << "(wait: #{wait})"
log(msg.compact.join(' '))
......@@ -76,10 +76,15 @@ module QA
super
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
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
end
......
......@@ -62,10 +62,10 @@ describe QA::Support::Page::Logging do
.to output(/found :element/).to_stdout_from_any_process
end
it 'logs find_element with text_filter' do
expect { subject.find_element(:element, 'foo') }
.to output(/finding :element with text_filter "foo"/).to_stdout_from_any_process
expect { subject.find_element(:element, 'foo') }
it 'logs find_element with text' do
expect { subject.find_element(:element, text: 'foo') }
.to output(/finding :element with text "foo"/).to_stdout_from_any_process
expect { subject.find_element(:element, text: 'foo') }
.to output(/found :element/).to_stdout_from_any_process
end
......@@ -81,7 +81,12 @@ describe QA::Support::Page::Logging do
it 'logs has_element?' do
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
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