awetestlib 0.0.2-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/.gitignore ADDED
@@ -0,0 +1,70 @@
1
+ sinatra.pid
2
+ shamisen-*.gem
3
+ vendor/cache/*
4
+
5
+ # gVim tmp files
6
+ *~
7
+ # rcov generated
8
+ coverage
9
+
10
+ # rdoc generated
11
+ rdoc
12
+
13
+ # yard generated
14
+ doc
15
+ .yardoc
16
+
17
+ # bundler
18
+ .bundle
19
+ Gemfile.lock
20
+
21
+ # jeweler generated
22
+ pkg
23
+
24
+ # for windows
25
+ Thumb.db
26
+
27
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
28
+ #
29
+ # * Create a file at ~/.gitignore
30
+ # * Include files you want ignored
31
+ # * Run: git config --global core.excludesfile ~/.gitignore
32
+ #
33
+ # After doing this, these files will be ignored in all your git projects,
34
+ # saving you from having to 'pollute' every project you touch with them
35
+ #
36
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
37
+ #
38
+ # For MacOS:
39
+ #
40
+ .DS_Store
41
+ tmp/*
42
+ .rvmrc
43
+
44
+ # For TextMate
45
+ #*.tmproj
46
+ #tmtags
47
+
48
+ # For emacs:
49
+ #*~
50
+ #\#*
51
+ #.\#*
52
+
53
+ # For vim:
54
+ *.sw[onp]
55
+
56
+ # For redcar:
57
+ #.redcar
58
+
59
+ # For rubinius:
60
+ #*.rbc
61
+
62
+ config/win2008.txt
63
+
64
+ __MACOSX/
65
+ short_passing_test/
66
+ dump.rdb
67
+ .idea
68
+ config/settings.yml
69
+ PROJECT_NAME
70
+ *.log
@@ -0,0 +1,57 @@
1
+ # -*- encoding: utf-8 -*-
2
+ puts "#{$0}"
3
+ require "lib/version"
4
+
5
+ #hack for debugging
6
+ `wellsproxy`
7
+ #end hack
8
+
9
+ Gem::Specification.new do |s|
10
+
11
+ s.name = "awetestlib"
12
+ s.version = Awetestlib::VERSION
13
+ s.date = Awetestlib::VERSION_DATE
14
+ s.platform = Gem::Platform::RUBY
15
+
16
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
17
+ s.authors = ["Anthony Woo", "Patrick Neve"]
18
+ s.email = %q{patrick@3qilabs.com}
19
+ s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
20
+ s.homepage = %q{http://3qilabs.com}
21
+ s.description = %q{Awetest DSL for automated testing of browser-based applications.}
22
+
23
+ # possible dependencies (from shamisen gemfile)
24
+ #s.add_dependency('i18n')
25
+
26
+ # windows specific
27
+ #s.add_dependency('watir', '1.8.1')
28
+ #s.add_dependency('commonwatir', '1.8.1')
29
+ #s.add_dependency('firewatir', '1.8.1')
30
+ #s.add_dependency('watirloo')
31
+ #s.add_dependency('win32-process')
32
+ #s.add_dependency('win32screenshot')
33
+
34
+ # all platforms?
35
+ begin
36
+ #s.add_dependency('ffi', '= 1.0.9')
37
+ s.add_dependency('activesupport', '~> 3.0.0')
38
+ s.add_dependency('watir-webdriver')
39
+ s.add_dependency('andand')
40
+ s.add_dependency('spreadsheet', '0.6.8')
41
+ s.add_dependency('google-spreadsheet-ruby', '0.1.6')
42
+ s.add_dependency('roo', '1.10.1')
43
+ #s.add_dependency('selenium-client') # for running selenium scripts
44
+ s.add_dependency('selenium-webdriver')
45
+ rescue
46
+ puts "#{$!}"
47
+ end
48
+
49
+ s.require_paths = ["lib","ext"]
50
+ s.files = `git ls-files`.split("\n")
51
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
52
+
53
+ #This line tells rubygems to look for an extension to install
54
+ s.extensions << 'ext/mkrf_conf.rb'
55
+
56
+ end
57
+
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require "lib/version"
3
+
4
+ Gem::Specification.new do |s|
5
+
6
+ s.name = %q{awetestlib}
7
+ s.version = Awetestlib::VERSION
8
+ s.date = Awetestlib::VERSION_DATE
9
+ s.platform = Gem::Platform::CURRENT
10
+
11
+ #s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Anthony Woo", "Patrick Neve"]
13
+ s.email = %q{patrick@3qilabs.com}
14
+ s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
+ s.homepage = %q{http://3qilabs.com}
16
+ s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
+
18
+ s.add_dependency('watir-webdriver')
19
+ s.add_dependency('watir', '1.8.1')
20
+ s.add_dependency('commonwatir', '1.8.1')
21
+ s.add_dependency('firewatir', '1.8.1')
22
+ s.add_dependency('activesupport', '~> 3.0.0')
23
+ s.add_dependency('i18n')
24
+ s.add_dependency('andand')
25
+ s.add_dependency('watirloo')
26
+ s.add_dependency('win32-process')
27
+ s.add_dependency('win32screenshot')
28
+ s.add_dependency('spreadsheet', '0.6.8')
29
+ s.add_dependency('google-spreadsheet-ruby', '0.1.6')
30
+ s.add_dependency('roo', '1.10.1')
31
+ s.add_dependency('selenium-webdriver')
32
+ s.add_dependency('pry')
33
+ s.add_dependency('rdoc', '~> 3.11')
34
+
35
+
36
+ s.require_paths = ["lib"]
37
+ s.files = `git ls-files`.split("\n")
38
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
39
+
40
+ end
41
+
@@ -0,0 +1,4 @@
1
+ = does not include patch for IE 7.0 or earlier modal dialog window title ('Web Page Dialog' vs. 'Webpage Dialog')
2
+ See 'http://github.com/radamanthus/watir'
3
+ = user must download chromedriver.exe and put somewhere in PATH ( ruby\bin works )
4
+
@@ -0,0 +1,43 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require "lib/version"
3
+
4
+ Gem::Specification.new do |s|
5
+
6
+ s.name = %q{awetestlib}
7
+ s.version = Awetestlib::VERSION
8
+ s.date = Awetestlib::VERSION_DATE
9
+ s.platform = Gem::Platform::RUBY
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Anthony Woo", "Patrick Neve"]
13
+ s.email = %q{patrick@3qilabs.com}
14
+ s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
+ s.homepage = %q{http://3qilabs.com}
16
+ s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
+
18
+ s.add_dependency('watir-webdriver')
19
+ #s.add_dependency('watir', '1.8.1')
20
+ #s.add_dependency('commonwatir', '1.8.1')
21
+ #s.add_dependency('firewatir', '1.8.1')
22
+ s.add_dependency('activesupport', '~> 3.0.0')
23
+ s.add_dependency('andand')
24
+ #s.add_dependency('watirloo')
25
+ #s.add_dependency('win32-process')
26
+ #s.add_dependency('win32screenshot')
27
+ s.add_dependency('spreadsheet', '0.6.8')
28
+ s.add_dependency('google-spreadsheet-ruby', '0.1.6')
29
+ s.add_dependency('roo', '1.10.1')
30
+ s.add_dependency('multipart-post', '1.1.4')
31
+ s.add_dependency('selenium-webdriver')
32
+ s.add_dependency('nokogiri')
33
+
34
+
35
+ s.require_paths = ["lib"] #,"ext"]
36
+ s.files = `git ls-files`.split("\n")
37
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
38
+
39
+ #This line tells rubygems to look for an extension to install
40
+ #s.extensions = ["ext\\mkrf_conf.rb"]
41
+
42
+ end
43
+
data/bin/awetestlib ADDED
@@ -0,0 +1,67 @@
1
+ $: << "./lib"
2
+ require 'optparse'
3
+ require 'awetestlib'
4
+
5
+ options = { }
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: awetestlib <script_file> [options]"
8
+
9
+ opts.on("-m RUN_MODE", "--run_mode RUN_MODE", "Specify the run mode: local, local_zip, remote_zip") do |run_mode|
10
+ options[:run_mode] = run_mode
11
+ end
12
+ opts.on("-r ROOT_PATH", "--root_path ROOT_PATH", "Specify the root path") do |root_path|
13
+ options[:root_path] = root_path
14
+ end
15
+ opts.on("-l LIBRARY", "--library LIBRARY", "Specify a library to be loaded") do |library|
16
+ options[:library] = library.to_s
17
+ end
18
+ opts.on("-x EXCEL_FILE", "--excel EXCEL_FILE", "Specify an excel file containing variables to be loaded") do |xls_path|
19
+ options[:xls_path] = xls_path
20
+ end
21
+ opts.on("-b BROWSER", "--browser BROWSER", "Specify a browser (IE, FF, S, C)") do |browser|
22
+ options[:browser] = browser
23
+ end
24
+ opts.on("-v VERSION", "--version VERSION", "Specify a browser version") do |v|
25
+ options[:version] = v
26
+ end
27
+ opts.on("-e", "--environment_url ENVIRONMENT_URL", "Specify the environment URL") do |environment_url|
28
+ options[:environment_url] = environment_url
29
+ end
30
+ opts.on("-f", "--environment_node_name ENVIRONMENT_NODENAME", "Specify the environment node name") do |node_name|
31
+ options[:environment_nodename] = node_name
32
+ end
33
+ opts.on("-n", "--environment_name ENVIRONMENT_NAME", "Specify the environment name") do |environment_name|
34
+ options[:environment_name] = environment_name
35
+ end
36
+ opts.on("-u SELENIUM_REMOTE_URL", "--selenium_remote_url SELENIUM_REMOTE_URL", "Specify the device's remote url and port") do |remote_url|
37
+ options[:remote_url] = remote_url
38
+ end
39
+ opts.on("-s SCREENCAP_PATH", "--screencap-path SCREENCAP_PATH", "Specify the path where screenshots will be saved") do |screencap_path|
40
+ options[:screencap_path] = screencap_path
41
+ end
42
+ opts.on("-d", "--debug", "Run debugger on first script failure") do
43
+ options[:debug_on_fail] = true
44
+ end
45
+ # add persistent logging for awetestlib. pmn 05jun2012
46
+ opts.on("-o", "--output_to_log", "Write to log file") do
47
+ options[:output_to_log] = true
48
+ end
49
+ opts.on("", "--log_path_subdir LOG_PATH_SUBDIR", "Specify log path relative to root_path.") do |log_path_subdir|
50
+ options[:log_path_subdir] = log_path_subdir
51
+ end
52
+ opts.on("", "--report_all_test_refs REPORT_ALL_TEST_REFS", "Include list of all error/test case reference ids actually validated.") do
53
+ options[:report_all_test_refs] = true
54
+ end
55
+
56
+ end.parse!
57
+
58
+ options[:environment] ||= {}
59
+ options[:environment]["name"] = options[:environment_name]
60
+ options[:environment]["url"] = options[:environment_url]
61
+ options[:environment]["nodename"] = options[:environment_nodename]
62
+ options[:script_type] = 'AwetestLegacy'
63
+ options[:script_file] = ARGV[0]
64
+
65
+ IS_WIN_2008 = File.exists?("config/win2008.txt")
66
+
67
+ Awetestlib::Runner.new(options).start
@@ -0,0 +1,66 @@
1
+ module CreateZohoAccount1
2
+
3
+ def run_test(browser)
4
+ create_account_scenario_1(browser)
5
+ create_account_scenario_2(browser)
6
+ end
7
+
8
+ def create_account_scenario_1(browser)
9
+ create_account(browser)
10
+ create_blank_new_account(browser)
11
+ export_accounts(browser)
12
+ import_accounts(browser)
13
+ signout(browser)
14
+ end
15
+
16
+ def create_account_scenario_2(browser)
17
+ create_blank_new_account(browser)
18
+ reports(browser)
19
+ clone_account(browser)
20
+ pagination(browser)
21
+ verify_accounts(browser)
22
+ search_accounts(browser)
23
+ signout(browser)
24
+ end
25
+
26
+ def create_account(browser)
27
+ mark_testlevel('Create New Account', 1)
28
+ sleep_for(3)
29
+ click_text(browser, 'New Account')
30
+ wait_until_ready(browser, :name, /Account Name/)
31
+ set_textfield_by_name(browser, /Account Name/, "Test Account #1")
32
+ set_textfield_by_name(browser, /Phone/, "415-333-2311")
33
+
34
+ test_account_lookup(browser) #In Project Util
35
+ browser = attach_browser_by_url(browser, /ShowHomePage/)
36
+ select_option_by_name_and_option_text(browser, /Account Type/, "Analyst")
37
+ select_option_by_name_and_option_text(browser, /Industry/, "ASP")
38
+ set_textfield_by_name(browser, /Billing Street/, "201 Main St")
39
+ set_textfield_by_name(browser, /Billing City/, "San Francisco")
40
+ set_textfield_by_name(browser, /Billing State/, "CA")
41
+ set_textfield_by_name(browser, /Billing Code/, "94102")
42
+ set_textfield_by_name(browser, /Billing Country/, "USA")
43
+ #browser.cell(:text, 'Billing to Shipping').click
44
+ click(browser, :cell, :text, 'Billing to Shipping')
45
+ click_button_by_value(browser, 'Save')
46
+
47
+ wait_until_by_text(browser, 'Test Account #1')
48
+ validate_text(browser, "Test Account #1")
49
+ validate_text(browser, "random")
50
+ end
51
+
52
+ def test_account_lookup(browser)
53
+ mark_testlevel('Account Lookup', 1)
54
+ click(browser, :image, :title, 'Account Name Lookup')
55
+ sleep_for(5)
56
+ popup = attach_browser_by_url(browser, /Parent Account/)
57
+ set_textfield_by_name(popup, 'fldValue', 'test account #00')
58
+ click_button_by_value(popup, 'Go')
59
+ click(popup, :link, :text, 'Test Account #007')
60
+ # TODO: This next line is currently required for Firefox and Chrome to return to original browser window browser = attach_browser_by_url(browser, /ShowHomePage/)
61
+ browser = attach_browser_by_url(browser, /ShowHomePage/)
62
+ validate_textfield_value_by_name(browser, /Parent Account/, 'Test Account #007')
63
+ end
64
+
65
+
66
+ end
@@ -0,0 +1,70 @@
1
+ module CreateZohoAccount2
2
+
3
+ def run_test(browser)
4
+ create_account_scenario_1(browser)
5
+ create_account_scenario_2(browser)
6
+ end
7
+
8
+ def create_account_scenario_1(browser)
9
+ mark_testlevel("#{__method__.to_s.titleize}", 1)
10
+ create_account(browser)
11
+ create_blank_new_account(browser)
12
+ export_accounts(browser)
13
+ import_accounts(browser)
14
+ signout(browser)
15
+ end
16
+
17
+ def create_account_scenario_2(browser)
18
+ mark_testlevel("#{__method__.to_s.titleize}", 1)
19
+ create_blank_new_account(browser)
20
+ reports(browser)
21
+ clone_account(browser)
22
+ pagination(browser)
23
+ verify_accounts(browser)
24
+ search_accounts(browser)
25
+ signout(browser)
26
+ end
27
+
28
+ def create_account(browser)
29
+ mark_testlevel("#{__method__.to_s.titleize}", 1)
30
+ sleep_for(3)
31
+ click_text(browser, 'New Account')
32
+ wait_until_ready(browser, :name, /Account Name/)
33
+ set_textfield_by_name(browser, /Account Name/, @var['account_name'], "*** cza007 ***")
34
+ set_textfield_by_name(browser, /Phone/, @var['account_phone'], "*** cza007 ***")
35
+
36
+ test_account_lookup(browser)
37
+ browser = attach_browser_by_url(browser, /ShowHomePage/)
38
+
39
+ select_option_by_name_and_option_text(browser, /Account Type/, @var['account_type'], "*** cza003a ***")
40
+ select_option_by_name_and_option_text(browser, /Industry/, @var['account_industry'], "*** cza003b ***")
41
+ set_textfield_by_name(browser, /Billing Street/, @var['account_billing_street'], "*** cza003c ***")
42
+ set_textfield_by_name(browser, /Billing City/, @var['account_billing_city'], "*** cza003d ***")
43
+ set_textfield_by_name(browser, /Billing State/, @var['account_billing_state'], "*** cza003e ***")
44
+ set_textfield_by_name(browser, /Billing Code/, @var['account_billing_zipcode'], "*** cza003f ***")
45
+ set_textfield_by_name(browser, /Billing Country/, @var['account_country'], "*** cza003g ***")
46
+
47
+ #browser.cell(:text, 'Billing to Shipping').click
48
+ click(browser, :cell, :text, 'Billing to Shipping', "*** cza004 ***")
49
+ click_button_by_value(browser, 'Save')
50
+
51
+ wait_until_by_text(browser, @var['account_name'])
52
+ validate_text(browser, @var['account_name'], "*** cza005 ***")
53
+ validate_text(browser, "random", "*** cza006 ***")
54
+ end
55
+
56
+ def test_account_lookup(browser)
57
+ mark_testlevel("#{__method__.to_s.titleize}", 1)
58
+ click(browser, :image, :title, 'Account Name Lookup')
59
+ #sleep_for(5)
60
+ popup = attach_browser_by_url(browser, /Parent Account/, "*** cza001 ***")
61
+ if popup
62
+ set_textfield_by_name(popup, 'fldValue', @var['parent_account_pattern'])
63
+ click_button_by_value(popup, 'Go')
64
+ click(popup, :link, :text, @var['parent_account'])
65
+ # TODO: This next line is currently required for Firefox and Chrome to return to original browser window browser = attach_browser_by_url(browser, /ShowHomePage/)
66
+ validate_textfield_value_by_name(browser, /Parent Account/, @var['parent_account'], "*** cza002 ***")
67
+ end
68
+ end
69
+
70
+ end
data/demo.rb ADDED
@@ -0,0 +1,86 @@
1
+ module Demo
2
+ def run
3
+ browser = open_browser
4
+ login(browser)
5
+ test_zoho(browser)
6
+ end
7
+
8
+ def test_account_lookup(browser)
9
+ mark_testlevel('Account Lookup', 1)
10
+ browser.image(:title, 'Account Name Lookup').click
11
+ sleep_for(5)
12
+ popup = attach_browser_by_url(browser, /Parent/)
13
+ # TODO: This should be transparent:
14
+ if @browserAbbrev == "FF"
15
+ popup = browser
16
+ end
17
+ set_textfield_by_name(popup, 'fldValue', 'test')
18
+ click_button_by_value(popup, 'Go')
19
+ popup.link(:text, /Test Account/).click
20
+ #browser = attach_browser_by_url(browser, /ShowHomePage/)
21
+ #validate_textfield_value_by_name(browser, /Parent Account/, 'Test Account #007')
22
+ end
23
+
24
+ def login(browser)
25
+ mark_testlevel('Zoho Login', 2)
26
+ user = "joeklienwatir@gmail.com" #@zohologin.cell(2,2)
27
+ password = "watir001" #@zohologin.cell(2,3)
28
+ go_to_url(browser, "https://accounts.zoho.com/login?serviceurl=https://www.zoho.com/&hide_signup=true&css=https://www.zoho.com/css/login.css")
29
+ #browser.goto("https://accounts.zoho.com/login?serviceurl=https://www.zoho.com/&hide_signup=true&css=https://www.zoho.com/css/login.css")
30
+ set_textfield_by_name(browser, 'lid', user)
31
+ set_textfield_by_name(browser, 'pwd', password)
32
+ click_button_by_value(browser, 'Sign In')
33
+ go_to_url(browser, url = 'https://crm.zoho.com/crm/ShowHomePage.do')
34
+ validate_text(browser, 'Welcome joeklienwatir at Software')
35
+ #click_text(browser, 'Old Version')
36
+
37
+ end
38
+
39
+ def navigate_to_crm(browser)
40
+ mark_testlevel('Navigate to CRM', 1)
41
+ click_text(browser, 'CRM')
42
+ end
43
+
44
+ def test_zoho(browser)
45
+ #get_variables("#{@myRoot}/zoho_variables.xls")
46
+ navigate_to_crm(browser) #In Project Util
47
+ create_account(browser)
48
+ #create_blank_new_account(browser)
49
+ #export_accounts(browser)
50
+ #import_accounts(browser)
51
+ #signout(browser)
52
+ end
53
+
54
+ def create_account(browser)
55
+ mark_testlevel('Create New Account', 3)
56
+ sleep_for(3)
57
+ click_link(browser, 'Accounts')
58
+ sleep_for(3)
59
+ click_button_by_value(browser, 'New Account')
60
+ sleep_for(5)
61
+ # Watir::Waiter::wait_until { browser.text_field(:name, /Account Name/).exist? }
62
+ # Watir::Waiter::wait_until { browser.text_field(:name, /Account Name/).visible? }
63
+ set_textfield_by_name(browser, /Account Name/, "Test Account #1")
64
+ set_textfield_by_name(browser, /Phone/, "415-333-2311")
65
+
66
+ test_account_lookup(browser) #In Project Util
67
+ browser = attach_browser_by_url(browser, /ShowHomePage/)
68
+ select_option_by_name_and_option_text(browser, /Account Type/, "Analyst")
69
+ select_option_by_name_and_option_text(browser, /Industry/, "ASP")
70
+ set_textfield_by_name(browser, /Billing Street/, "201 Main St")
71
+ set_textfield_by_name(browser, /Billing City/, "San Francisco")
72
+ set_textfield_by_name(browser, /Billing State/, "CA")
73
+ set_textfield_by_name(browser, /Billing Code/, "94102")
74
+ set_textfield_by_name(browser, /Billing Country/, "USA")
75
+ #browser.cell(:text, 'Billing to Shipping').click
76
+ click_button_by_id(browser, 'copyAddress')
77
+ sleep_for(5)
78
+ click_button_by_value(browser, 'Save')
79
+
80
+ sleep_for(8)
81
+ #wait_until_by_text(browser, 'Test Account #1')
82
+ validate_text(browser, "Test Account #1")
83
+ validate_text(browser, "random")
84
+ end
85
+
86
+ end
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'rubygems/dependency_installer.rb'
2
+ using_windows = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
3
+ #using_jruby = defined?(JRUBY_VERSION)
4
+ using_osx = RUBY_PLATFORM =~ /darwin/
5
+ installer = Gem::DependencyInstaller.new
6
+ begin
7
+ puts "#{RUBY_PLATFORM}"
8
+ if using_windows
9
+ installer.install "watirloo", ">=0"
10
+ installer.install "win32-process", ">=0"
11
+ installer.install "win32-screenshot", ">=0"
12
+ installer.install "commonwatir", "=1.8.1"
13
+ installer.install "watir", "=1.8.1"
14
+ installer.install "firewatir", "=1.8.1"
15
+ elsif using_osx
16
+ installer.install "rb_appscript", ">=0"
17
+ installer.install "safariwatir", ">=0"
18
+ end
19
+
20
+ rescue
21
+ puts "#{$!}"
22
+ exit(1)
23
+ end
24
+
25
+ f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
26
+ f.write("task :default\n")
27
+ f.close
data/google_search1.rb ADDED
@@ -0,0 +1,16 @@
1
+ module GoogleSearch1
2
+
3
+ def run
4
+ mark_testlevel("Awetestlib example: Google Search 1", 1)
5
+ browser = open_browser
6
+ go_to_url(browser, 'www.google.com')
7
+ sleep_for(3)
8
+ click_text(browser, 'News')
9
+ set_textfield_by_id(browser, 'gbqfq', '3qilabs')
10
+ #click(browser, :button, :id, 'gbqfb')
11
+ validate_text(browser, '3qilabs')
12
+ validate_text(browser, 'Stories')
13
+ logout(browser)
14
+ end
15
+
16
+ end
data/google_search2.rb ADDED
@@ -0,0 +1,19 @@
1
+ module GoogleSearch2
2
+
3
+ def run
4
+ mark_testlevel("Awetestlib example: Google Search 2", 9)
5
+ browser = open_browser
6
+ go_to_url(browser, 'www.google.com')
7
+ sleep_for(3)
8
+ run_test(browser)
9
+ end
10
+
11
+ def run_test(browser)
12
+ mark_testlevel("Search for 3qilabs in News", 8)
13
+ click_text(browser, 'News')
14
+ set_textfield_by_id(browser, 'gbqfq', '3qilabs')
15
+ validate_text(browser, '3qilabs', '*** gs2 001 ***')
16
+ validate_text(browser, 'Stories', '*** gs2 002 ***')
17
+ end
18
+
19
+ end
data/lib/awetestlib.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'yaml'
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
+ BROWSER_MAP = {
9
+ 'FF' => 'Firefox',
10
+ 'IE' => 'Internet Explorer',
11
+ 'S' => 'Safari',
12
+ 'MS' => 'Mobile Safari',
13
+ 'C' => 'Chrome'
14
+ }
15
+
16
+ BROWSER_ALTERNATES = {
17
+ 'OSX' => { 'IE' => 'S' },
18
+ 'Windows' => { 'S' => 'IE' }
19
+ }
20
+
21
+ if USING_WINDOWS
22
+ #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
23
+ require 'win32/screenshot'
24
+ end
25
+ #require 'active_support/inflector'
26
+ #require 'active_support/core_ext/object'
27
+ #require 'active_support/core_ext/hash'
28
+
29
+ require 'andand'
30
+ require 'regression/runner'
31
+
32
+
33
+ if USING_OSX
34
+ require 'appscript'
35
+ end
36
+
37
+ require 'roo'
38
+
39
+ end
@@ -0,0 +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.