-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainpage_links_spec.rb
138 lines (109 loc) · 4.41 KB
/
mainpage_links_spec.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
require 'spec_helper'
feature "Main page test: ", :nightly,:ui, driver: :selenium do
given(:prj) {'.//*[contains(@class,"dropdown")]/ul/li/a'}
given(:dropdown_default_project) {'.//*[@class="btn"]/p[1]'}
given(:tabs_menu) {'.//*[@class="menu"]'}
given(:dashboard) {"#{tabs_menu}/a[1]"}
given(:utilities) {"#{tabs_menu}/a[2]"}
given(:bulk_tagging) {"#{tabs_menu}/a[3]"}
given(:hud_button){'//*[@id="hud_button"]'}
given(:latest_actvty) {'//*[@class="switch"]'}
given(:project_tab) {"#{latest_actvty}/span[1]/a"}
given(:monitors_tab) {"#{latest_actvty}/span[2]/a"}
given(:scoutvision_home) {'.//*[@class="text"]/span/a'}
given(:edit_button) {'.//*[@class="top_button"]'}
given(:default_projects_table_path) {'//*[@class="right_column"]/div/table/tbody/tr/td/div[1]'}
given(:default_project_name) {"#{name}'s Project"}
given(:login_logo) {'//*[@id="login_logo"]'}
Steps " verify all links in main page work properly", with_steps:true do
Given "that I am trying to login with an existing user" do
login
end
Then 'I should see "ScoutVision Home"' do
expect(find(:xpath,scoutvision_home).text).to have_content('ScoutVision Home')
end
Then 'I should see the correct platform Logo' do
platfrom = SshClient.web.get_platform
if platfrom == "scoutvision"
expect(find(:xpath,login_logo)['src']).to have_content("ScoutVision166.png")
elsif platfrom == "cloudscout"
expect(find(:xpath,login_logo)['src']).to have_content("CloudScout166.png")
elsif platfrom == "scoutvision_hosted"
expect(find(:xpath,login_logo)['src']).to have_content("ScoutVisionHosted166.png")
end
end
When 'I click on ScoutVison Home link' do
find(:xpath,scoutvision_home).click
end
Then "I am back at the main page" do
expect(page.current_url).to have_content(ENV['BASE_URL'])
end
Given "that I am in the main page " do
expect(page.current_url).to have_content(ENV['BASE_URL'])
end
Then 'I see a tab named "Dashboard" ' do
expect(find(:xpath,dashboard).text).to have_content("Dashboard")
end
Then 'I see a tab named "Utilities" ' do
expect(find(:xpath,utilities).text).to have_content("Utilities")
end
Then 'I see a tab named "Bulk Tagging" ' do
expect(find(:xpath,bulk_tagging).text).to have_content("Bulk Tagging")
end
Then 'I see a button named "CyberHUD" ' do
expect(find(:xpath,hud_button).text).to have_content("CyberHUD")
end
Then 'I see a button named "edit" ' do
expect(find(:xpath,edit_button).text).to have_content("edit")
end
Then 'I see a label that reads "Latest Activity" ' do
expect(page).to have_content('Latest Activity')
end
Then 'I see a tab named "Project" ' do
expect(find(:xpath,project_tab).text).to have_content("Project")
end
Then 'I see a tab named "Monitors" ' do
expect(find(:xpath,monitors_tab).text).to have_content("Monitors")
end
Then 'I see a label that reads "Your Projects" ' do
expect(page).to have_content('Your Projects')
end
Then "I see the user's default project under the 'Your Projects' label" do
within '.right_column' do
expect(page).to have_content default_project_name
end
end
Then "I see the user's default project at the top of the project dropdown list" do
hover_menu '#projects' do
expect(page).to have_content default_project_name
end
end
When 'I click on the Dashboard tab' do
find(:xpath,dashboard).click
end
Then "I am back at the main page" do
expect(page.current_url).to have_content(ENV['BASE_URL'])
end
When 'I click on the Utilities tab' do
find(:xpath,utilities).click
end
Then 'I am taken to the "Utilities" page ' do
expect(page.current_url).to have_content("/utilities")
page.evaluate_script('window.history.back()')
end
When 'I click on the "Bulk Tagging" tab' do
find(:xpath,bulk_tagging).click
end
Then 'I am taken to the "Bulk Tagging" page ' do
expect(page.current_url).to have_content("/ip_taggings/create_many")
page.evaluate_script('window.history.back()')
end
When 'click on the "edit" button' do
find(:xpath,edit_button).click
end
Then 'I am taken to the edit page' do
expect(page.current_url).to have_content('edit')
page.evaluate_script('window.history.back()')
end
end
end