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