selendroid 0.3.2 → 0.4.0
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.
- checksums.yaml +4 -4
- data/README.md +5 -42
- data/bin/selendroid +8 -34
- data/lib/selendroid/commands.rb +0 -15
- data/lib/selendroid/selendroid_builder.rb +1 -90
- data/lib/selendroid/selendroid_driver.rb +2 -1
- data/lib/selendroid/version.rb +1 -1
- data/selendroid.gemspec +3 -4
- metadata +4 -22
- data/lib/troido/README.md +0 -6
- data/lib/troido/re-sign.jar +0 -0
- data/selendroid-prebuild/AndroidManifest.xml +0 -23
- data/selendroid-prebuild/selendroid-server.apk +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcfead51e966b8a67a0ddf17b987739cae0ea3dc
|
4
|
+
data.tar.gz: e5ae1d7a18516794ae627bc31a39c5527652d112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df3256fcae516f7f537d49d8cfe4b17740721366a6b9273c5fcd68fb9d81263d271142191602b6e86405bef3e3b24dd3132eb62a88fa8310f3d1ddb5710e07ec
|
7
|
+
data.tar.gz: 2f4e7435fa2ba5a361b32f52596101797ef5849e7649ce0d923a2b01d3ba0efe136e302e478e5d760cd9239f7a8bdf03520d93b96ae52fe18e3f9712598421e8
|
data/README.md
CHANGED
@@ -1,52 +1,15 @@
|
|
1
1
|
Selendroid
|
2
2
|
==========
|
3
3
|
|
4
|
-
|
4
|
+
Selendroid is a test automation framework which drives of the UI of Android native and hybrid applications (apps).
|
5
|
+
Tests are written using the Selenium 2 client API and for testing the application under test must not be modified.
|
5
6
|
|
6
|
-
Selendroid
|
7
|
+
Selendroid can be used on emulators and real devices and can be integrated as a node into the Selenium Grid
|
8
|
+
for scaling and parallel testing.
|
7
9
|
|
8
|
-
Selendroid can be used on emulators and real devices and can be integrated as a node into the Selenium Grid for scaling and parallel testing.
|
9
|
-
|
10
|
-
|
11
|
-
Latest News:
|
12
|
-
------------
|
13
|
-
|
14
|
-
* Selendroid Version 0.3 is released ([List of Features](https://github.com/DominikDary/selendroid/blob/master/changelog.md))
|
15
|
-
|
16
|
-
Getting started
|
17
|
-
---------------
|
18
|
-
|
19
|
-
Selendroid is based on the Android instrumentation framework, so therefor only testing one specific app is supported.
|
20
|
-
Selendroid-server in combination with the application under test (aut) must be installed on the device in order to be able to run automated end-to-end tests.
|
21
|
-
|
22
|
-
To write and run tests with selendroid, first a customized selendroid-server for your aut must be created. To simplify this process I have created a Ruby gem:
|
23
|
-
|
24
|
-
# Please note that ruby minimum version 1.9.2 is required
|
25
|
-
sudo gem install selendroid
|
26
|
-
selendroid build-and-start pathToYour.apk
|
27
|
-
|
28
|
-
Run your tests
|
29
|
-
--------------
|
30
|
-
|
31
|
-
A sample test looks like:
|
32
|
-
|
33
|
-
```java
|
34
|
-
driver = new AndroidDriver(new URL("http://localhost:8080/wd/hub"), getDefaultCapabilities());
|
35
|
-
driver.findElement(By.id("startUserRegistration")).click();
|
36
|
-
|
37
|
-
WebDriverWait wait = new WebDriverWait(driver, 5);
|
38
|
-
WebElement inputUsername =
|
39
|
-
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("inputUsername")));
|
40
|
-
inputUsername.sendKeys(user.getUsername());
|
41
|
-
Assert.assertEquals(nameInput.getText(), "Mr. Burns");
|
42
|
-
nameInput.clear();
|
43
|
-
nameInput.sendKeys(user.getName());
|
44
|
-
takeScreenShot("User data entered.");
|
45
|
-
driver.findElement(By.id("btnRegisterUser")).click();
|
46
|
-
```
|
47
10
|
|
48
11
|
You want more details?
|
49
12
|
----------------------
|
50
13
|
|
51
|
-
Check out our [
|
14
|
+
Check out our [documentation](http://selendroid.io).
|
52
15
|
|
data/bin/selendroid
CHANGED
@@ -18,23 +18,13 @@ def print_comamndline_help
|
|
18
18
|
<command-name> can be one of
|
19
19
|
help
|
20
20
|
Prints more detailed help information.
|
21
|
-
build <apk>
|
22
|
-
Builds the selendroid-server for the given apk.
|
23
|
-
build-and-start <apk>
|
24
|
-
Builds the selendroid-server for the given apk and starts the
|
25
|
-
selendroid server. The app will be resigned with the debug
|
26
|
-
certificate and will be installed on the first available An-
|
27
|
-
droid device.
|
28
|
-
start <apk>
|
29
|
-
Starts the selendroid server on the first available Android device.
|
30
|
-
Commamd expects that the apps are already installed on the device.
|
31
21
|
shell <apk>
|
32
22
|
Starts the selendroid-server on the device (apps must be already in-
|
33
23
|
stalled) and opens an irb shell with an active WebDriver session.
|
34
24
|
version
|
35
25
|
prints the gem version
|
36
|
-
To find help, please visit the official selendroid
|
37
|
-
http://
|
26
|
+
To find help, please visit the official selendroid documentation:
|
27
|
+
http://selendroid.io
|
38
28
|
EOF
|
39
29
|
end
|
40
30
|
|
@@ -75,32 +65,16 @@ elsif cmd == 'shell'
|
|
75
65
|
|
76
66
|
exit 0
|
77
67
|
elsif cmd == 'build'
|
78
|
-
|
79
|
-
|
80
|
-
while not ARGV.empty? and is_apk_file?(ARGV.first)
|
81
|
-
rebuild_selendroid(relative_to_full_path(ARGV.shift))
|
82
|
-
end
|
68
|
+
puts "This command name is not any longer supported. Please use the selendroid-standalone.jar.
|
69
|
+
More details can be found here: http://selendroid.io/setup.html"
|
83
70
|
exit 0
|
84
71
|
elsif cmd=='build-and-start'
|
85
|
-
|
86
|
-
|
87
|
-
while not ARGV.empty? and is_apk_file?(ARGV.first)
|
88
|
-
app_apk_under_test = relative_to_full_path(ARGV.shift)
|
89
|
-
prepare_device(app_apk_under_test)
|
90
|
-
main_activity = get_app_main_activity(app_apk_under_test)
|
91
|
-
start_selendroid_server(main_activity)
|
92
|
-
wait_for_selendroid_server
|
93
|
-
end
|
72
|
+
puts "This command name is not any longer supported. Please use the selendroid-standalone.jar.
|
73
|
+
More details can be found here: http://selendroid.io/setup.html"
|
94
74
|
exit 0
|
95
75
|
elsif cmd=='start'
|
96
|
-
|
97
|
-
|
98
|
-
while not ARGV.empty? and is_apk_file?(ARGV.first)
|
99
|
-
app_apk_under_test = relative_to_full_path(ARGV.shift)
|
100
|
-
main_activity = get_app_main_activity(app_apk_under_test)
|
101
|
-
start_selendroid_server(main_activity)
|
102
|
-
wait_for_selendroid_server
|
103
|
-
end
|
76
|
+
puts "This command name is not any longer supported. Please use the selendroid-standalone.jar.
|
77
|
+
More details can be found here: http://selendroid.io/setup.html"
|
104
78
|
exit 0
|
105
79
|
elsif cmd == 'version'
|
106
80
|
puts Selendroid::VERSION
|
data/lib/selendroid/commands.rb
CHANGED
@@ -37,18 +37,3 @@ def java_command
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def jarsigner_command
|
41
|
-
if is_windows?
|
42
|
-
"\"#{ENV["JAVA_HOME"]}/bin/jarsigner.exe\""
|
43
|
-
else
|
44
|
-
"\"#{ENV["JAVA_HOME"]}/bin/jarsigner\""
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def keytool_command
|
49
|
-
if is_windows?
|
50
|
-
"\"#{ENV["JAVA_HOME"]}/bin/keytool.exe\""
|
51
|
-
else
|
52
|
-
"\"#{ENV["JAVA_HOME"]}/bin/keytool\""
|
53
|
-
end
|
54
|
-
end
|
@@ -4,46 +4,6 @@ require 'zip/zip'
|
|
4
4
|
require 'tempfile'
|
5
5
|
require 'colorize'
|
6
6
|
|
7
|
-
def rebuild_selendroid(app)
|
8
|
-
aut_base_package = get_app_base_package(app)
|
9
|
-
log "Building selendroid-server for package #{aut_base_package}".green
|
10
|
-
|
11
|
-
test_server_file_name = selendroid_server_path(aut_base_package)
|
12
|
-
FileUtils.mkdir_p File.dirname(test_server_file_name) unless File.exist? File.dirname(test_server_file_name)
|
13
|
-
|
14
|
-
unsigned_test_apk = File.join(File.dirname(__FILE__), '..','..', 'selendroid-prebuild/selendroid-server.apk')
|
15
|
-
android_platform = Dir["#{ENV["ANDROID_HOME"].gsub("\\", "/")}/platforms/android-*"].last
|
16
|
-
raise "No Android SDK found in #{ENV["ANDROID_HOME"].gsub("\\", "/")}/platforms/" unless android_platform
|
17
|
-
Dir.mktmpdir do |workspace_dir|
|
18
|
-
Dir.chdir(workspace_dir) do
|
19
|
-
FileUtils.cp(unsigned_test_apk, "TestServer.apk")
|
20
|
-
FileUtils.cp(File.join(File.dirname(__FILE__), '..','..', 'selendroid-prebuild/AndroidManifest.xml'), "AndroidManifest.xml")
|
21
|
-
|
22
|
-
unless system %Q{"#{RbConfig.ruby}" -pi.bak -e "gsub(/org.openqa.selendroid.testapp/, '#{aut_base_package}')" AndroidManifest.xml}
|
23
|
-
raise "Could not replace package name in manifest"
|
24
|
-
end
|
25
|
-
|
26
|
-
unless system %Q{#{aapt_command} package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
|
27
|
-
raise "Could not create dummy.apk"
|
28
|
-
end
|
29
|
-
|
30
|
-
Zip::ZipFile.new("dummy.apk").extract("AndroidManifest.xml","customAndroidManifest.xml")
|
31
|
-
Zip::ZipFile.open("TestServer.apk") do |zip_file|
|
32
|
-
zip_file.add("AndroidManifest.xml", "customAndroidManifest.xml")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
sign_apk("#{workspace_dir}/TestServer.apk", test_server_file_name)
|
36
|
-
begin
|
37
|
-
|
38
|
-
rescue Exception => e
|
39
|
-
puts e
|
40
|
-
raise "Could not sign test server"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
log "Done signing the test server. Moved it to #{test_server_file_name}".green
|
44
|
-
test_server_file_name
|
45
|
-
end
|
46
|
-
|
47
7
|
def get_app_base_package(app)
|
48
8
|
default_cmd = "#{aapt_command} dump badging #{app} "
|
49
9
|
windows_cmd = "#{default_cmd} | findSTR package "
|
@@ -102,55 +62,6 @@ def get_first_android_device
|
|
102
62
|
device.tr("\n","")
|
103
63
|
end
|
104
64
|
|
105
|
-
def prepare_device(app)
|
106
|
-
device_serial = get_first_android_device
|
107
|
-
log "Using first Android device with serial: #{device_serial}".green
|
108
|
-
if is_app_installed_on_device("org.openqa.selndroid",device_serial)
|
109
|
-
uninstall_cmd = "#{adb_command} -s #{device_serial} uninstall org.openqa.selendroid"
|
110
|
-
%x[ #{uninstall_cmd}]
|
111
|
-
end
|
112
|
-
selendroid_file_name = rebuild_selendroid(app)
|
113
|
-
install_cmd = "#{adb_command} -s #{device_serial} install #{File.expand_path(selendroid_file_name)}"
|
114
|
-
%x[ #{install_cmd}]
|
115
|
-
log "The selendroid server has been rebuild and installed on the device.".green
|
116
|
-
|
117
|
-
aut_base_package = get_app_base_package(app)
|
118
|
-
aut_main_activity = get_app_main_activity(app)
|
119
|
-
|
120
|
-
if is_app_installed_on_device(aut_base_package,device_serial)
|
121
|
-
uninstall_cmd = "#{adb_command} -s #{device_serial} uninstall #{aut_base_package}"
|
122
|
-
%x[ #{uninstall_cmd}]
|
123
|
-
end
|
124
|
-
resigned_apk = "#{app.chomp('.apk')}-debug.apk"
|
125
|
-
resign_apk(app,resigned_apk)
|
126
|
-
install_cmd = "#{adb_command} -s #{device_serial} install #{resigned_apk}"
|
127
|
-
%x[ #{install_cmd}]
|
128
|
-
log "The app has been resigned #{File.basename(resigned_apk)} and installed on the device.".green
|
129
|
-
end
|
130
|
-
|
131
65
|
def is_windows?
|
132
66
|
(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
|
133
|
-
end
|
134
|
-
|
135
|
-
def resign_apk(app_path, dest_path)
|
136
|
-
troido_jar = File.join(File.dirname(__FILE__), '..','..', 'lib/troido/re-sign.jar')
|
137
|
-
cmd = "#{java_command} -cp #{troido_jar} de.troido.resigner.main.Main #{File.expand_path(app_path)} #{File.expand_path(dest_path)}"
|
138
|
-
resign_output= %x[ #{cmd}]
|
139
|
-
end
|
140
|
-
|
141
|
-
def sign_apk(app_path, dest_path)
|
142
|
-
if !File.file?( Dir.home+"/.android/debug.keystore")
|
143
|
-
log "keystore missing - creating one"
|
144
|
-
cmd= "#{keytool_command} -genkey -v -keystore #{Dir.home}/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname \"CN=Android Debug,O=Android,C=US\" -storetype JKS -sigalg MD5withRSA -keyalg RSA"
|
145
|
-
system(cmd)
|
146
|
-
end
|
147
|
-
|
148
|
-
cmd = "#{jarsigner_command} -sigalg MD5withRSA -digestalg SHA1 -signedjar #{dest_path} -storepass android -keystore #{Dir.home}/.android/debug.keystore #{app_path} androiddebugkey"
|
149
|
-
unless system(cmd)
|
150
|
-
raise "Could not sign app (#{app_path}"
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def selendroid_server_path(base_package)
|
155
|
-
"selendroid-server-#{Selendroid::VERSION}.apk"
|
156
|
-
end
|
67
|
+
end
|
@@ -77,7 +77,7 @@ def start_selendroid_server(activity)
|
|
77
77
|
main_activity =activity
|
78
78
|
end
|
79
79
|
log "Starting selendroid-server with main activity: #{main_activity}"
|
80
|
-
selendroid_server_start_cmd = "#{adb_command} shell am instrument -e main_activity '#{main_activity}'
|
80
|
+
selendroid_server_start_cmd = "#{adb_command} shell am instrument -e main_activity '#{main_activity}' io.selendroid/.ServerInstrumentation"
|
81
81
|
system(selendroid_server_start_cmd)
|
82
82
|
unless ENV["SELENDROID_SERVER_PORT"]
|
83
83
|
ENV["SELENDROID_SERVER_PORT"] = "8080"
|
@@ -90,6 +90,7 @@ def wait_for_selendroid_server
|
|
90
90
|
unless ENV["SELENDROID_SERVER_PORT"]
|
91
91
|
ENV["SELENDROID_SERVER_PORT"] = "8080"
|
92
92
|
end
|
93
|
+
|
93
94
|
retriable :tries => 10, :interval => 3 do
|
94
95
|
url = URI.parse("http://localhost:#{ENV["SELENDROID_SERVER_PORT"]}/wd/hub/status")
|
95
96
|
the_request = Net::HTTP::Get.new("#{url.path}")
|
data/lib/selendroid/version.rb
CHANGED
data/selendroid.gemspec
CHANGED
@@ -8,17 +8,16 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = Selendroid::VERSION
|
9
9
|
gem.authors = ["Dominik Dary"]
|
10
10
|
gem.email = ["ddary@acm.org"]
|
11
|
-
gem.homepage = "http://
|
11
|
+
gem.homepage = "http://selendroid.io"
|
12
12
|
gem.description = %q{"Selenium for Android Apps" (Test automate native or hybrid Android apps with Selendroid.)}
|
13
|
-
gem.summary = %q{
|
13
|
+
gem.summary = %q{Shell utility for selendroid.}
|
14
14
|
ignores = File.readlines('.gitignore').grep(/\S+/).map {|s| s.chomp }
|
15
15
|
dotfiles = [ '.gitignore']
|
16
|
-
gem.files = (Dir["**/*"].reject { |f| File.directory?(f) || ignores.any? { |i| File.fnmatch(i, f) } } + dotfiles
|
16
|
+
gem.files = (Dir["**/*"].reject { |f| File.directory?(f) || ignores.any? { |i| File.fnmatch(i, f) } } + dotfiles).sort
|
17
17
|
|
18
18
|
gem.required_ruby_version = '>= 1.9.2'
|
19
19
|
gem.executables = "selendroid"
|
20
20
|
gem.require_paths = ["lib"]
|
21
|
-
gem.add_dependency( "rubyzip")
|
22
21
|
gem.add_dependency( "colorize")
|
23
22
|
gem.add_dependency( "retriable")
|
24
23
|
gem.add_dependency( "awesome_print")
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selendroid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Dary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rubyzip
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: colorize
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,12 +101,8 @@ files:
|
|
115
101
|
- lib/selendroid/selendroid_builder.rb
|
116
102
|
- lib/selendroid/selendroid_driver.rb
|
117
103
|
- lib/selendroid/version.rb
|
118
|
-
- lib/troido/README.md
|
119
|
-
- lib/troido/re-sign.jar
|
120
|
-
- selendroid-prebuild/AndroidManifest.xml
|
121
|
-
- selendroid-prebuild/selendroid-server.apk
|
122
104
|
- selendroid.gemspec
|
123
|
-
homepage: http://
|
105
|
+
homepage: http://selendroid.io
|
124
106
|
licenses: []
|
125
107
|
metadata: {}
|
126
108
|
post_install_message:
|
@@ -142,5 +124,5 @@ rubyforge_project:
|
|
142
124
|
rubygems_version: 2.0.3
|
143
125
|
signing_key:
|
144
126
|
specification_version: 4
|
145
|
-
summary:
|
127
|
+
summary: Shell utility for selendroid.
|
146
128
|
test_files: []
|
data/lib/troido/README.md
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
The re-sign tool is created by troido.de and is published under
|
2
|
-
the apache 2.0 licence:
|
3
|
-
|
4
|
-
* Source code: https://github.com/troido/resign
|
5
|
-
* Jar download: http://www.troido.de/en/downloadslsmallgsoftware-a-driverslsmallg/files-download/1_0f7c0da1d4814335bd4142b87385e2ac
|
6
|
-
|
data/lib/troido/re-sign.jar
DELETED
Binary file
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
-
package="org.openqa.selendroid"
|
4
|
-
android:versionCode="1"
|
5
|
-
android:versionName="0.3.1" >
|
6
|
-
|
7
|
-
<uses-sdk android:minSdkVersion="10" />
|
8
|
-
|
9
|
-
<instrumentation
|
10
|
-
android:name="org.openqa.selendroid.ServerInstrumentation"
|
11
|
-
android:targetPackage="org.openqa.selendroid.testapp" />
|
12
|
-
|
13
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
14
|
-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
15
|
-
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
|
16
|
-
<uses-permission android:name="android.permission.INJECT_EVENTS" />
|
17
|
-
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
18
|
-
|
19
|
-
<application android:label="Selendroid" >
|
20
|
-
<uses-library android:name="android.test.runner" />
|
21
|
-
</application>
|
22
|
-
|
23
|
-
</manifest>
|
Binary file
|