awetestlib 0.1.30pre2-x86-mingw32 → 0.1.30pre3-x86-mingw32
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,67 @@
|
|
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
|
+
Given /^I run with Watir$/ do
|
60
|
+
if @params and not @params["browser"] == "IE"
|
61
|
+
puts "@params['browser']=>#{@params['browser']} not compatible with classic Watir. Loading Watir-Webdriver."
|
62
|
+
else
|
63
|
+
setup_classic_watir
|
64
|
+
end
|
18
65
|
end
|
19
66
|
|
20
67
|
Given /^I run with Classic Watir$/ do
|
@@ -22,77 +69,59 @@ Given /^I run with Classic Watir$/ do
|
|
22
69
|
end
|
23
70
|
|
24
71
|
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
|
72
|
+
setup_watir_webdriver
|
29
73
|
end
|
30
74
|
|
31
|
-
|
32
75
|
When /^I open a new browser$/i do
|
33
76
|
if @params
|
34
77
|
puts "@params: #{@params}"
|
35
78
|
case @params["browser"]
|
36
79
|
when "FF"
|
37
|
-
|
80
|
+
open_firefox
|
38
81
|
when "IE"
|
39
|
-
|
82
|
+
open_internet_explorer
|
40
83
|
when "C", "GC"
|
41
|
-
|
84
|
+
open_chrome
|
42
85
|
end
|
43
86
|
else
|
44
|
-
|
87
|
+
if $watir_script
|
88
|
+
open_internet_explorer
|
89
|
+
else
|
90
|
+
open_firefox
|
91
|
+
end
|
45
92
|
end
|
46
|
-
|
93
|
+
end
|
47
94
|
|
48
95
|
Given /^I open a F?f?irefox B?b?rowser$/i do
|
49
|
-
|
96
|
+
open_firefox
|
50
97
|
end
|
51
98
|
|
52
99
|
Given /^I open Firefox$/ do
|
53
|
-
|
54
|
-
@browser = Watir::Browser.new :firefox
|
100
|
+
open_firefox
|
55
101
|
end
|
56
102
|
|
57
103
|
Given /^I open a C?c?hrome B?b?rowser$/i do
|
58
|
-
|
104
|
+
open_chrome
|
59
105
|
end
|
60
106
|
|
61
107
|
Given /^I open Chrome$/ do
|
62
|
-
|
63
|
-
@browser = Watir::Browser.new :chrome
|
108
|
+
open_chrome
|
64
109
|
end
|
65
110
|
|
66
111
|
When /^I open an IE B?b?rowser$/i do
|
67
|
-
|
112
|
+
open_internet_explorer
|
68
113
|
end
|
69
114
|
|
70
115
|
Given /^I open an I?i?nternet E?e?xplorer B?b?rowser$/i do
|
71
|
-
|
116
|
+
open_internet_explorer
|
72
117
|
end
|
73
118
|
|
74
119
|
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
|
120
|
+
open_internet_explorer
|
85
121
|
end
|
86
122
|
|
87
123
|
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
|
124
|
+
navigate_to_environment_url
|
96
125
|
end
|
97
126
|
|
98
127
|
Then /^I go to the url "(.*?)"$/ do |url|
|
@@ -100,7 +129,7 @@ Then /^I go to the url "(.*?)"$/ do |url|
|
|
100
129
|
end
|
101
130
|
|
102
131
|
Then /^I go to the (URL|url)$/ do |dummy|
|
103
|
-
|
132
|
+
navigate_to_environment_url
|
104
133
|
end
|
105
134
|
|
106
135
|
Then /^I click "(.*?)"$/ do |element_text|
|
@@ -204,6 +233,7 @@ Then /^I fill in "(.*?)" with "(.*?)"$/ do |field, value| # assumes a label elem
|
|
204
233
|
end
|
205
234
|
|
206
235
|
Then /^let me debug$|^pry$|^execute binding.pry$/ do
|
236
|
+
require 'pry'
|
207
237
|
binding.pry
|
208
238
|
end
|
209
239
|
|
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: x86-mingw32
|
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
|