diff options
author | Ramya Authappan <rauthappan@gitlab.com> | 2019-02-27 11:33:55 +0000 |
---|---|---|
committer | Ramya Authappan <rauthappan@gitlab.com> | 2019-02-27 11:33:55 +0000 |
commit | da8fce1f04e169837ec3526617464836f741e276 (patch) | |
tree | 9e15f4e85e2d4a9787692ce5b5ef5fe495081d64 /qa | |
parent | d901bfefcff168a5d4a6c76780731dc7130f12e5 (diff) | |
parent | ddef2f1fbd3af7e91cb568adc8258043e05f15fc (diff) | |
download | gitlab-ce-da8fce1f04e169837ec3526617464836f741e276.tar.gz |
Merge branch 'qa-fix-import-github-repo-spec-2' into 'master'
Fix `import_github_repo_spec.rb`
Closes #55700
See merge request gitlab-org/gitlab-ce!25133
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/base.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/group/show.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/import/github.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/project/issue/show.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/show.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/settings/deploy_keys.rb | 4 | ||||
-rw-r--r-- | qa/qa/resource/project_imported_from_github.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb | 29 | ||||
-rw-r--r-- | qa/qa/support/page/logging.rb | 13 | ||||
-rw-r--r-- | qa/spec/page/logging_spec.rb | 15 |
10 files changed, 74 insertions, 34 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 05e38aba77d..11ebd70292e 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -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) diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index 9d6bd338027..41716326685 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -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 diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb index 488157d9878..45c8d834a74 100644 --- a/qa/qa/page/project/import/github.rb +++ b/qa/qa/page/project/import/github.rb @@ -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 diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 1c25be5fd0c..9df3db1bba0 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -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 diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 22b0a168964..6f8a66bf527 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -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 diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index 5da8d352e74..e0f9e84096d 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -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 diff --git a/qa/qa/resource/project_imported_from_github.rb b/qa/qa/resource/project_imported_from_github.rb index 3f02fe885a9..0d25e7dd842 100644 --- a/qa/qa/resource/project_imported_from_github.rb +++ b/qa/qa/resource/project_imported_from_github.rb @@ -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 diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index 3ce48de2c25..a9eafd61a91 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -1,7 +1,8 @@ # 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,20 +49,26 @@ module QA end def verify_issues_import - Page::Project::Menu.act { click_issues } - expect(page).to have_content('This is a sample issue') + QA::Support::Retrier.retry_on_exception do + 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 - expect(page).to have_content('This is a comment from @rymai.') + # Comments + comment_text = 'This is a comment from @rymai.' - 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') + 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') + expect(issuable).to have_label('help wanted') + expect(issuable).to have_label('good first issue') + end end end diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb index 5e97a92a6e3..69b6332ecce 100644 --- a/qa/qa/support/page/logging.rb +++ b/qa/qa/support/page/logging.rb @@ -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 diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index a6e9601cee4..707a7ff6d98 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -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 |