Commit da62fa10 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'gitlab-qa-130-geo-project-transfer' into 'master'

Geo project replication QA

See merge request gitlab-org/gitlab-ee!3893
parents 7539fbed c9d6b7d7
......@@ -3,7 +3,7 @@
.settings-header
%h4
Deploy Keys
%button.btn.js-settings-toggle.qa-expand-deploy-keys
%button.btn.js-settings-toggle
= expanded ? 'Collapse' : 'Expand'
%p
Deploy keys allow read-only or read-write (if enabled) access to your repository. Deploy keys can be used for CI, staging or production servers. You can create a deploy key or add an existing one.
......
......@@ -106,18 +106,20 @@ module QA
autoload :New, 'qa/page/project/new'
autoload :Show, 'qa/page/project/show'
module Pipeline
autoload :Index, 'qa/page/project/pipeline/index'
autoload :Show, 'qa/page/project/pipeline/show'
end
module Settings
autoload :Common, 'qa/page/project/settings/common'
autoload :Advanced, 'qa/page/project/settings/advanced'
autoload :Main, 'qa/page/project/settings/main'
autoload :Repository, 'qa/page/project/settings/repository'
autoload :CICD, 'qa/page/project/settings/ci_cd'
autoload :DeployKeys, 'qa/page/project/settings/deploy_keys'
autoload :Runners, 'qa/page/project/settings/runners'
end
module Pipeline
autoload :Index, 'qa/page/project/pipeline/index'
autoload :Show, 'qa/page/project/pipeline/show'
end
end
module Profile
......
......@@ -3,10 +3,21 @@ module QA
module Dashboard
class Projects < Page::Base
view 'app/views/dashboard/projects/index.html.haml'
view 'app/views/shared/projects/_search_form.html.haml' do
element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/
end
def go_to_project(name)
filter_by_name(name)
find_link(text: name).click
end
def filter_by_name(name)
page.within('form#project-filter-form') do
fill_in :name, with: name
end
end
end
end
end
......
......@@ -4,6 +4,7 @@ module QA
class Side < Page::Base
view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :settings_item
element :settings_link, 'link_to edit_project_path'
element :repository_link, "title: 'Repository'"
element :pipelines_settings_link, "title: 'CI / CD'"
element :top_level_items, '.sidebar-top-level-items'
......@@ -31,6 +32,12 @@ module QA
end
end
def go_to_settings
within_sidebar do
click_on 'Settings'
end
end
private
def hover_settings
......
module QA
module Page
module Project
module Settings
class Advanced < Page::Base
view 'app/views/projects/edit.html.haml' do
element :project_path_field, 'f.text_field :path'
element :project_name_field, 'f.text_field :name'
element :rename_project_button, "f.submit 'Rename project'"
end
def rename_to(path)
fill_project_name(path)
fill_project_path(path)
rename_project!
end
def fill_project_path(path)
fill_in :project_path, with: path
end
def fill_project_name(name)
fill_in :project_name, with: name
end
def rename_project!
click_on 'Rename project'
end
end
end
end
end
end
......@@ -3,20 +3,23 @@ module QA
module Project
module Settings
module Common
def expand(element_name)
page.within('#content-body') do
click_element(element_name)
yield
def self.included(base)
base.class_eval do
view 'app/views/projects/edit.html.haml' do
element :advanced_settings_expand, "= expanded ? 'Collapse' : 'Expand'"
end
end
end
# Click the Expand button present in the specified section
#
# @param [String] name present in the container in the DOM
def expand_section(name)
page.within('#content-body') do
page.within('section', text: name) do
click_button 'Expand'
click_button('Expand')
yield
yield if block_given?
end
end
end
......
module QA
module Page
module Project
module Settings
class Main < Page::Base
include Common
view 'app/views/projects/edit.html.haml' do
element :advanced_settings_section, 'Advanced settings'
end
def expand_advanced_settings(&block)
expand_section('Advanced settings') do
Advanced.perform(&block)
end
end
end
end
end
end
end
......@@ -6,11 +6,11 @@ module QA
include Common
view 'app/views/projects/deploy_keys/_index.html.haml' do
element :expand_deploy_keys
element :deploy_keys_section, 'Deploy Keys'
end
def expand_deploy_keys(&block)
expand(:expand_deploy_keys) do
expand_section('Deploy Keys') do
DeployKeys.perform(&block)
end
end
......
......@@ -23,11 +23,11 @@ module QA
# In case of an address that is a symbol we will try to guess address
# based on `Runtime::Scenario#something_address`.
#
def visit(address, page, &block)
def visit(address, page = nil, &block)
Browser::Session.new(address, page).perform(&block)
end
def self.visit(address, page, &block)
def self.visit(address, page = nil, &block)
new.visit(address, page, &block)
end
......
module QA
feature 'GitLab Geo project rename replication', :geo do
scenario 'user renames project' do
# create the project and push code
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
Page::Main::Login.act { sign_in_using_credentials }
project = Factory::Resource::Project.fabricate! do |project|
project.name = 'geo-before-rename'
project.description = 'Geo project to be renamed'
end
geo_project_name = project.name
expect(project.name).to include 'geo-before-rename'
Factory::Repository::Push.fabricate! do |push|
push.project = project
push.file_name = 'README.md'
push.file_content = '# This is Geo project!'
push.commit_message = 'Add README.md'
end
# rename the project
Page::Menu::Main.act { go_to_projects }
Page::Dashboard::Projects.perform do |dashboard|
dashboard.go_to_project(geo_project_name)
end
Page::Menu::Side.act { go_to_settings }
geo_project_renamed = "geo-after-rename-#{SecureRandom.hex(8)}"
Page::Project::Settings::Main.perform do |settings|
settings.expand_advanced_settings do |page|
page.rename_to(geo_project_renamed)
end
end
sleep 2 # wait for replication
# check renamed project exist on secondary node
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
Page::Main::OAuth.act do
authorize! if needs_authorization?
end
expect(page).to have_content 'You are on a secondary (read-only) Geo node'
Page::Menu::Main.perform do |menu|
menu.go_to_projects
expect(page).to have_content(geo_project_renamed)
end
Page::Dashboard::Projects.perform do |dashboard|
dashboard.go_to_project(geo_project_renamed)
end
Page::Project::Show.perform do
expect(page).to have_content 'README.md'
expect(page).to have_content 'This is Geo project!'
end
end
end
end
end
end
......@@ -4,7 +4,7 @@ module QA
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::Project.fabricate! do |project|
project = Factory::Resource::Project.fabricate! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......@@ -12,21 +12,11 @@ module QA
geo_project_name = Page::Project::Show.act { project_name }
expect(geo_project_name).to include 'geo-project'
Git::Repository.perform do |repository|
repository.location = Page::Project::Show.act do
choose_repository_clone_http
repository_location
end
repository.use_default_credentials
repository.act do
clone
configure_identity('GitLab QA', 'root@gitlab.com')
add_file('README.md', '# This is Geo project!')
commit('Add README.md')
push_changes
end
Factory::Repository::Push.fabricate! do |push|
push.file_name = 'README.md'
push.file_content = '# This is Geo project!'
push.commit_message = 'Add README.md'
push.project = project
end
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) 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