SimpliTest 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -21
  3. data/SimpliTest.gemspec +42 -42
  4. data/bin/SimpliTest +22 -22
  5. data/lib/SimpliTest.rb +2 -2
  6. data/lib/SimpliTest/cli/main.rb +333 -333
  7. data/lib/SimpliTest/config/configuration.rb +107 -107
  8. data/lib/SimpliTest/config/directory_paths.rb +36 -36
  9. data/lib/SimpliTest/config/environment.rb +67 -67
  10. data/lib/SimpliTest/config/local_environment.rb +20 -20
  11. data/lib/SimpliTest/config/profiles/chrome.rb +18 -18
  12. data/lib/SimpliTest/config/profiles/firefox.rb +14 -14
  13. data/lib/SimpliTest/config/profiles/internet_explorer.rb +11 -11
  14. data/lib/SimpliTest/config/profiles/phantom.rb +9 -9
  15. data/lib/SimpliTest/config/profiles/phantom_debug.rb +12 -12
  16. data/lib/SimpliTest/config/profiles/selenium.rb +13 -13
  17. data/lib/SimpliTest/config/screen_size.rb +25 -25
  18. data/lib/SimpliTest/config/steps.rb +8 -8
  19. data/lib/SimpliTest/helpers/data_validation.rb +60 -60
  20. data/lib/SimpliTest/helpers/file.rb +38 -38
  21. data/lib/SimpliTest/helpers/project_setup.rb +186 -186
  22. data/lib/SimpliTest/helpers/step_helpers/custom_chrome_helpers.rb +14 -14
  23. data/lib/SimpliTest/helpers/step_helpers/custom_date_helpers.rb +64 -64
  24. data/lib/SimpliTest/helpers/step_helpers/custom_form_helpers.rb +66 -66
  25. data/lib/SimpliTest/helpers/step_helpers/custom_phantomjs_helpers.rb +49 -49
  26. data/lib/SimpliTest/helpers/step_helpers/custom_selenium_helpers.rb +41 -41
  27. data/lib/SimpliTest/helpers/step_helpers/html_selectors_helpers.rb +154 -154
  28. data/lib/SimpliTest/helpers/step_helpers/navigation_helpers.rb +206 -206
  29. data/lib/SimpliTest/helpers/step_helpers/tolerance_for_sync_issues.rb +38 -38
  30. data/lib/SimpliTest/helpers/step_helpers/within_helpers.rb +6 -6
  31. data/lib/SimpliTest/helpers/windows_ui.rb +51 -51
  32. data/lib/SimpliTest/steps/debugging_steps.rb +19 -19
  33. data/lib/SimpliTest/steps/form_steps.rb +348 -352
  34. data/lib/SimpliTest/steps/form_verification_steps.rb +189 -189
  35. data/lib/SimpliTest/steps/navigation_steps.rb +58 -47
  36. data/lib/SimpliTest/steps/scoper.rb +42 -42
  37. data/lib/SimpliTest/steps/verification_steps.rb +306 -306
  38. data/lib/SimpliTest/tasks/document.rb +169 -169
  39. data/lib/SimpliTest/tasks/examples.rb +18 -18
  40. data/lib/SimpliTest/tasks/testinstall.rb +5 -5
  41. data/lib/SimpliTest/templates/NewSimpliTestProject/Readme.txt +4 -4
  42. data/lib/SimpliTest/templates/NewSimpliTestProject/cucumber.yml +26 -26
  43. data/lib/SimpliTest/templates/NewSimpliTestProject/documentation/step_definitions.html +88 -87
  44. data/lib/SimpliTest/templates/NewSimpliTestProject/features/specifications/RegressionTests/HelloWorld.feature +3 -3
  45. data/lib/SimpliTest/templates/NewSimpliTestProject/features/specifications/SmokeTest/HelloWorld.feature +3 -3
  46. data/lib/SimpliTest/templates/NewSimpliTestProject/features/specifications/accessibilityTests/HelloWorld.feature +3 -3
  47. data/lib/SimpliTest/templates/NewSimpliTestProject/features/support/config/environments.yml +10 -10
  48. data/lib/SimpliTest/templates/NewSimpliTestProject/features/support/config/pages.yml +26 -26
  49. data/lib/SimpliTest/templates/NewSimpliTestProject/features/support/config/selectors.yml +44 -44
  50. data/lib/SimpliTest/templates/NewSimpliTestProject/features/support/config/settings.yml +26 -26
  51. data/lib/SimpliTest/templates/NewSimpliTestProject/features/support/env.rb +33 -33
  52. data/lib/SimpliTest/templates/NewSimpliTestProject/license.txt +29 -29
  53. data/lib/SimpliTest/templates/document/css/style.css +28 -28
  54. data/lib/SimpliTest/templates/document/index.html +60 -60
  55. data/lib/version.rb +3 -3
  56. metadata +4 -4
@@ -1,190 +1,190 @@
1
-
2
- #************************ TEXT FIELDS ********************************************
3
-
4
- #Example: Then the "Name" field should contain "my name"
5
- Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
6
- with_scope(parent) do
7
- field = get_element_from(field)
8
- field_value = field.value
9
- patiently { field_value.should =~ /#{value}/ }
10
- end
11
- end
12
-
13
- #Example: And the "Name" field should not contain "not my name"
14
- Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
15
- with_scope(parent) do
16
- field = get_element_from(field)
17
- field_value = field.value
18
- patiently { field_value.should_not =~ /#{value}/ }
19
- end
20
- end
21
-
22
-
23
- #************************ END TEXT FIELDS ****************************************
24
-
25
-
26
- #************************ DROP DOWNS *********************************************
27
-
28
-
29
- #Example: Then the select "Your favorite colors": Table
30
- Then /^the select "([^"]*)" should have following options:$/ do |field, options|
31
- options = options.transpose.raw
32
- if options.size > 1
33
- raise 'table should have only one column in this step!'
34
- else
35
- options = options.first
36
- end
37
-
38
- actual_options = get_element_from(field).all('option').map { |option| option.text }
39
- patiently { options.should eq(actual_options) }
40
- end
41
-
42
- #Example: And the following values should be selected in "Your favorite colors": Table
43
- Then /^the following values should be selected in "([^"]*)":$/ do |select_box, values|
44
- values = values.transpose.raw
45
- if values.size > 1
46
- raise 'table should have only one column in this step!'
47
- else
48
- values = values.first
49
- end
50
-
51
- select_box= get_element_from(select_box)
52
- unless select_box['multiple']
53
- raise "this is not multiple select box!"
54
- else
55
- values.each do |value|
56
- patiently { select_box.value.should include(value) }
57
- end
58
- end
59
- end
60
-
61
- #Example: And the following values should not be selected in "Your favorite colors":
62
- Then /^the following values should not be selected in "([^"]*)":$/ do |select_box, values|
63
- values = values.transpose.raw
64
- if values.size > 1
65
- raise 'table should have only one column in this step!'
66
- else
67
- values = values.first
68
- end
69
-
70
- select_box= get_element_from(select_box)
71
- unless select_box['multiple']
72
- raise "this is not multiple select box!"
73
- else
74
- values.each do |value|
75
- patiently { select_box.value.should_not include(value) }
76
- end
77
- end
78
- end
79
-
80
-
81
- #************************ END DROP DOWNS******************************************
82
-
83
-
84
- #************************ CHECKBOXES *********************************************
85
-
86
- #Example: And the "Accept user agrement" checkbox should be checked
87
- Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
88
- with_scope(parent) do
89
- field_checked = get_element_from(label)['checked']
90
- patiently { field_checked.should be_truthy }
91
- end
92
- end
93
-
94
- #Example: And the "Do not touch me" checkbox should not be checked
95
- Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
96
- with_scope(parent) do
97
- field_checked = get_element_from(label)['checked']
98
- patiently { field_checked.should be_falsey }
99
- end
100
- end
101
-
102
- #Example: And the "Sex" selectbox should contain: Table
103
- Then /^the "(.*?)" selectbox should contain:$/ do |locator, options|
104
- patiently do
105
- select_options_for(locator).should == options.raw.join(' ')
106
- end
107
- end
108
-
109
-
110
- #************************ END CHECKBOXES *****************************************
111
-
112
-
113
- #************************ RADIO BUTTONS*******************************************
114
-
115
-
116
- #Example: And the "radio 1" radio should be selected
117
- Then /^the "(.*?)" radio should be selected$/ do |locator|
118
- patiently do
119
- element = get_element_from(locator)
120
- element.should be_checked
121
- end
122
- end
123
- #Example: And the "radio 2" radio should not be selected
124
- Then /^the "(.*?)" radio should not be selected$/ do |locator|
125
- patiently do
126
- element = get_element_from(locator)
127
- element.should_not be_checked
128
- end
129
- end
130
-
131
-
132
- #************************ END RADIO BUTTONS***************************************
133
-
134
-
135
- #************************ DATE FIELD *********************************************
136
-
137
-
138
- #Example: Then "12/31/2013" should be the default date for "datepicker"
139
- Then /^"(.*?)" should be the default date for "(.*?)"$/ do |date_rule, field|
140
- patiently do
141
- date_field = get_element_from(field)
142
- date_field.value.should == calculated_date_from(date_rule)
143
- end
144
- end
145
-
146
-
147
- #************************ END DATE FIELD *****************************************
148
-
149
-
150
-
151
- #****************Read from Excel
152
-
153
- #****************User Name Field
154
-
155
- #Example: Then I enter user name from excel in "Username"
156
- Then /^I enter user name from excel in "(.*?)"$/ do |locator|
157
- element = get_element_from(locator)
158
-
159
- require 'spreadsheet'
160
- Spreadsheet.client_encoding = 'UTF-8'
161
- workbook = Spreadsheet.open 'C:\cmsmoketest\features\specifications\SmokeTest\book5.xls'
162
- sheet1 = workbook.worksheet 0
163
- sheet1.each 1 do |row|
164
- #puts "#{row[0]} - #{row[1]} - #{row[2]}"
165
- resolt = "#{row[0]}"
166
- element.set resolt
167
- end
168
- end
169
-
170
-
171
- #****************Password Field
172
-
173
- #Example: Then I enter user name from excel in "Username"
174
- Then(/^I enter password from excel in "([^"]*)" field$/) do |locator|
175
- element = get_element_from(locator)
176
- require 'spreadsheet'
177
- Spreadsheet.client_encoding = 'UTF-8'
178
- workbook = Spreadsheet.open 'C:\cmsmoketest\features\specifications\SmokeTest\book5.xls'
179
- sheet1 = workbook.worksheet 0
180
- sheet1.each 1 do |row|
181
- resolt = "#{row[1]}"
182
- element.set resolt
183
- end
184
-
185
- end
186
-
187
- # Reads a plain text file
188
- Then /[Rr]ead file "(.*?)"$/ do |filepath|
189
- File.foreach(filepath) { |x| print 'Got ', x }
1
+
2
+ #************************ TEXT FIELDS ********************************************
3
+
4
+ #Example: Then the "Name" field should contain "my name"
5
+ Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
6
+ with_scope(parent) do
7
+ field = get_element_from(field)
8
+ field_value = field.value
9
+ patiently { field_value.should =~ /#{value}/ }
10
+ end
11
+ end
12
+
13
+ #Example: And the "Name" field should not contain "not my name"
14
+ Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
15
+ with_scope(parent) do
16
+ field = get_element_from(field)
17
+ field_value = field.value
18
+ patiently { field_value.should_not =~ /#{value}/ }
19
+ end
20
+ end
21
+
22
+
23
+ #************************ END TEXT FIELDS ****************************************
24
+
25
+
26
+ #************************ DROP DOWNS *********************************************
27
+
28
+
29
+ #Example: Then the select "Your favorite colors": Table
30
+ Then /^the select "([^"]*)" should have following options:$/ do |field, options|
31
+ options = options.transpose.raw
32
+ if options.size > 1
33
+ raise 'table should have only one column in this step!'
34
+ else
35
+ options = options.first
36
+ end
37
+
38
+ actual_options = get_element_from(field).all('option').map { |option| option.text }
39
+ patiently { options.should eq(actual_options) }
40
+ end
41
+
42
+ #Example: And the following values should be selected in "Your favorite colors": Table
43
+ Then /^the following values should be selected in "([^"]*)":$/ do |select_box, values|
44
+ values = values.transpose.raw
45
+ if values.size > 1
46
+ raise 'table should have only one column in this step!'
47
+ else
48
+ values = values.first
49
+ end
50
+
51
+ select_box= get_element_from(select_box)
52
+ unless select_box['multiple']
53
+ raise "this is not multiple select box!"
54
+ else
55
+ values.each do |value|
56
+ patiently { select_box.value.should include(value) }
57
+ end
58
+ end
59
+ end
60
+
61
+ #Example: And the following values should not be selected in "Your favorite colors":
62
+ Then /^the following values should not be selected in "([^"]*)":$/ do |select_box, values|
63
+ values = values.transpose.raw
64
+ if values.size > 1
65
+ raise 'table should have only one column in this step!'
66
+ else
67
+ values = values.first
68
+ end
69
+
70
+ select_box= get_element_from(select_box)
71
+ unless select_box['multiple']
72
+ raise "this is not multiple select box!"
73
+ else
74
+ values.each do |value|
75
+ patiently { select_box.value.should_not include(value) }
76
+ end
77
+ end
78
+ end
79
+
80
+
81
+ #************************ END DROP DOWNS******************************************
82
+
83
+
84
+ #************************ CHECKBOXES *********************************************
85
+
86
+ #Example: And the "Accept user agrement" checkbox should be checked
87
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
88
+ with_scope(parent) do
89
+ field_checked = get_element_from(label)['checked']
90
+ patiently { field_checked.should be_truthy }
91
+ end
92
+ end
93
+
94
+ #Example: And the "Do not touch me" checkbox should not be checked
95
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
96
+ with_scope(parent) do
97
+ field_checked = get_element_from(label)['checked']
98
+ patiently { field_checked.should be_falsey }
99
+ end
100
+ end
101
+
102
+ #Example: And the "Sex" selectbox should contain: Table
103
+ Then /^the "(.*?)" selectbox should contain:$/ do |locator, options|
104
+ patiently do
105
+ select_options_for(locator).should == options.raw.join(' ')
106
+ end
107
+ end
108
+
109
+
110
+ #************************ END CHECKBOXES *****************************************
111
+
112
+
113
+ #************************ RADIO BUTTONS*******************************************
114
+
115
+
116
+ #Example: And the "radio 1" radio should be selected
117
+ Then /^the "(.*?)" radio should be selected$/ do |locator|
118
+ patiently do
119
+ element = get_element_from(locator)
120
+ element.should be_checked
121
+ end
122
+ end
123
+ #Example: And the "radio 2" radio should not be selected
124
+ Then /^the "(.*?)" radio should not be selected$/ do |locator|
125
+ patiently do
126
+ element = get_element_from(locator)
127
+ element.should_not be_checked
128
+ end
129
+ end
130
+
131
+
132
+ #************************ END RADIO BUTTONS***************************************
133
+
134
+
135
+ #************************ DATE FIELD *********************************************
136
+
137
+
138
+ #Example: Then "12/31/2013" should be the default date for "datepicker"
139
+ Then /^"(.*?)" should be the default date for "(.*?)"$/ do |date_rule, field|
140
+ patiently do
141
+ date_field = get_element_from(field)
142
+ date_field.value.should == calculated_date_from(date_rule)
143
+ end
144
+ end
145
+
146
+
147
+ #************************ END DATE FIELD *****************************************
148
+
149
+
150
+
151
+ #****************Read from Excel
152
+
153
+ #****************User Name Field
154
+
155
+ #Example: Then I enter user name from excel in "Username"
156
+ Then /^I enter user name from excel in "(.*?)"$/ do |locator|
157
+ element = get_element_from(locator)
158
+
159
+ require 'spreadsheet'
160
+ Spreadsheet.client_encoding = 'UTF-8'
161
+ workbook = Spreadsheet.open 'C:\cmsmoketest\features\specifications\SmokeTest\book5.xls'
162
+ sheet1 = workbook.worksheet 0
163
+ sheet1.each 1 do |row|
164
+ #puts "#{row[0]} - #{row[1]} - #{row[2]}"
165
+ resolt = "#{row[0]}"
166
+ element.set resolt
167
+ end
168
+ end
169
+
170
+
171
+ #****************Password Field
172
+
173
+ #Example: Then I enter user name from excel in "Username"
174
+ Then(/^I enter password from excel in "([^"]*)" field$/) do |locator|
175
+ element = get_element_from(locator)
176
+ require 'spreadsheet'
177
+ Spreadsheet.client_encoding = 'UTF-8'
178
+ workbook = Spreadsheet.open 'C:\cmsmoketest\features\specifications\SmokeTest\book5.xls'
179
+ sheet1 = workbook.worksheet 0
180
+ sheet1.each 1 do |row|
181
+ resolt = "#{row[1]}"
182
+ element.set resolt
183
+ end
184
+
185
+ end
186
+
187
+ # Reads a plain text file
188
+ Then /[Rr]ead file "(.*?)"$/ do |filepath|
189
+ File.foreach(filepath) { |x| print 'Got ', x }
190
190
  end
@@ -1,47 +1,58 @@
1
- #Example: Given I am on the "home" page
2
- Given /^(?:|I )am on the "(.*)" (?:page|Page)$/ do |page_name|
3
- visit path_to(page_name)
4
- maximize_window
5
- end
6
-
7
- #Example: When I go to the "other" page
8
- When /^(?:|I )go to the "(.*)" page$/ do |page_name|
9
- visit path_to(page_name)
10
- end
11
-
12
- #Example: When I follow "Privacy Policy"
13
- When /^(?:|I )follow "([^"]*)"$/ do |link|
14
- patiently { click_link(link) }
15
- end
16
-
17
- #Example: When I maximize the window
18
- And /^(?:|I )maximize the window$/ do
19
- maximize_window
20
- end
21
-
22
- #Example: And I switch to the last window
23
- And /^(?:|I )switch to the (.*) window$/ do |first_or_last|
24
- change_window(first_or_last)
25
- end
26
-
27
-
28
- #Example: And I switch to the frame
29
- And /^(?:|I )[Ss]witch to the frame$/ do
30
- page.driver.browser.switch_to.frame(1)
31
- end
32
-
33
- # Accepts modal popups if they exist or fails gracefully if not
34
-
35
- #Example: Then I Accept the popup window
36
- Then /^(?:|I )[Aa]ccept (?:|the )popup(?:| window)$/ do
37
- page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertPresentError
38
- end
39
-
40
- #Dismisses modal popups if they exist or fails gracefully if not
41
-
42
- #Example: Then I Dismiss the popup window
43
- Then /^(?:|I )[Dd]ismiss (?:|the )popup(?:| window)$/ do
44
- page.driver.browser.switch_to.alert.dismiss rescue Selenium::WebDriver::Error::NoAlertPresentError
45
- end
46
-
47
- #-------------------------------------------------------
1
+ #Example: Given I am on the "home" page
2
+ Given /^(?:|I )am on the "(.*)" (?:page|Page)$/ do |page_name|
3
+ visit path_to(page_name)
4
+ maximize_window
5
+ end
6
+
7
+ #Example: When I go to the "other" page
8
+ When /^(?:|I )go to the "(.*)" page$/ do |page_name|
9
+ visit path_to(page_name)
10
+ end
11
+
12
+ #Example: When I follow "Privacy Policy"
13
+ When /^(?:|I )follow "([^"]*)"$/ do |link|
14
+ patiently { click_link(link) }
15
+ end
16
+
17
+ #Example: When I maximize the window
18
+ And /^(?:|I )maximize the window$/ do
19
+ maximize_window
20
+ end
21
+
22
+ #Example: And I switch to the last window
23
+ And /^(?:|I )switch to the (.*) window$/ do |first_or_last|
24
+ change_window(first_or_last)
25
+ end
26
+
27
+
28
+ #Example: And I switch to the frame
29
+ And /^(?:|I )[Ss]witch to the frame$/ do
30
+ page.driver.browser.switch_to.frame(1)
31
+ end
32
+
33
+ # Accepts modal popups if they exist or fails gracefully if not
34
+
35
+ #Example: Then I Accept the popup window
36
+ Then /^(?:|I )[Aa]ccept (?:|the )popup(?:| window)$/ do
37
+ page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertPresentError
38
+ end
39
+
40
+ #Dismisses modal popups if they exist or fails gracefully if not
41
+
42
+ #Example: Then I Dismiss the popup window
43
+ Then /^(?:|I )[Dd]ismiss (?:|the )popup(?:| window)$/ do
44
+ page.driver.browser.switch_to.alert.dismiss rescue Selenium::WebDriver::Error::NoAlertPresentError
45
+ end
46
+
47
+
48
+ #Example: And I switch to the iframe
49
+ And /^(?:|I )[Ss]witch to the iframe$/ do
50
+ page.driver.browser.switch_to.frame(0)
51
+ end
52
+
53
+ #Example: And I switch to the last_iframe
54
+ And /^(?:|I )[Ss]witch to the last_iframe$/ do
55
+ page.driver.browser.switch_to.parent_frame
56
+
57
+ end
58
+ #-------------------------------------------------------