selendroid 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 64ef6efba326ef98074a365cc626f3e924098c05
4
+ data.tar.gz: 6e70dd96cd6878c7bc249bfff945f929ca07b1ec
5
+ SHA512:
6
+ metadata.gz: bde109b64270b8ef0b983ea18c7a0c6a6f28accf16384bbe1684e0f05f67625bc15966eb0ffa9ddbde7bc93242849eb668c63868d7a3b69f17f13ea2a0dd1427
7
+ data.tar.gz: 10105db35f829b4208e3936b1bf015d1c4cbd921073fde7a644f7b27d883627509646a52feb488bf6571a325c870757cd75cdc5d53b5caa5af042adcb0e6e89c
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .irb-history
1
2
  *.gem
2
3
  *.rbc
3
4
  *.DS_Store
data/bin/selendroid CHANGED
@@ -19,6 +19,9 @@ def print_comamndline_help
19
19
  Prints more detailed help information.
20
20
  build <apk>
21
21
  Builds the selendroid-server for the given apk.
22
+ console
23
+ Starts the selendroid-server on the device (apps must be already installed) and opens an irb console with an active WebDriver session.
24
+ The selendroid-inspector web app is running on: http://localhost:8080/inspector
22
25
  To find help, please visit the official selendroid wiki: http://goo.gl/z30pj
23
26
  EOF
24
27
  end
@@ -36,6 +39,8 @@ def raise_if_android_home_not_set
36
39
  raise "Please set the ANDROID_HOME environment variable" unless ENV["ANDROID_HOME"]
37
40
  end
38
41
 
42
+ require File.join(File.dirname(__FILE__), "selendroid-console")
43
+
39
44
  if (ARGV.length == 0)
40
45
  print_comamndline_help
41
46
  exit 0
@@ -44,6 +49,9 @@ cmd = ARGV.shift
44
49
  if cmd == 'help'
45
50
  print_comamndline_help
46
51
  exit 0
52
+ elsif cmd == 'console'
53
+ selendroid_console
54
+ exit 0
47
55
  elsif cmd == 'build'
48
56
  raise_if_android_home_not_set
49
57
  puts "Please specify the app you want to build a selendroid-server for" if (ARGV.empty? or not is_apk_file?(ARGV.first))
@@ -0,0 +1,17 @@
1
+ require 'selendroid/selendroid_driver'
2
+
3
+ def selendroid_console
4
+ unless ENV["SELENDROID_SERVER_PORT"]
5
+ ENV["SELENDROID_SERVER_PORT"] = "8080"
6
+ end
7
+
8
+ unless ENV["MAIN_ACTIVITY"]
9
+ ENV["MAIN_ACTIVITY"] = "org.openqa.selendroid.testapp.HomeScreenActivity"
10
+ end
11
+ ENV["IRBRC"] = File.join(File.dirname(__FILE__), '..', 'irbrc')
12
+
13
+ system "#{RbConfig.ruby} -S irb"
14
+ end
15
+
16
+
17
+
data/irbrc ADDED
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require 'irb/completion'
3
+ require 'irb/ext/save-history'
4
+ require 'colorize'
5
+ require 'awesome_print'
6
+
7
+ AwesomePrint.irb!
8
+
9
+ ARGV.concat [ "--readline",
10
+ "--prompt-mode",
11
+ "simple" ]
12
+
13
+ # 50 entries in the list
14
+ IRB.conf[:SAVE_HISTORY] = 50
15
+
16
+ # Store results in home directory with specified file name
17
+ IRB.conf[:HISTORY_FILE] = ".irb-history"
18
+
19
+ require 'selendroid/selendroid_driver'
20
+ start_selendroid_server
21
+ start_selendroid_client
22
+ puts "#################### Selendroid console ###################".green
23
+ puts "Selendroid inspector: http://localhost:8090/inspector".green
24
+ puts "Client-driver is available under: driver".green
25
+ puts "For help type: helpme".green
@@ -0,0 +1,74 @@
1
+ require 'selenium-webdriver'
2
+ require 'json'
3
+ require 'colorize'
4
+
5
+ def start_selendroid_client
6
+ caps = Selenium::WebDriver::Remote::Capabilities.android
7
+ caps.version = "5"
8
+ caps.platform = :linux
9
+ caps.proxy = nil
10
+ caps[:aut] = "selendroid-test-app"
11
+ caps[:locale]="de_DE"
12
+ caps[:deviceName]="emulator"
13
+ caps[:deviceId]="emulator-5554"
14
+ caps[:maxInstances]="1"
15
+ caps[:browserName]="selendroid"
16
+ caps[:sdkVersion]="4.1"
17
+ end_point = "http://localhost:#{ENV["SELENDROID_SERVER_PORT"]}/wd/hub"
18
+ #log "using url: #{end_point}"
19
+
20
+ $selendroid_driver = Selenium::WebDriver.for(
21
+ :remote,
22
+ :url => end_point,
23
+ :desired_capabilities => caps)
24
+
25
+ $selendroid_driver
26
+ end
27
+
28
+ def driver
29
+ $selendroid_driver
30
+ end
31
+
32
+ def quit
33
+ quit_driver
34
+ exit
35
+ end
36
+
37
+ def quit_driver
38
+ log "Quiting Selendroid client".green
39
+ begin; $selendroid_driver.quit unless $selendroid_driver.nil?; rescue; end
40
+ end
41
+
42
+ def get_window_source
43
+ JSON.pretty_generate( $selendroid_driver.page_source)
44
+ end
45
+
46
+ def helpme
47
+ puts "Client-driver is available under: driver".green
48
+ puts "Official Webdriver Ruby bindins wiki: http://goo.gl/nJ9CJ".green
49
+
50
+ end
51
+
52
+ def start_selendroid_server
53
+ selendroid_server_start_cmd = "#{adb_command} shell am instrument -e main_activity '#{ENV["MAIN_ACTIVITY"]}' org.openqa.selendroid/org.openqa.selendroid.ServerInstrumentation"
54
+ `#{selendroid_server_start_cmd}`
55
+
56
+ forward_cmd = "#{adb_command} forward tcp:#{ENV["SELENDROID_SERVER_PORT"]} tcp:8080"
57
+ `#{forward_cmd}`
58
+ end
59
+
60
+ def log(message)
61
+ $stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}"
62
+ end
63
+
64
+ def adb_command
65
+ if is_windows?
66
+ %Q("#{ENV["ANDROID_HOME"]}\\platform-tools\\adb.exe")
67
+ else
68
+ %Q("#{ENV["ANDROID_HOME"]}/platform-tools/adb")
69
+ end
70
+ end
71
+
72
+ def is_windows?
73
+ (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
74
+ end
@@ -1,3 +1,3 @@
1
1
  module Selendroid
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/selendroid.gemspec CHANGED
@@ -16,4 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = "selendroid"
17
17
  gem.require_paths = ["lib"]
18
18
  gem.add_dependency( "rubyzip")
19
+ gem.add_dependency( "colorize")
20
+ gem.add_dependency( "awesome_print")
21
+ gem.add_dependency( "selenium-webdriver")
22
+ gem.add_dependency( "json")
19
23
  end
metadata CHANGED
@@ -1,85 +1,130 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: selendroid
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 2
9
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Dominik Dary
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2013-02-21 00:00:00 +01:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: rubyzip
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
22
21
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
30
34
  type: :runtime
31
- version_requirements: *id001
32
- description: "\"Selenium for Android Apps\" (Test automate native or hybrid Android apps with Selendroid.)"
33
- email:
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: awesome_print
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: selenium-webdriver
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: '"Selenium for Android Apps" (Test automate native or hybrid Android
84
+ apps with Selendroid.)'
85
+ email:
34
86
  - ddary@acm.org
35
- executables:
87
+ executables:
36
88
  - selendroid
37
89
  extensions: []
38
-
39
90
  extra_rdoc_files: []
40
-
41
- files:
91
+ files:
42
92
  - .gitignore
43
93
  - Gemfile
44
94
  - LICENSE.txt
45
95
  - README.md
46
96
  - Rakefile
47
97
  - bin/selendroid
98
+ - bin/selendroid-console.rb
99
+ - irbrc
48
100
  - lib/selendroid.rb
49
101
  - lib/selendroid/selendroid_builder.rb
102
+ - lib/selendroid/selendroid_driver.rb
50
103
  - lib/selendroid/version.rb
51
104
  - selendroid-prebuild/AndroidManifest.xml
52
105
  - selendroid-prebuild/selendroid-server.apk
53
106
  - selendroid.gemspec
54
- has_rdoc: true
55
107
  homepage: http://dominikdary.github.com/selendroid/
56
108
  licenses: []
57
-
109
+ metadata: {}
58
110
  post_install_message:
59
111
  rdoc_options: []
60
-
61
- require_paths:
112
+ require_paths:
62
113
  - lib
63
- required_ruby_version: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
- version: "0"
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
77
124
  requirements: []
78
-
79
125
  rubyforge_project:
80
- rubygems_version: 1.3.6
126
+ rubygems_version: 2.0.0
81
127
  signing_key:
82
- specification_version: 3
128
+ specification_version: 4
83
129
  summary: Utility so simplify usage of the selendroid-server.
84
130
  test_files: []
85
-