awetestlib 0.1.28 → 0.1.29pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +22 -22
- data/.gitignore +69 -69
- data/.yardopts +7 -7
- data/README.md +108 -108
- data/awetestlib.gemspec +57 -57
- data/awetestlib.windows.gemspec +41 -41
- data/awetestlib_notes.txt +4 -4
- data/awetestlib_osx.gemspec +47 -48
- data/bin/awetestlib +99 -99
- data/bin/awetestlib-android-setup.rb +26 -26
- data/bin/awetestlib-cucumber-setup.rb +28 -28
- data/bin/awetestlib-driver-setup.rb +21 -21
- data/bin/awetestlib-helpers.rb +41 -41
- data/bin/awetestlib-mobile-app-setup.rb +31 -31
- data/bin/awetestlib-netbeans-setup.rb +58 -58
- data/bin/awetestlib-regression-setup.rb +15 -15
- data/bin/awetestlib-rubymine-setup.rb +39 -39
- data/drivers/chromedriver.exe +0 -0
- data/ext/Rakefile +1 -1
- data/ext/mkrf_conf.rb +27 -27
- data/lib/awetestlib/html_report.rb +142 -142
- data/lib/awetestlib/logging.rb +366 -366
- data/lib/awetestlib/regression/browser.rb +1380 -1375
- data/lib/awetestlib/regression/drag_and_drop.rb +421 -420
- data/lib/awetestlib/regression/find.rb +345 -345
- data/lib/awetestlib/regression/legacy.rb +1187 -1187
- data/lib/awetestlib/regression/page_data.rb +191 -191
- data/lib/awetestlib/regression/runner.rb +307 -307
- data/lib/awetestlib/regression/tables.rb +627 -619
- data/lib/awetestlib/regression/user_input.rb +576 -576
- data/lib/awetestlib/regression/utilities.rb +1046 -988
- data/lib/awetestlib/regression/validations.rb +1093 -1074
- data/lib/awetestlib/regression/waits.rb +470 -470
- data/lib/awetestlib/runner.rb +18 -18
- data/lib/awetestlib.rb +41 -41
- data/lib/patches/README +2 -2
- data/lib/patches/firewatir.rb +106 -106
- data/lib/patches/watir.rb +175 -175
- data/lib/version.rb +2 -2
- data/license.txt +13 -13
- data/netbeans_setup.md +29 -29
- data/rdoc_test.bat +1 -1
- data/rubymine_setup.md +23 -23
- data/setup_samples/sample_android/features/dk.mejer.hansen.control.FlyingColorsPlayerAidActivity.apk +0 -0
- data/setup_samples/sample_android/features/sample_android.feature +5 -5
- data/setup_samples/sample_android/features/step_definitions/calabash_steps.rb +1 -1
- data/setup_samples/sample_android/features/support/app_installation_hooks.rb +36 -36
- data/setup_samples/sample_android/features/support/app_life_cycle_hooks.rb +14 -14
- data/setup_samples/sample_android/features/test_servers/8ba795a0288381ae346b67867b586881_0.3.2.apk +0 -0
- data/setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb +76 -76
- data/setup_samples/sample_cucumber/features/yahoo_mail.feature +11 -11
- data/setup_samples/sample_mobile_app/features/my_first.feature +14 -14
- data/setup_samples/sample_mobile_app/features/step_definitions/predefined_webview_steps.rb +80 -80
- data/setup_samples/sample_mobile_app/features/support/env.rb +2 -2
- data/setup_samples/sample_netbeans/demo.rb +86 -86
- data/setup_samples/sample_netbeans/nbproject/configs/Demo.properties +2 -2
- data/setup_samples/sample_netbeans/nbproject/private/config.properties +1 -1
- data/setup_samples/sample_netbeans/nbproject/private/configs/Demo.properties +2 -2
- data/setup_samples/sample_netbeans/nbproject/private/private.properties +2 -2
- data/setup_samples/sample_netbeans/nbproject/project.properties +5 -5
- data/setup_samples/sample_netbeans/nbproject/project.xml +13 -13
- data/setup_samples/sample_rubymine/.idea/encodings.xml +5 -5
- data/setup_samples/sample_rubymine/.idea/misc.xml +5 -5
- data/setup_samples/sample_rubymine/.idea/modules.xml +9 -9
- data/setup_samples/sample_rubymine/.idea/sample_rubymine.iml +9 -9
- data/setup_samples/sample_rubymine/.idea/scopes/scope_settings.xml +4 -4
- data/setup_samples/sample_rubymine/.idea/vcs.xml +7 -7
- data/setup_samples/sample_rubymine/.idea/workspace.xml +213 -213
- data/setup_samples/sample_rubymine/demo.rb +86 -86
- data/test/create_zoho.rb +66 -66
- data/test/create_zoho_account1.rb +68 -68
- data/test/create_zoho_account2.rb +72 -72
- data/test/demo.rb +87 -87
- data/test/google_search1.rb +16 -16
- data/test/google_search2.rb +19 -19
- data/test/login_1.rb +37 -37
- data/test/login_1a.rb +37 -37
- data/test/login_2.rb +32 -32
- data/test/zoho_exercise.rb +21 -21
- data/test/zoho_util.rb +487 -487
- data/tmp/placeholder.html +71 -71
- metadata +18 -49
data/lib/awetestlib/runner.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
module Awetestlib
|
3
|
-
# Parent class. Each script type will have a Runner that inherits from this class.
|
4
|
-
class Runner
|
5
|
-
def initialize(options = {})
|
6
|
-
build_class = "Awetestlib::#{check_script_type(options[:script_type])}::Runner".constantize
|
7
|
-
build_class.new(options).start
|
8
|
-
end
|
9
|
-
|
10
|
-
def check_script_type(script_type)
|
11
|
-
case script_type
|
12
|
-
when "Regression" ; "Regression" #Should this be regression? possible rename
|
13
|
-
else ; script_type
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
1
|
+
require 'open-uri'
|
2
|
+
module Awetestlib
|
3
|
+
# Parent class. Each script type will have a Runner that inherits from this class.
|
4
|
+
class Runner
|
5
|
+
def initialize(options = {})
|
6
|
+
build_class = "Awetestlib::#{check_script_type(options[:script_type])}::Runner".constantize
|
7
|
+
build_class.new(options).start
|
8
|
+
end
|
9
|
+
|
10
|
+
def check_script_type(script_type)
|
11
|
+
case script_type
|
12
|
+
when "Regression" ; "Regression" #Should this be regression? possible rename
|
13
|
+
else ; script_type
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
data/lib/awetestlib.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
#require 'yaml' #Couldn't find use anywhere
|
2
|
-
require 'active_support/core_ext/hash'
|
3
|
-
|
4
|
-
module Awetestlib
|
5
|
-
::USING_WINDOWS = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
|
6
|
-
::USING_OSX = RUBY_PLATFORM =~ /darwin/
|
7
|
-
|
8
|
-
# @private
|
9
|
-
BROWSER_MAP = {
|
10
|
-
'FF' => 'Firefox',
|
11
|
-
'IE' => 'Internet Explorer',
|
12
|
-
'S' => 'Safari',
|
13
|
-
'MS' => 'Mobile Safari',
|
14
|
-
'C' => 'Chrome'
|
15
|
-
}
|
16
|
-
|
17
|
-
# @private
|
18
|
-
BROWSER_ALTERNATES = {
|
19
|
-
'OSX' => { 'IE' => 'S' },
|
20
|
-
'Windows' => { 'S' => 'IE' }
|
21
|
-
}
|
22
|
-
|
23
|
-
if USING_WINDOWS
|
24
|
-
#require 'win32ole' <-- We'll load this later in Shamisen::AwetestLegacy::Runner. It has to be loaded after watir, see https://www.pivotaltracker.com/story/show/19249981
|
25
|
-
#require 'win32/screenshot' # triggering segmentation fault 10sep2012 pmn
|
26
|
-
end
|
27
|
-
#require 'active_support/inflector'
|
28
|
-
#require 'active_support/core_ext/object'
|
29
|
-
#require 'active_support/core_ext/hash'
|
30
|
-
require 'awetestlib/runner'
|
31
|
-
require 'andand'
|
32
|
-
require 'awetestlib/regression/runner'
|
33
|
-
require 'pry'
|
34
|
-
|
35
|
-
if USING_OSX
|
36
|
-
require 'appscript'
|
37
|
-
end
|
38
|
-
|
39
|
-
#require 'roo' #moved to awetestlib runner
|
40
|
-
|
41
|
-
end
|
1
|
+
#require 'yaml' #Couldn't find use anywhere
|
2
|
+
require 'active_support/core_ext/hash'
|
3
|
+
|
4
|
+
module Awetestlib
|
5
|
+
::USING_WINDOWS = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
|
6
|
+
::USING_OSX = RUBY_PLATFORM =~ /darwin/
|
7
|
+
|
8
|
+
# @private
|
9
|
+
BROWSER_MAP = {
|
10
|
+
'FF' => 'Firefox',
|
11
|
+
'IE' => 'Internet Explorer',
|
12
|
+
'S' => 'Safari',
|
13
|
+
'MS' => 'Mobile Safari',
|
14
|
+
'C' => 'Chrome'
|
15
|
+
}
|
16
|
+
|
17
|
+
# @private
|
18
|
+
BROWSER_ALTERNATES = {
|
19
|
+
'OSX' => { 'IE' => 'S' },
|
20
|
+
'Windows' => { 'S' => 'IE' }
|
21
|
+
}
|
22
|
+
|
23
|
+
if USING_WINDOWS
|
24
|
+
#require 'win32ole' <-- We'll load this later in Shamisen::AwetestLegacy::Runner. It has to be loaded after watir, see https://www.pivotaltracker.com/story/show/19249981
|
25
|
+
#require 'win32/screenshot' # triggering segmentation fault 10sep2012 pmn
|
26
|
+
end
|
27
|
+
#require 'active_support/inflector'
|
28
|
+
#require 'active_support/core_ext/object'
|
29
|
+
#require 'active_support/core_ext/hash'
|
30
|
+
require 'awetestlib/runner'
|
31
|
+
require 'andand'
|
32
|
+
require 'awetestlib/regression/runner'
|
33
|
+
require 'pry'
|
34
|
+
|
35
|
+
if USING_OSX
|
36
|
+
require 'appscript'
|
37
|
+
end
|
38
|
+
|
39
|
+
#require 'roo' #moved to awetestlib runner
|
40
|
+
|
41
|
+
end
|
data/lib/patches/README
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
We put here small monkey patches to the gems we use.
|
2
|
-
This is the easier path when we sometimes just need to override or add a few methods in a gem; we don't really need to fork it.
|
1
|
+
We put here small monkey patches to the gems we use.
|
2
|
+
This is the easier path when we sometimes just need to override or add a few methods in a gem; we don't really need to fork it.
|
data/lib/patches/firewatir.rb
CHANGED
@@ -1,106 +1,106 @@
|
|
1
|
-
module FireWatir
|
2
|
-
class Firefox
|
3
|
-
|
4
|
-
def close
|
5
|
-
|
6
|
-
if js_eval("getWindows().length").to_i == 1
|
7
|
-
js_eval("getWindows()[0].close()")
|
8
|
-
|
9
|
-
if current_os == :macosx
|
10
|
-
%x{ osascript -e 'tell application "Firefox" to quit' }
|
11
|
-
end
|
12
|
-
|
13
|
-
# wait for the app to close properly
|
14
|
-
@t.join if @t
|
15
|
-
else
|
16
|
-
# Check if window exists, because there may be the case that it has been closed by click event on some element.
|
17
|
-
# For e.g: Close Button, Close this Window link etc.
|
18
|
-
window_number = find_window(:url, @window_url)
|
19
|
-
|
20
|
-
# If matching window found. Close the window.
|
21
|
-
if window_number.try(:>, 0)
|
22
|
-
js_eval "getWindows()[#{window_number}].close()"
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# Waits for the page to get loaded.
|
31
|
-
def wait(last_url = nil)
|
32
|
-
#puts "In wait function "
|
33
|
-
isLoadingDocument = ""
|
34
|
-
start = Time.now
|
35
|
-
|
36
|
-
while isLoadingDocument != "false"
|
37
|
-
# MONKEYPATCH - START
|
38
|
-
isLoadingDocument = js_eval("#{browser_var}=#{window_var}.getBrowser(); #{browser_var}.webProgress.isLoadingDocument;") rescue return
|
39
|
-
# MONKEYPATCH - END
|
40
|
-
#puts "Is browser still loading page: #{isLoadingDocument}"
|
41
|
-
|
42
|
-
# Raise an exception if the page fails to load
|
43
|
-
if (Time.now - start) > 300
|
44
|
-
raise "Page Load Timeout"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
# If the redirect is to a download attachment that does not reload this page, this
|
48
|
-
# method will loop forever. Therefore, we need to ensure that if this method is called
|
49
|
-
# twice with the same URL, we simply accept that we're done.
|
50
|
-
url = js_eval("#{browser_var}.contentDocument.URL")
|
51
|
-
|
52
|
-
if(url != last_url)
|
53
|
-
# Check for Javascript redirect. As we are connected to Firefox via JSSh. JSSh
|
54
|
-
# doesn't detect any javascript redirects so check it here.
|
55
|
-
# If page redirects to itself that this code will enter in infinite loop.
|
56
|
-
# So we currently don't wait for such a page.
|
57
|
-
# wait variable in JSSh tells if we should wait more for the page to get loaded
|
58
|
-
# or continue. -1 means page is not redirected. Anyother positive values means wait.
|
59
|
-
jssh_command = "var wait = -1; var meta = null; meta = #{browser_var}.contentDocument.getElementsByTagName('meta');
|
60
|
-
if(meta != null)
|
61
|
-
{
|
62
|
-
var doc_url = #{browser_var}.contentDocument.URL;
|
63
|
-
for(var i=0; i< meta.length;++i)
|
64
|
-
{
|
65
|
-
var content = meta[i].content;
|
66
|
-
var regex = new RegExp(\"^refresh$\", \"i\");
|
67
|
-
if(regex.test(meta[i].httpEquiv))
|
68
|
-
{
|
69
|
-
var arrContent = content.split(';');
|
70
|
-
var redirect_url = null;
|
71
|
-
if(arrContent.length > 0)
|
72
|
-
{
|
73
|
-
if(arrContent.length > 1)
|
74
|
-
redirect_url = arrContent[1];
|
75
|
-
|
76
|
-
if(redirect_url != null)
|
77
|
-
{
|
78
|
-
regex = new RegExp(\"^.*\" + redirect_url + \"$\");
|
79
|
-
if(!regex.test(doc_url))
|
80
|
-
{
|
81
|
-
wait = arrContent[0];
|
82
|
-
}
|
83
|
-
}
|
84
|
-
break;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
89
|
-
wait;"
|
90
|
-
wait_time = js_eval(jssh_command).to_i
|
91
|
-
begin
|
92
|
-
if(wait_time != -1)
|
93
|
-
sleep(wait_time)
|
94
|
-
# Call wait again. In case there are multiple redirects.
|
95
|
-
js_eval "#{browser_var} = #{window_var}.getBrowser()"
|
96
|
-
wait(url)
|
97
|
-
end
|
98
|
-
rescue
|
99
|
-
end
|
100
|
-
end
|
101
|
-
set_browser_document()
|
102
|
-
run_error_checks()
|
103
|
-
return self
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
1
|
+
module FireWatir
|
2
|
+
class Firefox
|
3
|
+
|
4
|
+
def close
|
5
|
+
|
6
|
+
if js_eval("getWindows().length").to_i == 1
|
7
|
+
js_eval("getWindows()[0].close()")
|
8
|
+
|
9
|
+
if current_os == :macosx
|
10
|
+
%x{ osascript -e 'tell application "Firefox" to quit' }
|
11
|
+
end
|
12
|
+
|
13
|
+
# wait for the app to close properly
|
14
|
+
@t.join if @t
|
15
|
+
else
|
16
|
+
# Check if window exists, because there may be the case that it has been closed by click event on some element.
|
17
|
+
# For e.g: Close Button, Close this Window link etc.
|
18
|
+
window_number = find_window(:url, @window_url)
|
19
|
+
|
20
|
+
# If matching window found. Close the window.
|
21
|
+
if window_number.try(:>, 0)
|
22
|
+
js_eval "getWindows()[#{window_number}].close()"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
# Waits for the page to get loaded.
|
31
|
+
def wait(last_url = nil)
|
32
|
+
#puts "In wait function "
|
33
|
+
isLoadingDocument = ""
|
34
|
+
start = Time.now
|
35
|
+
|
36
|
+
while isLoadingDocument != "false"
|
37
|
+
# MONKEYPATCH - START
|
38
|
+
isLoadingDocument = js_eval("#{browser_var}=#{window_var}.getBrowser(); #{browser_var}.webProgress.isLoadingDocument;") rescue return
|
39
|
+
# MONKEYPATCH - END
|
40
|
+
#puts "Is browser still loading page: #{isLoadingDocument}"
|
41
|
+
|
42
|
+
# Raise an exception if the page fails to load
|
43
|
+
if (Time.now - start) > 300
|
44
|
+
raise "Page Load Timeout"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
# If the redirect is to a download attachment that does not reload this page, this
|
48
|
+
# method will loop forever. Therefore, we need to ensure that if this method is called
|
49
|
+
# twice with the same URL, we simply accept that we're done.
|
50
|
+
url = js_eval("#{browser_var}.contentDocument.URL")
|
51
|
+
|
52
|
+
if(url != last_url)
|
53
|
+
# Check for Javascript redirect. As we are connected to Firefox via JSSh. JSSh
|
54
|
+
# doesn't detect any javascript redirects so check it here.
|
55
|
+
# If page redirects to itself that this code will enter in infinite loop.
|
56
|
+
# So we currently don't wait for such a page.
|
57
|
+
# wait variable in JSSh tells if we should wait more for the page to get loaded
|
58
|
+
# or continue. -1 means page is not redirected. Anyother positive values means wait.
|
59
|
+
jssh_command = "var wait = -1; var meta = null; meta = #{browser_var}.contentDocument.getElementsByTagName('meta');
|
60
|
+
if(meta != null)
|
61
|
+
{
|
62
|
+
var doc_url = #{browser_var}.contentDocument.URL;
|
63
|
+
for(var i=0; i< meta.length;++i)
|
64
|
+
{
|
65
|
+
var content = meta[i].content;
|
66
|
+
var regex = new RegExp(\"^refresh$\", \"i\");
|
67
|
+
if(regex.test(meta[i].httpEquiv))
|
68
|
+
{
|
69
|
+
var arrContent = content.split(';');
|
70
|
+
var redirect_url = null;
|
71
|
+
if(arrContent.length > 0)
|
72
|
+
{
|
73
|
+
if(arrContent.length > 1)
|
74
|
+
redirect_url = arrContent[1];
|
75
|
+
|
76
|
+
if(redirect_url != null)
|
77
|
+
{
|
78
|
+
regex = new RegExp(\"^.*\" + redirect_url + \"$\");
|
79
|
+
if(!regex.test(doc_url))
|
80
|
+
{
|
81
|
+
wait = arrContent[0];
|
82
|
+
}
|
83
|
+
}
|
84
|
+
break;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
wait;"
|
90
|
+
wait_time = js_eval(jssh_command).to_i
|
91
|
+
begin
|
92
|
+
if(wait_time != -1)
|
93
|
+
sleep(wait_time)
|
94
|
+
# Call wait again. In case there are multiple redirects.
|
95
|
+
js_eval "#{browser_var} = #{window_var}.getBrowser()"
|
96
|
+
wait(url)
|
97
|
+
end
|
98
|
+
rescue
|
99
|
+
end
|
100
|
+
end
|
101
|
+
set_browser_document()
|
102
|
+
run_error_checks()
|
103
|
+
return self
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|