diff options
author | Sanad Liaquat <sliaquat@gitlab.com> | 2019-07-02 08:05:32 +0000 |
---|---|---|
committer | Sanad Liaquat <sliaquat@gitlab.com> | 2019-07-02 08:05:32 +0000 |
commit | eba252121aef8a31eb3e39e82f71d7fa9a0ad3b1 (patch) | |
tree | e65590a730157c5c4be7eb9e5df69f4ecfc0e498 /qa | |
parent | 3fd4c77ee4777464af74acd0c9dda319e1d29a44 (diff) | |
parent | 700853a178f7a512408c08ff7da9737e68b783ce (diff) | |
download | gitlab-ce-eba252121aef8a31eb3e39e82f71d7fa9a0ad3b1.tar.gz |
Merge branch 'qa-transfer-project-spec' into 'master'
QA: transfer project spec
See merge request gitlab-org/gitlab-ce!28255
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/component/confirm_modal.rb | 25 | ||||
-rw-r--r-- | qa/qa/page/component/select2.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/file/edit.rb | 13 | ||||
-rw-r--r-- | qa/qa/page/file/form.rb | 27 | ||||
-rw-r--r-- | qa/qa/page/file/shared/commit_button.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/file/shared/editor.rb | 33 | ||||
-rw-r--r-- | qa/qa/page/file/show.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/settings/advanced.rb | 16 | ||||
-rw-r--r-- | qa/qa/page/project/settings/main.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/project.rb | 29 | ||||
-rw-r--r-- | qa/qa/page/project/sub_menus/settings.rb | 9 | ||||
-rw-r--r-- | qa/qa/resource/group.rb | 4 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb | 57 |
14 files changed, 222 insertions, 25 deletions
@@ -162,9 +162,12 @@ module QA module File autoload :Form, 'qa/page/file/form' autoload :Show, 'qa/page/file/show' + autoload :Edit, 'qa/page/file/edit' module Shared autoload :CommitMessage, 'qa/page/file/shared/commit_message' + autoload :CommitButton, 'qa/page/file/shared/commit_button' + autoload :Editor, 'qa/page/file/shared/editor' end end @@ -218,6 +221,7 @@ module QA autoload :Operations, 'qa/page/project/sub_menus/operations' autoload :Repository, 'qa/page/project/sub_menus/repository' autoload :Settings, 'qa/page/project/sub_menus/settings' + autoload :Project, 'qa/page/project/sub_menus/project' end module Issue @@ -323,6 +327,7 @@ module QA autoload :DropdownFilter, 'qa/page/component/dropdown_filter' autoload :UsersSelect, 'qa/page/component/users_select' autoload :Note, 'qa/page/component/note' + autoload :ConfirmModal, 'qa/page/component/confirm_modal' module Issuable autoload :Common, 'qa/page/component/issuable/common' diff --git a/qa/qa/page/component/confirm_modal.rb b/qa/qa/page/component/confirm_modal.rb new file mode 100644 index 00000000000..355e2783fb7 --- /dev/null +++ b/qa/qa/page/component/confirm_modal.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module ConfirmModal + def self.included(base) + base.view 'app/views/shared/_confirm_modal.html.haml' do + element :confirm_modal + element :confirm_input + element :confirm_button + end + end + + def fill_confirmation_text(text) + fill_element :confirm_input, text + end + + def click_confirm_button + click_element :confirm_button + end + end + end + end +end diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb index e40bc4b1d3e..85d4abcde9b 100644 --- a/qa/qa/page/component/select2.rb +++ b/qa/qa/page/component/select2.rb @@ -18,6 +18,10 @@ module QA find('.select2-input').set(item_text) select_item(item_text) end + + def expand_select_list + find('span.select2-arrow').click + end end end end diff --git a/qa/qa/page/file/edit.rb b/qa/qa/page/file/edit.rb new file mode 100644 index 00000000000..3a4a1837b1c --- /dev/null +++ b/qa/qa/page/file/edit.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module QA + module Page + module File + class Edit < Page::Base + include Shared::CommitMessage + include Shared::CommitButton + include Shared::Editor + end + end + end +end diff --git a/qa/qa/page/file/form.rb b/qa/qa/page/file/form.rb index e42de7d65c5..a6251f185f9 100644 --- a/qa/qa/page/file/form.rb +++ b/qa/qa/page/file/form.rb @@ -6,14 +6,11 @@ module QA class Form < Page::Base include Shared::CommitMessage include Page::Component::DropdownFilter + include Shared::CommitButton + include Shared::Editor view 'app/views/projects/blob/_editor.html.haml' do element :file_name, "text_field_tag 'file_name'" # rubocop:disable QA/ElementWithPattern - element :editor, '#editor' # rubocop:disable QA/ElementWithPattern - end - - view 'app/views/projects/_commit_button.html.haml' do - element :commit_changes, "button_tag 'Commit changes'" # rubocop:disable QA/ElementWithPattern end view 'app/views/projects/blob/_template_selectors.html.haml' do @@ -28,20 +25,6 @@ module QA fill_in 'file_name', with: name end - def add_content(content) - text_area.set content - end - - def remove_content - text_area.send_keys([:command, 'a'], :backspace) - end - - def commit_changes - click_on 'Commit changes' - - finished_loading? - end - def select_template(template_type, template) click_element :template_type_dropdown click_link template_type @@ -60,12 +43,6 @@ module QA end filter_and_select template end - - private - - def text_area - find('#editor>textarea', visible: false) - end end end end diff --git a/qa/qa/page/file/shared/commit_button.rb b/qa/qa/page/file/shared/commit_button.rb new file mode 100644 index 00000000000..d8e751dd7b6 --- /dev/null +++ b/qa/qa/page/file/shared/commit_button.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module QA + module Page + module File + module Shared + module CommitButton + def self.included(base) + base.view 'app/views/projects/_commit_button.html.haml' do + element :commit_button + end + end + + def commit_changes + click_element(:commit_button) + end + end + end + end + end +end diff --git a/qa/qa/page/file/shared/editor.rb b/qa/qa/page/file/shared/editor.rb new file mode 100644 index 00000000000..448c09cfbca --- /dev/null +++ b/qa/qa/page/file/shared/editor.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module QA + module Page + module File + module Shared + module Editor + def self.included(base) + base.view 'app/views/projects/blob/_editor.html.haml' do + element :editor + end + end + + def add_content(content) + text_area.set content + end + + def remove_content + text_area.send_keys([:command, 'a'], :backspace) + end + + private + + def text_area + within_element :editor do + find('textarea', visible: false) + end + end + end + end + end + end +end diff --git a/qa/qa/page/file/show.rb b/qa/qa/page/file/show.rb index eaf88c6e69e..92f9181f99d 100644 --- a/qa/qa/page/file/show.rb +++ b/qa/qa/page/file/show.rb @@ -5,6 +5,8 @@ module QA module File class Show < Page::Base include Shared::CommitMessage + include Project::SubMenus::Settings + include Project::SubMenus::Common view 'app/helpers/blob_helper.rb' do element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index 75530832860..ab4e3d757b6 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -5,9 +5,13 @@ module QA module Project module Settings class Advanced < Page::Base + include Component::Select2 + include Component::ConfirmModal + view 'app/views/projects/edit.html.haml' do element :project_path_field element :change_path_button + element :transfer_button end def update_project_path_to(path) @@ -22,6 +26,18 @@ module QA def click_change_path_button click_element :change_path_button end + + def select_transfer_option(namespace) + search_and_select(namespace) + end + + def transfer_project!(project_name, namespace) + expand_select_list + select_transfer_option(namespace) + click_element(:transfer_button) + fill_confirmation_text(project_name) + click_confirm_button + end end end end diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb index d1f3b15f950..dbbe62e3b1d 100644 --- a/qa/qa/page/project/settings/main.rb +++ b/qa/qa/page/project/settings/main.rb @@ -6,6 +6,8 @@ module QA module Settings class Main < Page::Base include Common + include Component::Select2 + include SubMenus::Project view 'app/views/projects/edit.html.haml' do element :advanced_settings diff --git a/qa/qa/page/project/sub_menus/project.rb b/qa/qa/page/project/sub_menus/project.rb new file mode 100644 index 00000000000..5e0ee3c274a --- /dev/null +++ b/qa/qa/page/project/sub_menus/project.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module SubMenus + module Project + include Common + + def self.included(base) + base.class_eval do + view 'app/views/layouts/nav/sidebar/_project.html.haml' do + element :link_project + end + end + end + + def click_project + retry_on_exception do + within_sidebar do + click_element(:link_project) + end + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb index 22743ebd0a1..88b45ec55ae 100644 --- a/qa/qa/page/project/sub_menus/settings.rb +++ b/qa/qa/page/project/sub_menus/settings.rb @@ -10,6 +10,7 @@ module QA view 'app/views/layouts/nav/sidebar/_project.html.haml' do element :settings_item element :link_members_settings + element :general_settings_link end end end @@ -38,6 +39,14 @@ module QA end end + def go_to_general_settings + hover_settings do + within_submenu do + click_element :general_settings_link + end + end + end + def click_settings within_sidebar do click_on 'Settings' diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index 0b567a474c8..44d9dc8f296 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -67,6 +67,10 @@ module QA visibility: 'public' } end + + def full_path + sandbox.path + ' / ' + path + end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb new file mode 100644 index 00000000000..a9de64e357a --- /dev/null +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module QA + context 'Manage' do + describe 'Project transfer between groups' do + it 'user transfers a project between groups' do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.act { sign_in_using_credentials } + + source_group = Resource::Group.fabricate! do |group| + group.path = 'source-group' + end + + target_group = Resource::Group.fabricate! do |group| + group.path = 'target-group' + end + + project = Resource::Project.fabricate! do |project| + project.group = source_group + project.name = 'transfer-project' + project.initialize_with_readme = true + end + + project.visit! + + Page::Project::Show.perform do |project| + project.click_file('README.md') + end + + Page::File::Show.perform(&:click_edit) + + edited_readme_content = 'Here is the edited content.' + + Page::File::Edit.perform do |file| + file.remove_content + file.add_content(edited_readme_content) + file.commit_changes + end + + Page::File::Show.perform(&:go_to_general_settings) + + Page::Project::Settings::Main.perform(&:expand_advanced_settings) + + Page::Project::Settings::Advanced.perform do |advanced| + advanced.transfer_project!(project.name, target_group.full_path) + end + + Page::Project::Settings::Main.perform(&:click_project) + + Page::Project::Show.perform do |project| + expect(project).to have_text(target_group.path) + expect(project).to have_text(edited_readme_content) + end + end + end + end +end |