Class: ClientAppsPage

Inherits:
Object
  • Object
show all
Includes:
Capybara::DSL, NavigationBar, UserMenu
Defined in:
pages/ClientAppsPage.rb

Instance Method Summary collapse

Methods included from NavigationBar

#go_to_home, select_from_menuName_menu, select_menu

Methods included from UserMenu

#log_out, #select_revert_to_admin

Constructor Details

#initializeClientAppsPage

Returns a new instance of ClientAppsPage.


6
7
8
9
10
11
12
13
14
# File 'pages/ClientAppsPage.rb', line 6

def initialize
  @tab = {"selector" => :xpath, "value" => ".//*[@class='tab']"}
  @appgroup = {"selector" => :xpath, "value" => ".//*[@class='tab-content appgroup']"} 
  @app = {"selector" => :css, "value" => ".single-portal-app"}
  super
  sleep 2 
  uri = URI.parse(current_url)
  "#{uri.path}".should == "/client/apps"
end

Instance Method Details

#edit_appObject


35
36
37
38
# File 'pages/ClientAppsPage.rb', line 35

def edit_app
  find(:xpath, ".//*[@class='edit-apps']").click
  sleep 5
end

#select_any_appObject


25
26
27
28
29
30
31
32
33
# File 'pages/ClientAppsPage.rb', line 25

def select_any_app
    sleep 5
    icon = all(@app['selector'], @app['value'])
    if icon.length == 0
      p "No apps configured"
      $log.debug("Unable to select an app because an app is not configured for this account")
    end
    icon.first.click
end

#select_any_tabObject


21
22
23
# File 'pages/ClientAppsPage.rb', line 21

def select_any_tab
  find(@tab['selector'], @tab['value']).click
end

#switch_view_to(view) ⇒ Object


55
56
57
58
# File 'pages/ClientAppsPage.rb', line 55

def switch_view_to(view)
  p view
  find(:css, "#{view}").click
end

#toggle_viewObject


40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'pages/ClientAppsPage.rb', line 40

def toggle_view
  begin
    find(:css, "a.portal-icon-view").click
    $log.debug("Switching to icon view")
    find(:css, "a.portal-list-view")
    state="a.portal-list-view"
  rescue
    find(:css, "a.portal-list-view").click
    $log.debug("Switching to list view")
    find(:css, "a.portal-icon-view")
    state="a.portal-icon-view"
  end
  return state
end

#user_is_logged_inObject


16
17
18
19
# File 'pages/ClientAppsPage.rb', line 16

def user_is_logged_in
 #Need to handle username 
  find(:xpath, ".//*[@class='dropdown-toggle']").text.should == 'Melvin Laguren'
end