Commit 8c22c654 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add QA page views / elements couling with the menu

parent dee047aa
......@@ -6,7 +6,7 @@
.fade-right= icon('angle-right')
%ul.nav-links.scrolling-tabs
= nav_link(page: [dashboard_projects_path, root_path]) do
= link_to dashboard_projects_path, class: 'shortcuts-activity', data: {placement: 'right'} do
= link_to dashboard_projects_path, class: 'shortcuts-activity qa-your-projects-link', data: {placement: 'right'} do
Your projects
= nav_link(page: starred_dashboard_projects_path) do
= link_to starred_dashboard_projects_path, data: {placement: 'right'} do
......
%header.navbar.navbar-gitlab
%header.navbar.navbar-gitlab.qa-navbar
%a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content
.container-fluid
.header-content
......@@ -43,7 +43,7 @@
= todos_count_format(todos_pending_count)
%li.header-user.dropdown
= link_to current_user, class: user_dropdown_class, data: { toggle: "dropdown" } do
= image_tag avatar_icon(current_user, 23), width: 23, height: 23, class: "header-user-avatar"
= image_tag avatar_icon(current_user, 23), width: 23, height: 23, class: "header-user-avatar qa-user-avatar"
= sprite_icon('angle-down', css_class: 'caret-down')
.dropdown-menu-nav.dropdown-menu-align-right
%ul
......
%ul.list-unstyled.navbar-sub-nav
= nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: { id: 'nav-projects-dropdown', class: "home dropdown header-projects" }) do
= nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: { id: 'nav-projects-dropdown', class: "home dropdown header-projects qa-projects-dropdown" }) do
%a{ href: "#", data: { toggle: "dropdown" } }
Projects
= sprite_icon('angle-down', css_class: 'caret-down')
.dropdown-menu.projects-dropdown-menu
= render "layouts/nav/projects_dropdown/show"
= nav_link(controller: ['dashboard/groups', 'explore/groups'], html_options: { class: "hidden-xs" }) do
= nav_link(controller: ['dashboard/groups', 'explore/groups'], html_options: { class: "hidden-xs qa-groups-link" }) do
= link_to dashboard_groups_path, class: 'dashboard-shortcuts-groups', title: 'Groups' do
Groups
......@@ -59,7 +59,7 @@
%li.line-separator.hidden-xs
- if current_user.admin?
= nav_link(controller: 'admin/dashboard') do
= link_to admin_root_path, class: 'admin-icon', title: 'Admin area', aria: { label: "Admin area" }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= link_to admin_root_path, class: 'admin-icon qa-admin-area-link', title: 'Admin area', aria: { label: "Admin area" }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= sprite_icon('admin', size: 18)
- if Gitlab::Sherlock.enabled?
%li
......
......@@ -40,6 +40,10 @@ module QA
page.within(selector) { yield } if block_given?
end
def click_element(name)
find("qa-#{name.tr('_', '-')}").click
end
def self.path
raise NotImplementedError
end
......
......@@ -2,6 +2,10 @@ module QA
module Page
module Main
class OAuth < Page::Base
view 'app/views/doorkeeper/authorizations/new.html.haml' do
element :authorization_button, 'submit_tag "Authorize"'
end
def needs_authorization?
page.current_url.include?('/oauth')
end
......
......@@ -2,19 +2,36 @@ module QA
module Page
module Menu
class Main < Page::Base
view 'app/views/layouts/header/_default.html.haml' do
element :navbar
element :user_avatar
element :user_menu, '.dropdown-menu-nav'
element :user_sign_out_link, 'link_to "Sign out"'
end
view 'app/views/layouts/nav/_dashboard.html.haml' do
element :admin_area_link
element :projects_dropdown
element :groups_link
end
view 'app/views/dashboard/_projects_head.html.haml' do
element :your_projects_link
end
def go_to_groups
within_top_menu { click_link 'Groups' }
within_top_menu { click_element :groups_link }
end
def go_to_projects
within_top_menu do
click_link 'Projects'
click_link 'Your projects'
click_element :projects_dropdown
click_element :your_projects_link
end
end
def go_to_admin_area
within_top_menu { find('.admin-icon').click }
within_top_menu { click_element :admin_area_link }
end
def sign_out
......@@ -24,20 +41,20 @@ module QA
end
def has_personal_area?
page.has_selector?('.header-user-dropdown-toggle')
page.has_selector?('.qa-user-avatar')
end
private
def within_top_menu
page.within('.navbar') do
page.within('.qa-navbar') do
yield
end
end
def within_user_menu
within_top_menu do
find('.header-user-dropdown-toggle').click
click_element :user_avatar
page.within('.dropdown-menu-nav') do
yield
......
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