awetestlib 0.1.20 → 0.1.22

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.
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency('pry')
33
33
  s.add_dependency('rdoc', '~> 3.11')
34
34
  s.add_dependency('cucumber')
35
-
35
+ s.add_dependency('calabash-android', '0.3.2')
36
36
  s.require_paths = ["lib"]
37
37
  s.files = `git ls-files`.split("\n")
38
38
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
data/bin/awetestlib CHANGED
@@ -22,6 +22,12 @@ elsif cmd == 'cucumber_setup'
22
22
  elsif cmd == 'mobile_app_setup'
23
23
  require File.join(File.dirname(__FILE__),"awetestlib-mobile-app-setup")
24
24
  awetestlib_mobile_app_setup
25
+ elsif cmd == 'android_setup'
26
+ require File.join(File.dirname(__FILE__),"awetestlib-android-setup")
27
+ awetestlib_android_setup
28
+ elsif cmd == 'driver_setup'
29
+ require File.join(File.dirname(__FILE__),"awetestlib-driver-setup")
30
+ awetestlib_driver_setup
25
31
  else
26
32
 
27
33
  require 'optparse'
@@ -0,0 +1,27 @@
1
+ def awetestlib_android_setup
2
+ if ARGV[1].nil?
3
+ @proj_dir = "sample_android"
4
+ else
5
+ @proj_dir = ARGV[1]
6
+ end
7
+
8
+ @cucumber_dir = File.join(FileUtils.pwd, @proj_dir)
9
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_android')
10
+
11
+ if File.exists?(@cucumber_dir)
12
+ puts "Android project directory already exists."
13
+ exit 1
14
+ end
15
+
16
+ msg("Question") do
17
+ puts "I'm about to create an android project named #{@proj_dir} in this directory"
18
+ puts "Please hit return to confirm that's what you want."
19
+ puts "NOTE: You may need to run this command as an administrator."
20
+ end
21
+ exit 2 unless STDIN.gets.chomp == ''
22
+ FileUtils.cp_r(@source_dir, @cucumber_dir)
23
+ msg("Info") do
24
+ puts "Configuring files and settings"
25
+ end
26
+
27
+ end
@@ -6,7 +6,7 @@ def awetestlib_cucumber_setup
6
6
  end
7
7
 
8
8
  @cucumber_dir = File.join(FileUtils.pwd, @proj_dir)
9
- @source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', @proj_dir)
9
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_cucumber')
10
10
 
11
11
  if File.exists?(@cucumber_dir)
12
12
  puts "Cucumber project directory already exists."
@@ -0,0 +1,21 @@
1
+ require 'pry'
2
+ def awetestlib_driver_setup
3
+ current_dir = Dir.pwd
4
+ drivers_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "drivers"))
5
+ # binding.pry
6
+ ie_driver = File.join(drivers_dir,"IEDriverServer.exe")
7
+ chrome_driver = File.join(drivers_dir,"chromedriver.exe")
8
+ msg("Question") do
9
+ puts "I'm about to put the chromedriver and IEDriverServer in this directory"
10
+ puts "If it already exists, we will overwrite it"
11
+ puts "Please hit return to confirm that's what you want."
12
+ puts "NOTE: You may need to run this command as an administrator."
13
+ end
14
+ exit 2 unless STDIN.gets.chomp == ''
15
+ FileUtils.cp(ie_driver, current_dir)
16
+ FileUtils.cp(chrome_driver,current_dir)
17
+ msg("Info") do
18
+ puts "Successfully copied chromedriver and IEDriverServer to #{current_dir}"
19
+ end
20
+
21
+ end
Binary file
Binary file
@@ -397,7 +397,7 @@ module Awetestlib
397
397
  # @param [String] hwnd The value for the window handle for the browser process.
398
398
  # @param [Fixnum] lnbr Line number in calling script.
399
399
  # @param [Watir::Browser] browser A reference to the browser window or container element to be closed.
400
- def kill_browser(hwnd, lnbr, browser = nil)
400
+ def kill_browser(hwnd, lnbr, browser = nil, doflag = false)
401
401
  # TODO Firefox
402
402
  logit = false
403
403
  if @browserAbbrev == 'FF'
@@ -763,9 +763,9 @@ module Awetestlib
763
763
  msg << " '#{desc}' " if desc.length > 0
764
764
  case element
765
765
  when :radio
766
- browser.radio(how, what, value).set
766
+ browser.radio(how, what).set
767
767
  when :checkbox
768
- browser.checkbox(how, what, value).set
768
+ browser.checkbox(how, what).set
769
769
  else
770
770
  failed_to_log("#{__method__}: #{element} not supported")
771
771
  end
@@ -1034,9 +1034,9 @@ module Awetestlib
1034
1034
  msg << " '#{desc}' " if desc.length > 0
1035
1035
  case element
1036
1036
  when :radio
1037
- browser.radio(how, what, value).clear
1037
+ browser.radio(how, what).clear
1038
1038
  when :checkbox
1039
- browser.checkbox(how, what, value).clear
1039
+ browser.checkbox(how, what).clear
1040
1040
  when :text_field
1041
1041
  browser.text_field(how, what).set('')
1042
1042
  else
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Awetestlib
2
- VERSION = "0.1.20"
3
- VERSION_DATE = "2012-10-02"
2
+ VERSION = "0.1.22"
3
+ VERSION_DATE = "2012-11-13"
4
4
  end
@@ -0,0 +1,6 @@
1
+ Feature: I want to test my android setup
2
+
3
+ Scenario: I want to launch my app and test a few interactions
4
+ Given I see "Rotating at anchor"
5
+ Then I long press "Rotating at anchor"
6
+ Then I enter "2" into "Enter Range"
@@ -0,0 +1,2 @@
1
+ require 'calabash-android/cucumber'
2
+ require 'calabash-android/calabash_steps'
@@ -0,0 +1,36 @@
1
+ require 'calabash-android/management/app_installation'
2
+
3
+ AfterConfiguration do |config|
4
+ FeatureNameMemory.feature_name = nil
5
+ end
6
+
7
+ Before do |scenario|
8
+ @scenario_is_outline = (scenario.class == Cucumber::Ast::OutlineTable::ExampleRow)
9
+ if @scenario_is_outline
10
+ scenario = scenario.scenario_outline
11
+ end
12
+
13
+ feature_name = scenario.feature.title
14
+ if FeatureNameMemory.feature_name != feature_name \
15
+ or ENV["RESET_BETWEEN_SCENARIOS"] == "1"
16
+ if ENV["RESET_BETWEEN_SCENARIOS"] == "1"
17
+ log "New scenario - reinstalling apps"
18
+ else
19
+ log "First scenario in feature - reinstalling apps"
20
+ end
21
+
22
+ uninstall_apps
23
+ install_app(ENV["TEST_APP_PATH"])
24
+ install_app(ENV["APP_PATH"])
25
+ FeatureNameMemory.feature_name = feature_name
26
+ FeatureNameMemory.invocation = 1
27
+ else
28
+ FeatureNameMemory.invocation += 1
29
+ end
30
+ end
31
+
32
+ FeatureNameMemory = Class.new
33
+ class << FeatureNameMemory
34
+ @feature_name = nil
35
+ attr_accessor :feature_name, :invocation
36
+ end
@@ -0,0 +1,15 @@
1
+ require 'calabash-android/management/adb'
2
+ require 'calabash-android/operations'
3
+ include Calabash::Android::Operations
4
+
5
+ AfterConfiguration do |config|
6
+ wake_up unless config.dry_run?
7
+ end
8
+
9
+ Before do |scenario|
10
+ start_test_server_in_background
11
+ end
12
+
13
+ After do
14
+ shutdown_test_server
15
+ end
@@ -0,0 +1 @@
1
+ require 'calabash-android/cucumber'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awetestlib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 20
10
- version: 0.1.20
9
+ - 22
10
+ version: 0.1.22
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Woo
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-10-02 00:00:00 Z
19
+ date: 2012-11-13 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: watir-webdriver
@@ -245,7 +245,9 @@ email: patrick@3qilabs.com
245
245
  executables:
246
246
  - AutoItX3.dll
247
247
  - awetestlib
248
+ - awetestlib-android-setup.rb
248
249
  - awetestlib-cucumber-setup.rb
250
+ - awetestlib-driver-setup.rb
249
251
  - awetestlib-helpers.rb
250
252
  - awetestlib-mobile-app-setup.rb
251
253
  - awetestlib-netbeans-setup.rb
@@ -266,12 +268,16 @@ files:
266
268
  - awetestlib_osx.gemspec
267
269
  - bin/AutoItX3.dll
268
270
  - bin/awetestlib
271
+ - bin/awetestlib-android-setup.rb
269
272
  - bin/awetestlib-cucumber-setup.rb
273
+ - bin/awetestlib-driver-setup.rb
270
274
  - bin/awetestlib-helpers.rb
271
275
  - bin/awetestlib-mobile-app-setup.rb
272
276
  - bin/awetestlib-netbeans-setup.rb
273
277
  - bin/awetestlib-regression-setup.rb
274
278
  - bin/awetestlib-rubymine-setup.rb
279
+ - drivers/IEDriverServer.exe
280
+ - drivers/chromedriver.exe
275
281
  - ext/Rakefile
276
282
  - ext/mkrf_conf.rb
277
283
  - images/logo.png
@@ -298,6 +304,13 @@ files:
298
304
  - netbeans_setup.md
299
305
  - rdoc_test.bat
300
306
  - rubymine_setup.md
307
+ - setup_samples/sample_android/features/dk.mejer.hansen.control.FlyingColorsPlayerAidActivity.apk
308
+ - setup_samples/sample_android/features/sample_android.feature
309
+ - setup_samples/sample_android/features/step_definitions/calabash_steps.rb
310
+ - setup_samples/sample_android/features/support/app_installation_hooks.rb
311
+ - setup_samples/sample_android/features/support/app_life_cycle_hooks.rb
312
+ - setup_samples/sample_android/features/support/env.rb
313
+ - setup_samples/sample_android/features/test_servers/8ba795a0288381ae346b67867b586881_0.3.2.apk
301
314
  - setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
302
315
  - setup_samples/sample_cucumber/features/support/env.rb
303
316
  - setup_samples/sample_cucumber/features/yahoo_mail.feature