Commit ca440758 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'qa-60-reorganize-menu-classes' into 'master'

Reorganize menu files

Closes gitlab-org/quality/team-tasks#60

See merge request gitlab-org/gitlab-ce!22115
parents 2a566202 b7a5b204
...@@ -120,6 +120,7 @@ module QA ...@@ -120,6 +120,7 @@ module QA
module Main module Main
autoload :Login, 'qa/page/main/login' autoload :Login, 'qa/page/main/login'
autoload :Menu, 'qa/page/main/menu'
autoload :OAuth, 'qa/page/main/oauth' autoload :OAuth, 'qa/page/main/oauth'
autoload :SignUp, 'qa/page/main/sign_up' autoload :SignUp, 'qa/page/main/sign_up'
end end
...@@ -128,13 +129,6 @@ module QA ...@@ -128,13 +129,6 @@ module QA
autoload :Common, 'qa/page/settings/common' autoload :Common, 'qa/page/settings/common'
end end
module Menu
autoload :Main, 'qa/page/menu/main'
autoload :Side, 'qa/page/menu/side'
autoload :Admin, 'qa/page/menu/admin'
autoload :Profile, 'qa/page/menu/profile'
end
module Dashboard module Dashboard
autoload :Projects, 'qa/page/dashboard/projects' autoload :Projects, 'qa/page/dashboard/projects'
autoload :Groups, 'qa/page/dashboard/groups' autoload :Groups, 'qa/page/dashboard/groups'
...@@ -158,6 +152,7 @@ module QA ...@@ -158,6 +152,7 @@ module QA
autoload :New, 'qa/page/project/new' autoload :New, 'qa/page/project/new'
autoload :Show, 'qa/page/project/show' autoload :Show, 'qa/page/project/show'
autoload :Activity, 'qa/page/project/activity' autoload :Activity, 'qa/page/project/activity'
autoload :Menu, 'qa/page/project/menu'
module Import module Import
autoload :Github, 'qa/page/project/import/github' autoload :Github, 'qa/page/project/import/github'
...@@ -222,6 +217,7 @@ module QA ...@@ -222,6 +217,7 @@ module QA
end end
module Profile module Profile
autoload :Menu, 'qa/page/profile/menu'
autoload :PersonalAccessTokens, 'qa/page/profile/personal_access_tokens' autoload :PersonalAccessTokens, 'qa/page/profile/personal_access_tokens'
autoload :SSHKeys, 'qa/page/profile/ssh_keys' autoload :SSHKeys, 'qa/page/profile/ssh_keys'
end end
...@@ -240,6 +236,8 @@ module QA ...@@ -240,6 +236,8 @@ module QA
end end
module Admin module Admin
autoload :Menu, 'qa/page/admin/menu'
module Settings module Settings
autoload :Repository, 'qa/page/admin/settings/repository' autoload :Repository, 'qa/page/admin/settings/repository'
......
...@@ -43,7 +43,7 @@ module QA ...@@ -43,7 +43,7 @@ module QA
# to `allow_to_push` variable. # to `allow_to_push` variable.
return branch unless @protected return branch unless @protected
Page::Menu::Side.act do Page::Project::Menu.act do
click_repository_settings click_repository_settings
end end
......
...@@ -24,7 +24,7 @@ module QA ...@@ -24,7 +24,7 @@ module QA
def fabricate! def fabricate!
project.visit! project.visit!
Page::Menu::Side.act do Page::Project::Menu.act do
click_repository_settings click_repository_settings
end end
......
...@@ -32,7 +32,7 @@ module QA ...@@ -32,7 +32,7 @@ module QA
puts "Visited project page" puts "Visited project page"
Capybara::Screenshot.screenshot_and_save_page Capybara::Screenshot.screenshot_and_save_page
return if Page::Menu::Main.act { has_personal_area?(wait: 0) } return if Page::Main::Menu.act { has_personal_area?(wait: 0) }
puts "Not signed in. Attempting to sign in again." puts "Not signed in. Attempting to sign in again."
Capybara::Screenshot.screenshot_and_save_page Capybara::Screenshot.screenshot_and_save_page
......
...@@ -16,7 +16,7 @@ module QA ...@@ -16,7 +16,7 @@ module QA
def fabricate! def fabricate!
@project.visit! @project.visit!
Page::Menu::Side.act { click_operations_kubernetes } Page::Project::Menu.act { click_operations_kubernetes }
Page::Project::Operations::Kubernetes::Index.perform do |page| Page::Project::Operations::Kubernetes::Index.perform do |page|
page.add_kubernetes_cluster page.add_kubernetes_cluster
......
...@@ -12,8 +12,8 @@ module QA ...@@ -12,8 +12,8 @@ module QA
end end
def fabricate! def fabricate!
Page::Menu::Main.act { go_to_profile_settings } Page::Main::Menu.act { go_to_profile_settings }
Page::Menu::Profile.act { click_access_tokens } Page::Profile::Menu.act { click_access_tokens }
Page::Profile::PersonalAccessTokens.perform do |page| Page::Profile::PersonalAccessTokens.perform do |page|
page.fill_token_name(name || 'api-test-token') page.fill_token_name(name || 'api-test-token')
......
...@@ -17,7 +17,7 @@ module QA ...@@ -17,7 +17,7 @@ module QA
def fabricate! def fabricate!
project.visit! project.visit!
Page::Menu::Side.act do Page::Project::Menu.act do
click_issues click_issues
click_milestones click_milestones
end end
......
...@@ -26,7 +26,7 @@ module QA ...@@ -26,7 +26,7 @@ module QA
def fabricate! def fabricate!
project.visit! project.visit!
Page::Menu::Side.act { click_ci_cd_settings } Page::Project::Menu.act { click_ci_cd_settings }
Service::Runner.new(name).tap do |runner| Service::Runner.new(name).tap do |runner|
Page::Project::Settings::CICD.perform do |settings| Page::Project::Settings::CICD.perform do |settings|
......
...@@ -11,7 +11,7 @@ module QA ...@@ -11,7 +11,7 @@ module QA
end end
def fabricate! def fabricate!
Page::Menu::Main.act { go_to_groups } Page::Main::Menu.act { go_to_groups }
Page::Dashboard::Groups.perform do |page| Page::Dashboard::Groups.perform do |page|
if page.has_group?(@name) if page.has_group?(@name)
......
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
def fabricate! def fabricate!
project.visit! project.visit!
Page::Menu::Side.act { click_ci_cd_settings } Page::Project::Menu.act { click_ci_cd_settings }
Page::Project::Settings::CICD.perform do |setting| Page::Project::Settings::CICD.perform do |setting|
setting.expand_secret_variables do |page| setting.expand_secret_variables do |page|
......
...@@ -27,8 +27,8 @@ module QA ...@@ -27,8 +27,8 @@ module QA
end end
def fabricate! def fabricate!
Page::Menu::Main.act { go_to_profile_settings } Page::Main::Menu.act { go_to_profile_settings }
Page::Menu::Profile.act { click_ssh_keys } Page::Profile::Menu.act { click_ssh_keys }
Page::Profile::SSHKeys.perform do |page| Page::Profile::SSHKeys.perform do |page|
page.add_key(public_key, title) page.add_key(public_key, title)
......
...@@ -38,8 +38,8 @@ module QA ...@@ -38,8 +38,8 @@ module QA
def fabricate! def fabricate!
# Don't try to log-out if we're not logged-in # Don't try to log-out if we're not logged-in
if Page::Menu::Main.act { has_personal_area?(wait: 0) } if Page::Main::Menu.act { has_personal_area?(wait: 0) }
Page::Menu::Main.perform { |main| main.sign_out } Page::Main::Menu.perform { |main| main.sign_out }
end end
if credentials_given? if credentials_given?
......
...@@ -10,7 +10,7 @@ module QA ...@@ -10,7 +10,7 @@ module QA
end end
def fabricate! def fabricate!
Page::Menu::Side.act { click_wiki } Page::Project::Menu.act { click_wiki }
Page::Project::Wiki::New.perform do |page| Page::Project::Wiki::New.perform do |page|
page.go_to_create_first_page page.go_to_create_first_page
page.set_title(@title) page.set_title(@title)
......
...@@ -6,8 +6,8 @@ module QA ...@@ -6,8 +6,8 @@ module QA
raise ArgumentError unless traits.include?(:enabled) raise ArgumentError unless traits.include?(:enabled)
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.act { sign_in_using_credentials }
Page::Menu::Main.act { go_to_admin_area } Page::Main::Menu.act { go_to_admin_area }
Page::Menu::Admin.act { go_to_settings } Page::Admin::Menu.act { go_to_repository_settings }
Page::Admin::Settings::Main.perform do |setting| Page::Admin::Settings::Main.perform do |setting|
setting.expand_repository_storage do |page| setting.expand_repository_storage do |page|
...@@ -16,7 +16,7 @@ module QA ...@@ -16,7 +16,7 @@ module QA
end end
end end
QA::Page::Menu::Main.act { sign_out } QA::Page::Main::Menu.act { sign_out }
end end
end end
end end
......
# frozen_string_literal: true
module QA module QA
module Page module Page
module Menu module Admin
class Admin < Page::Base class Menu < Page::Base
view 'app/views/layouts/nav/sidebar/_admin.html.haml' do view 'app/views/layouts/nav/sidebar/_admin.html.haml' do
element :admin_sidebar element :admin_sidebar
element :admin_sidebar_submenu element :admin_sidebar_submenu
......
...@@ -37,13 +37,13 @@ module QA ...@@ -37,13 +37,13 @@ module QA
# we are already logged-in so we check both cases here. # we are already logged-in so we check both cases here.
wait(max: 500) do wait(max: 500) do
has_css?('.login-page') || has_css?('.login-page') ||
Page::Menu::Main.act { has_personal_area?(wait: 0) } Page::Main::Menu.act { has_personal_area?(wait: 0) }
end end
end end
def sign_in_using_credentials(user = nil) def sign_in_using_credentials(user = nil)
# Don't try to log-in if we're already logged-in # Don't try to log-in if we're already logged-in
return if Page::Menu::Main.act { has_personal_area?(wait: 0) } return if Page::Main::Menu.act { has_personal_area?(wait: 0) }
using_wait_time 0 do using_wait_time 0 do
set_initial_password_if_present set_initial_password_if_present
...@@ -57,7 +57,7 @@ module QA ...@@ -57,7 +57,7 @@ module QA
end end
end end
Page::Menu::Main.act { has_personal_area? } Page::Main::Menu.act { has_personal_area? }
end end
def sign_in_using_admin_credentials def sign_in_using_admin_credentials
...@@ -72,7 +72,7 @@ module QA ...@@ -72,7 +72,7 @@ module QA
sign_in_using_gitlab_credentials(admin) sign_in_using_gitlab_credentials(admin)
end end
Page::Menu::Main.act { has_personal_area? } Page::Main::Menu.act { has_personal_area? }
end end
def self.path def self.path
......
# frozen_string_literal: true
module QA module QA
module Page module Page
module Menu module Main
class Main < Page::Base class Menu < Page::Base
view 'app/views/layouts/header/_current_user_dropdown.html.haml' do view 'app/views/layouts/header/_current_user_dropdown.html.haml' do
element :user_sign_out_link, 'link_to _("Sign out")' element :user_sign_out_link, 'link_to _("Sign out")'
element :settings_link, 'link_to s_("CurrentUser|Settings")' element :settings_link, 'link_to s_("CurrentUser|Settings")'
......
...@@ -19,7 +19,7 @@ module QA ...@@ -19,7 +19,7 @@ module QA
fill_in :new_user_password, with: user.password fill_in :new_user_password, with: user.password
click_button 'Register' click_button 'Register'
Page::Menu::Main.act { assert_has_personal_area } Page::Main::Menu.act { assert_has_personal_area }
end end
end end
end end
......
# frozen_string_literal: true
module QA module QA
module Page module Page
module Menu module Profile
class Profile < Page::Base class Menu < Page::Base
view 'app/views/layouts/nav/sidebar/_profile.html.haml' do view 'app/views/layouts/nav/sidebar/_profile.html.haml' do
element :access_token_link, 'link_to profile_personal_access_tokens_path' element :access_token_link, 'link_to profile_personal_access_tokens_path'
element :access_token_title, 'Access Tokens' element :access_token_title, 'Access Tokens'
......
# frozen_string_literal: true
module QA module QA
module Page module Page
module Menu module Project
class Side < Page::Base class Menu < Page::Base
view 'app/views/layouts/nav/sidebar/_project.html.haml' do view 'app/views/layouts/nav/sidebar/_project.html.haml' do
element :settings_item element :settings_item
element :settings_link, 'link_to edit_project_path' element :settings_link, 'link_to edit_project_path'
......
...@@ -8,7 +8,7 @@ module QA ...@@ -8,7 +8,7 @@ module QA
# TODO, since `Signed in successfully` message was removed # TODO, since `Signed in successfully` message was removed
# this is the only way to tell if user is signed in correctly. # this is the only way to tell if user is signed in correctly.
# #
Page::Menu::Main.perform do |menu| Page::Main::Menu.perform do |menu|
expect(menu).to have_personal_area expect(menu).to have_personal_area
end end
end end
......
...@@ -10,7 +10,7 @@ module QA ...@@ -10,7 +10,7 @@ module QA
# TODO, since `Signed in successfully` message was removed # TODO, since `Signed in successfully` message was removed
# this is the only way to tell if user is signed in correctly. # this is the only way to tell if user is signed in correctly.
# #
Page::Menu::Main.perform do |menu| Page::Main::Menu.perform do |menu|
expect(menu).to have_personal_area expect(menu).to have_personal_area
end end
end end
......
...@@ -10,7 +10,7 @@ module QA ...@@ -10,7 +10,7 @@ module QA
# TODO, since `Signed in successfully` message was removed # TODO, since `Signed in successfully` message was removed
# this is the only way to tell if user is signed in correctly. # this is the only way to tell if user is signed in correctly.
# #
Page::Menu::Main.perform do |menu| Page::Main::Menu.perform do |menu|
expect(menu).to have_personal_area expect(menu).to have_personal_area
end end
end end
......
...@@ -27,7 +27,7 @@ module QA ...@@ -27,7 +27,7 @@ module QA
imported_project # import the project imported_project # import the project
Page::Menu::Main.act { go_to_projects } Page::Main::Menu.act { go_to_projects }
Page::Dashboard::Projects.perform do |dashboard| Page::Dashboard::Projects.perform do |dashboard|
dashboard.go_to_project(imported_project.name) dashboard.go_to_project(imported_project.name)
end end
...@@ -48,7 +48,7 @@ module QA ...@@ -48,7 +48,7 @@ module QA
end end
def verify_issues_import def verify_issues_import
Page::Menu::Side.act { click_issues } Page::Project::Menu.act { click_issues }
expect(page).to have_content('This is a sample issue') expect(page).to have_content('This is a sample issue')
click_link 'This is a sample issue' click_link 'This is a sample issue'
...@@ -66,7 +66,7 @@ module QA ...@@ -66,7 +66,7 @@ module QA
end end
def verify_merge_requests_import def verify_merge_requests_import
Page::Menu::Side.act { click_merge_requests } Page::Project::Menu.act { click_merge_requests }
expect(page).to have_content('Improve README.md') expect(page).to have_content('Improve README.md')
click_link 'Improve README.md' click_link 'Improve README.md'
...@@ -101,7 +101,7 @@ module QA ...@@ -101,7 +101,7 @@ module QA
end end
def verify_wiki_import def verify_wiki_import
Page::Menu::Side.act { click_wiki } Page::Project::Menu.act { click_wiki }
expect(page).to have_content('Welcome to the test-project wiki!') expect(page).to have_content('Welcome to the test-project wiki!')
end end
......
...@@ -13,7 +13,7 @@ module QA ...@@ -13,7 +13,7 @@ module QA
push.commit_message = 'Add README.md' push.commit_message = 'Add README.md'
end end
Page::Menu::Side.act { go_to_activity } Page::Project::Menu.act { go_to_activity }
Page::Project::Activity.act { go_to_push_events } Page::Project::Activity.act { go_to_push_events }
......
...@@ -17,7 +17,7 @@ module QA ...@@ -17,7 +17,7 @@ module QA
it 'user creates an issue' do it 'user creates an issue' do
create_issue create_issue
Page::Menu::Side.act { click_issues } Page::Project::Menu.act { click_issues }
expect(page).to have_content(issue_title) expect(page).to have_content(issue_title)
end end
......
...@@ -11,7 +11,7 @@ module QA ...@@ -11,7 +11,7 @@ module QA
merge_request.fork_branch = 'feature-branch' merge_request.fork_branch = 'feature-branch'
end end
Page::Menu::Main.perform { |main| main.sign_out } Page::Main::Menu.perform { |main| main.sign_out }
Page::Main::Login.perform { |login| login.sign_in_using_credentials } Page::Main::Login.perform { |login| login.sign_in_using_credentials }
merge_request.visit! merge_request.visit!
......
...@@ -11,7 +11,7 @@ module QA ...@@ -11,7 +11,7 @@ module QA
project.name = "only-fast-forward" project.name = "only-fast-forward"
end end
Page::Menu::Side.act { go_to_settings } Page::Project::Menu.act { go_to_settings }
Page::Project::Settings::MergeRequest.act { enable_ff_only } Page::Project::Settings::MergeRequest.act { enable_ff_only }
merge_request = Factory::Resource::MergeRequest.fabricate! do |merge_request| merge_request = Factory::Resource::MergeRequest.fabricate! do |merge_request|
......
...@@ -16,8 +16,8 @@ module QA ...@@ -16,8 +16,8 @@ module QA
expect(page).to have_content("Title: #{key_title}") expect(page).to have_content("Title: #{key_title}")
expect(page).to have_content(key.fingerprint) expect(page).to have_content(key.fingerprint)
Page::Menu::Main.act { go_to_profile_settings } Page::Main::Menu.act { go_to_profile_settings }
Page::Menu::Profile.act { click_ssh_keys } Page::Profile::Menu.act { click_ssh_keys }
Page::Profile::SSHKeys.perform do |ssh_keys| Page::Profile::SSHKeys.perform do |ssh_keys|
ssh_keys.remove_key(key_title) ssh_keys.remove_key(key_title)
......
...@@ -28,8 +28,8 @@ module QA ...@@ -28,8 +28,8 @@ module QA
expect(page).to have_content('README.md') expect(page).to have_content('README.md')
expect(page).to have_content('Test Use SSH Key') expect(page).to have_content('Test Use SSH Key')
Page::Menu::Main.act { go_to_profile_settings } Page::Main::Menu.act { go_to_profile_settings }
Page::Menu::Profile.act { click_ssh_keys } Page::Profile::Menu.act { click_ssh_keys }
Page::Profile::SSHKeys.perform do |ssh_keys| Page::Profile::SSHKeys.perform do |ssh_keys|
ssh_keys.remove_key(key_title) ssh_keys.remove_key(key_title)
......
...@@ -40,7 +40,7 @@ module QA ...@@ -40,7 +40,7 @@ module QA
push.file_content = '# My Third Wiki Content' push.file_content = '# My Third Wiki Content'
push.commit_message = 'Update Home.md' push.commit_message = 'Update Home.md'
end end
Page::Menu::Side.act { click_wiki } Page::Project::Menu.act { click_wiki }
expect(page).to have_content('My Third Wiki Content') expect(page).to have_content('My Third Wiki Content')
end end
......
...@@ -64,7 +64,7 @@ module QA ...@@ -64,7 +64,7 @@ module QA
expect(page).to have_content('Add .gitlab-ci.yml') expect(page).to have_content('Add .gitlab-ci.yml')
Page::Menu::Side.act { click_ci_cd_pipelines } Page::Project::Menu.act { click_ci_cd_pipelines }
expect(page).to have_content('All 1') expect(page).to have_content('All 1')
expect(page).to have_content('Add .gitlab-ci.yml') expect(page).to have_content('Add .gitlab-ci.yml')
......
...@@ -28,7 +28,7 @@ module QA ...@@ -28,7 +28,7 @@ module QA
resource.image = 'gitlab/gitlab-runner:ubuntu' resource.image = 'gitlab/gitlab-runner:ubuntu'
end end
Page::Menu::Main.act { sign_out } Page::Main::Menu.act { sign_out }
end end
after(:all) do after(:all) do
...@@ -90,7 +90,7 @@ module QA ...@@ -90,7 +90,7 @@ module QA
sha1sum = Digest::SHA1.hexdigest(gitlab_ci) sha1sum = Digest::SHA1.hexdigest(gitlab_ci)
Page::Project::Show.act { wait_for_push } Page::Project::Show.act { wait_for_push }
Page::Menu::Side.act { click_ci_cd_pipelines } Page::Project::Menu.act { click_ci_cd_pipelines }
Page::Project::Pipeline::Index.act { go_to_latest_pipeline } Page::Project::Pipeline::Index.act { go_to_latest_pipeline }
Page::Project::Pipeline::Show.act { go_to_first_job } Page::Project::Pipeline::Show.act { go_to_first_job }
......
...@@ -51,13 +51,13 @@ module QA ...@@ -51,13 +51,13 @@ module QA
end end
project.visit! project.visit!
Page::Menu::Side.act { click_ci_cd_settings } Page::Project::Menu.act { click_ci_cd_settings }
Page::Project::Settings::CICD.perform do |p| Page::Project::Settings::CICD.perform do |p|
p.enable_auto_devops_with_domain("#{kubernetes_cluster.ingress_ip}.nip.io") p.enable_auto_devops_with_domain("#{kubernetes_cluster.ingress_ip}.nip.io")
end end
project.visit! project.visit!
Page::Menu::Side.act { click_ci_cd_pipelines } Page::Project::Menu.act { click_ci_cd_pipelines }
Page::Project::Pipeline::Index.act { go_to_latest_pipeline } Page::Project::Pipeline::Index.act { go_to_latest_pipeline }
Page::Project::Pipeline::Show.perform do |pipeline| Page::Project::Pipeline::Show.perform do |pipeline|
......
...@@ -6,7 +6,7 @@ module QA ...@@ -6,7 +6,7 @@ module QA
it 'user creates a group with a mattermost team' do it 'user creates a group with a mattermost team' do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.act { sign_in_using_credentials }
Page::Menu::Main.act { go_to_groups } Page::Main::Menu.act { go_to_groups }
Page::Dashboard::Groups.perform do |page| Page::Dashboard::Groups.perform do |page|
page.go_to_new_group page.go_to_new_group
......
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