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