提交 eba25212 编写于 作者: S Sanad Liaquat

Merge branch 'qa-transfer-project-spec' into 'master'

QA: transfer project spec

See merge request gitlab-org/gitlab-ce!28255
......@@ -347,7 +347,7 @@
= _('Settings')
%li.divider.fly-out-top-item
= nav_link(path: %w[projects#edit]) do
= link_to edit_project_path(@project), title: _('General') do
= link_to edit_project_path(@project), title: _('General'), class: 'qa-general-settings-link' do
%span
= _('General')
= nav_link(controller: :project_members) do
......
.form-actions
= button_tag 'Commit changes', class: 'btn commit-btn js-commit-button btn-success'
= button_tag 'Commit changes', class: 'btn commit-btn js-commit-button btn-success qa-commit-button'
= link_to 'Cancel', cancel_path,
class: 'btn btn-cancel', data: {confirm: leave_edit_message}
......
......@@ -32,7 +32,7 @@
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'select2', tabindex: '-1'
.file-editor.code
%pre.js-edit-mode-pane#editor= params[:content] || local_assigns[:blob_data]
%pre.js-edit-mode-pane.qa-editor#editor= params[:content] || local_assigns[:blob_data]
- if local_assigns[:path]
.js-edit-mode-pane#preview.hide
.center
......
......@@ -121,7 +121,7 @@
%li= _('You can only transfer the project to namespaces you manage.')
%li= _('You will need to update your local repositories to point to the new location.')
%li= _('Project visibility level will be changed to match namespace rules when transferring to a group.')
= f.submit 'Transfer project', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => transfer_project_message(@project) }
= f.submit 'Transfer project', class: "btn btn-remove js-confirm-danger qa-transfer-button", data: { "confirm-danger-message" => transfer_project_message(@project) }
- if @project.forked? && can?(current_user, :remove_fork_project, @project)
.sub-section
......
#modal-confirm-danger.modal{ tabindex: -1 }
#modal-confirm-danger.modal.qa-confirm-modal{ tabindex: -1 }
.modal-dialog
.modal-content
.modal-header
......@@ -17,6 +17,6 @@
to proceed or close this modal to cancel.
.form-group
= text_field_tag 'confirm_name_input', '', class: 'form-control js-confirm-danger-input'
= text_field_tag 'confirm_name_input', '', class: 'form-control js-confirm-danger-input qa-confirm-input'
.form-actions
= submit_tag _('Confirm'), class: "btn btn-danger js-confirm-danger-submit"
= submit_tag _('Confirm'), class: "btn btn-danger js-confirm-danger-submit qa-confirm-button"
......@@ -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'
......
# 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
......@@ -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
......
# 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
......@@ -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
......
# 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
# 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
......@@ -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
......
......@@ -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
......
......@@ -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
......
# 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
......@@ -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'
......
......@@ -67,6 +67,10 @@ module QA
visibility: 'public'
}
end
def full_path
sandbox.path + ' / ' + path
end
end
end
end
# 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册