diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-07-06 15:31:53 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-07-06 15:31:53 +0000 |
commit | a291bcdf0d3ed892dcb805e11a43afcadbc20e8b (patch) | |
tree | 392874244367bd49bbc2b2c14eff5e30ec9b7585 /qa/qa/page | |
parent | 06b9d4b42b3277e1a092169b93c2af17aa3b11a1 (diff) | |
parent | 2ad990bba0cce86bd2e44d2e91e73f874f0f0896 (diff) | |
download | gitlab-ce-a291bcdf0d3ed892dcb805e11a43afcadbc20e8b.tar.gz |
Merge branch 'rc-qa-146' into 'master'
Add a new scenario to test GitHub import
Closes gitlab-qa#146
See merge request gitlab-org/gitlab-ce!19555
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/component/select2.rb | 11 | ||||
-rw-r--r-- | qa/qa/page/issuable/sidebar.rb | 17 | ||||
-rw-r--r-- | qa/qa/page/menu/side.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/project/import/github.rb | 66 | ||||
-rw-r--r-- | qa/qa/page/project/new.rb | 20 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 10 |
6 files changed, 131 insertions, 1 deletions
diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb new file mode 100644 index 00000000000..30829eb0221 --- /dev/null +++ b/qa/qa/page/component/select2.rb @@ -0,0 +1,11 @@ +module QA + module Page + module Component + module Select2 + def select_item(item_text) + find('ul.select2-result-sub > li', text: item_text).click + end + end + end + end +end diff --git a/qa/qa/page/issuable/sidebar.rb b/qa/qa/page/issuable/sidebar.rb new file mode 100644 index 00000000000..dec2ce1eab3 --- /dev/null +++ b/qa/qa/page/issuable/sidebar.rb @@ -0,0 +1,17 @@ +module QA + module Page + module Issuable + class Sidebar < Page::Base + view 'app/views/shared/issuable/_sidebar.html.haml' do + element :labels_block, ".issuable-show-labels" + end + + def has_label?(label) + page.within('.issuable-show-labels') do + !!find('span', text: label) + end + end + end + end + end +end diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb index 6bf4825cf00..333d871c51a 100644 --- a/qa/qa/page/menu/side.rb +++ b/qa/qa/page/menu/side.rb @@ -10,6 +10,8 @@ module QA element :operations_kubernetes_link, "title: _('Kubernetes')" element :issues_link, /link_to.*shortcuts-issues/ element :issues_link_text, "Issues" + element :merge_requests_link, /link_to.*shortcuts-merge_requests/ + element :merge_requests_link_text, "Merge Requests" element :top_level_items, '.sidebar-top-level-items' element :operations_section, "class: 'shortcuts-operations'" element :activity_link, "title: 'Activity'" @@ -62,6 +64,12 @@ module QA end end + def click_merge_requests + within_sidebar do + click_link('Merge Requests') + end + end + def click_wiki within_sidebar do click_link('Wiki') diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb new file mode 100644 index 00000000000..36567927194 --- /dev/null +++ b/qa/qa/page/project/import/github.rb @@ -0,0 +1,66 @@ +module QA + module Page + module Project + module Import + class Github < Page::Base + include Page::Component::Select2 + + view 'app/views/import/github/new.html.haml' do + element :personal_access_token_field, 'text_field_tag :personal_access_token' + element :list_repos_button, "submit_tag _('List your GitHub repositories')" + end + + view 'app/views/import/_githubish_status.html.haml' do + element :project_import_row, 'data: { qa: { repo_path: repo.full_name } }' + element :project_namespace_select + element :project_namespace_field, 'select_tag :namespace_id' + element :project_path_field, 'text_field_tag :path, repo.name' + element :import_button, "_('Import')" + end + + def add_personal_access_token(personal_access_token) + fill_in 'personal_access_token', with: personal_access_token + end + + def list_repos + click_button 'List your GitHub repositories' + end + + def import!(full_path, name) + choose_test_namespace(full_path) + set_path(full_path, name) + import_project(full_path) + end + + private + + def within_repo_path(full_path) + page.within(%Q(tr[data-qa-repo-path="#{full_path}"])) do + yield + end + end + + def choose_test_namespace(full_path) + within_repo_path(full_path) do + click_element :project_namespace_select + end + + select_item(Runtime::Namespace.path) + end + + def set_path(full_path, name) + within_repo_path(full_path) do + fill_in 'path', with: name + end + end + + def import_project(full_path) + within_repo_path(full_path) do + click_button 'Import' + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 186a4724326..7976e96d43b 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -2,6 +2,12 @@ module QA module Page module Project class New < Page::Base + include Page::Component::Select2 + + view 'app/views/projects/new.html.haml' do + element :import_project_tab, "Import project" + end + view 'app/views/projects/_new_project_fields.html.haml' do element :project_namespace_select element :project_namespace_field, /select :namespace_id.*class: 'select2/ @@ -10,10 +16,18 @@ module QA element :project_create_button, "submit 'Create project'" end + view 'app/views/projects/_import_project_pane.html.haml' do + element :import_github, "icon('github', text: 'GitHub')" + end + def choose_test_namespace click_element :project_namespace_select - find('ul.select2-result-sub > li', text: Runtime::Namespace.path).click + select_item(Runtime::Namespace.path) + end + + def go_to_import_project + click_on 'Import project' end def choose_name(name) @@ -27,6 +41,10 @@ module QA def create_new_project click_on 'Create project' end + + def go_to_github_import + click_link 'GitHub' + end end end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 1406edece17..1dcdb59490a 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -22,6 +22,10 @@ module QA element :branches_dropdown end + view 'app/views/projects/_files.html.haml' do + element :tree_holder, '.tree-holder' + end + def project_name find('.qa-project-name').text end @@ -46,6 +50,12 @@ module QA click_element :create_merge_request end + def wait_for_import + wait(reload: true) do + has_css?('.tree-holder') + end + end + def go_to_new_issue click_element :new_menu_toggle |