awetestlib 0.1.30pre2 → 0.1.30pre3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/version.rb
CHANGED
@@ -1,20 +1,87 @@
|
|
1
|
-
require 'pry'
|
2
|
-
|
3
1
|
def awetestlib?
|
4
2
|
not Awetestlib::Runner.nil?
|
5
3
|
rescue
|
6
4
|
return false
|
7
5
|
end
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
def setup_classic_watir
|
8
|
+
require 'watir'
|
9
|
+
require 'win32ole'
|
10
|
+
$ai = ::WIN32OLE.new('AutoItX3.Control')
|
11
|
+
$first_index = 1
|
12
|
+
$timestamp = Time.now.strftime("%Y%m%d%H%M%S")
|
13
|
+
$watir_script = true
|
14
|
+
Watir::IE.close_all
|
15
|
+
Watir::IE.visible = true
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup_watir_webdriver
|
19
|
+
require 'watir-webdriver'
|
20
|
+
$first_index = 0
|
14
21
|
$timestamp = Time.now.strftime("%Y%m%d%H%M%S")
|
15
|
-
$watir_script =
|
16
|
-
|
17
|
-
|
22
|
+
$watir_script = false
|
23
|
+
end
|
24
|
+
|
25
|
+
def open_firefox
|
26
|
+
setup_watir_webdriver
|
27
|
+
@browser = Watir::Browser.new :firefox
|
28
|
+
end
|
29
|
+
|
30
|
+
def open_chrome
|
31
|
+
setup_watir_webdriver
|
32
|
+
@browser = Watir::Browser.new :chrome
|
33
|
+
end
|
34
|
+
|
35
|
+
def open_internet_explorer
|
36
|
+
if $watir_script
|
37
|
+
setup_classic_watir
|
38
|
+
@browser = Watir::IE.new
|
39
|
+
@browser.speed = :fast
|
40
|
+
else
|
41
|
+
setup_watir_webdriver
|
42
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
43
|
+
client.timeout = 300 # seconds – default is 60
|
44
|
+
@browser = Watir::Browser.new :ie, :http_client => client
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def navigate_to_environment_url
|
49
|
+
if @params and @params['environment'] and @params['environment']['url']
|
50
|
+
url = @params['environment']['url']
|
51
|
+
elsif @login and @login['url']
|
52
|
+
url = @login['url']
|
53
|
+
elsif @role and @login[@role] and @login[@role]['url']
|
54
|
+
url = @login[@role]['url']
|
55
|
+
end
|
56
|
+
@browser.goto url
|
57
|
+
end
|
58
|
+
|
59
|
+
def open_a_browser
|
60
|
+
if @params
|
61
|
+
puts "@params: #{@params}"
|
62
|
+
case @params["browser"]
|
63
|
+
when "FF"
|
64
|
+
open_firefox
|
65
|
+
when "IE"
|
66
|
+
open_internet_explorer
|
67
|
+
when "C", "GC"
|
68
|
+
open_chrome
|
69
|
+
end
|
70
|
+
else
|
71
|
+
if $watir_script
|
72
|
+
open_internet_explorer
|
73
|
+
else
|
74
|
+
open_firefox
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
Given /^I run with Watir$/ do
|
80
|
+
if @params and not @params["browser"] == "IE"
|
81
|
+
puts "@params['browser']=>#{@params['browser']} not compatible with classic Watir. Loading Watir-Webdriver."
|
82
|
+
else
|
83
|
+
setup_classic_watir
|
84
|
+
end
|
18
85
|
end
|
19
86
|
|
20
87
|
Given /^I run with Classic Watir$/ do
|
@@ -22,77 +89,47 @@ Given /^I run with Classic Watir$/ do
|
|
22
89
|
end
|
23
90
|
|
24
91
|
Given /^I run with Watir-webdriver$/i do
|
25
|
-
|
26
|
-
$first_index = 0
|
27
|
-
$timestamp = Time.now.strftime("%Y%m%d%H%M%S")
|
28
|
-
$watir_script = false
|
92
|
+
setup_watir_webdriver
|
29
93
|
end
|
30
94
|
|
95
|
+
When /^I open a browser$/i do
|
96
|
+
open_a_browser
|
97
|
+
end
|
31
98
|
|
32
99
|
When /^I open a new browser$/i do
|
33
|
-
|
34
|
-
|
35
|
-
case @params["browser"]
|
36
|
-
when "FF"
|
37
|
-
step "I open Firefox"
|
38
|
-
when "IE"
|
39
|
-
step "I open Internet Explorer"
|
40
|
-
when "C", "GC"
|
41
|
-
step "I open Chrome"
|
42
|
-
end
|
43
|
-
else
|
44
|
-
step "I open Firefox"
|
45
|
-
end
|
46
|
-
end
|
100
|
+
open_a_browser
|
101
|
+
end
|
47
102
|
|
48
103
|
Given /^I open a F?f?irefox B?b?rowser$/i do
|
49
|
-
|
104
|
+
open_firefox
|
50
105
|
end
|
51
106
|
|
52
107
|
Given /^I open Firefox$/ do
|
53
|
-
|
54
|
-
@browser = Watir::Browser.new :firefox
|
108
|
+
open_firefox
|
55
109
|
end
|
56
110
|
|
57
111
|
Given /^I open a C?c?hrome B?b?rowser$/i do
|
58
|
-
|
112
|
+
open_chrome
|
59
113
|
end
|
60
114
|
|
61
115
|
Given /^I open Chrome$/ do
|
62
|
-
|
63
|
-
@browser = Watir::Browser.new :chrome
|
116
|
+
open_chrome
|
64
117
|
end
|
65
118
|
|
66
119
|
When /^I open an IE B?b?rowser$/i do
|
67
|
-
|
120
|
+
open_internet_explorer
|
68
121
|
end
|
69
122
|
|
70
123
|
Given /^I open an I?i?nternet E?e?xplorer B?b?rowser$/i do
|
71
|
-
|
124
|
+
open_internet_explorer
|
72
125
|
end
|
73
126
|
|
74
127
|
Given /^I open Internet Explorer$/i do
|
75
|
-
|
76
|
-
step "I run with Watir"
|
77
|
-
@browser = Watir::IE.new
|
78
|
-
@browser.speed = :fast
|
79
|
-
else
|
80
|
-
step "I run with Watir-webdriver"
|
81
|
-
client = Selenium::WebDriver::Remote::Http::Default.new
|
82
|
-
client.timeout = 300 # seconds – default is 60
|
83
|
-
@browser = Watir::Browser.new :ie, :http_client => client
|
84
|
-
end
|
128
|
+
open_internet_explorer
|
85
129
|
end
|
86
130
|
|
87
131
|
Then /^I navigate to the environment url$/ do
|
88
|
-
|
89
|
-
url = @params['environment']['url']
|
90
|
-
elsif @login and @login['url']
|
91
|
-
url = @login['url']
|
92
|
-
elsif @role and @login[@role] and @login[@role]['url']
|
93
|
-
url = @login[@role]['url']
|
94
|
-
end
|
95
|
-
@browser.goto url
|
132
|
+
navigate_to_environment_url
|
96
133
|
end
|
97
134
|
|
98
135
|
Then /^I go to the url "(.*?)"$/ do |url|
|
@@ -100,7 +137,7 @@ Then /^I go to the url "(.*?)"$/ do |url|
|
|
100
137
|
end
|
101
138
|
|
102
139
|
Then /^I go to the (URL|url)$/ do |dummy|
|
103
|
-
|
140
|
+
navigate_to_environment_url
|
104
141
|
end
|
105
142
|
|
106
143
|
Then /^I click "(.*?)"$/ do |element_text|
|
@@ -204,6 +241,7 @@ Then /^I fill in "(.*?)" with "(.*?)"$/ do |field, value| # assumes a label elem
|
|
204
241
|
end
|
205
242
|
|
206
243
|
Then /^let me debug$|^pry$|^execute binding.pry$/ do
|
244
|
+
require 'pry'
|
207
245
|
binding.pry
|
208
246
|
end
|
209
247
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awetestlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -223651761
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
9
|
- 30
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 0.1.
|
11
|
+
- 3
|
12
|
+
version: 0.1.30pre3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Anthony Woo
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2013-05-
|
21
|
+
date: 2013-05-06 00:00:00 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: watir-webdriver
|