-
Notifications
You must be signed in to change notification settings - Fork 0
/
home_page_object.rb
70 lines (64 loc) · 1.6 KB
/
home_page_object.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module HomePageObject
WELCOME_TEXT = {css: '#utility-links > p > strong'} #utility-links > p > strong
AUX_LINKS = {css: ".aux-links > li"}
RUN_SOLO_BUTTON ={css: 'div.run_buttons > a.solo.button'}
def verify_auth_user(user)
puts "In verify_auth_user"
text = text_of(WELCOME_TEXT)
puts "text is #{text}"
case user
when 'admin'
text.include? 'Admin'
return true
when 'teacher'
text.include? 'Teacher'
return true
when 'project'
text.include? 'Project'
return true
when 'researcher'
text.include? 'Researcher'
return true
when 'author'
text.include? 'Author'
return true
when 'student'
text.include? 'Student'
return true
else
return false
end
end
def verify_user_menu(user)
nav_bar_list = find_all(AUX_LINKS)
case user
when 'admin'
nav = ['ADMIN']
when 'teacher'
nav = []
when 'project'
nav = ['ADMIN']
when 'researcher'
nav = ['ADMIN']
when 'author'
nav = []
when 'student'
nav = []
when 'itsi'
nav = ['CAREERSIGHT','PROBESIGHT','SCHOOLOGY','ACTIVITIES']
end
if nav.length!=(nav_bar_list.length - 1)
puts 'not the right number of menu items'
end
nav_bar_list.each do |menu_item|
if nav.include? menu_item.text
puts "#{menu_item.text} is correctly in the menu"
else
puts "#{menu_item.text} should not be in the menu"
end
end
end
def run_activity_solo
click_on(RUN_SOLO_BUTTON)
end
end