test_sweet 0.4.0 → 0.5.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/lib/tasks/test_sweet.rb +11 -5
- data/lib/test_sweet.rb +9 -8
- data/lib/test_sweet/config.rb +7 -0
- data/lib/test_sweet/cucumber_env.rb +1 -1
- data/lib/test_sweet/version.rb +1 -1
- data/templates/features/example.feature +1 -1
- data/templates/features/step_definitions/example_steps.rb +24 -1
- metadata +3 -3
- data/lib/test_sweet/provided_steps.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c452fde1b462a27c6d7274cf2aa12ff2009bdf6
|
4
|
+
data.tar.gz: 22bc2dca5482f448675e143cfa60de50aef5d979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58bb3bb908be088954cfaf0c761778cc22da00df5e888d886c9d55ee5ea256d41537ae6c426fc43bb0316e05b5ac23c50597397a4ecfa657f8d2da8ca2179001
|
7
|
+
data.tar.gz: 35872077ace5d00eb0337f7c3c3428da0cd089ba234de4f1c573defa628ab2d5f966f66eac75c3e0f622c5432910aac141ba2af856b87361e86944b98bdb2ef3
|
data/lib/tasks/test_sweet.rb
CHANGED
@@ -10,17 +10,23 @@ namespace :test_sweet do
|
|
10
10
|
desc "Run integration tests"
|
11
11
|
task :run do
|
12
12
|
if TestSweet.verify_initialized
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
if !File.exists? ENV['test_sweet-app']
|
17
|
-
puts "No application at #{ENV['test_sweet-app']} - please build your app!"
|
13
|
+
if TestSweet::Config.android?
|
14
|
+
ENV['test_sweet-platform'] = "Android"
|
15
|
+
ENV['test_sweet-app'] = Motion::Project::App.config.apk_path
|
18
16
|
else
|
17
|
+
ENV['test_sweet-target'] = Motion::Project::App.config.deployment_target || ENV['target']
|
18
|
+
ENV['test_sweet-app'] = Motion::Project::App.config.app_bundle('iPhoneSimulator')
|
19
|
+
ENV['test_sweet-platform'] = "iOS"
|
19
20
|
ENV['test_sweet-device-name'] = Motion::Project::App.config.device_family_string(
|
20
21
|
ENV['device'],
|
21
22
|
Motion::Project::App.config.device_family_ints[0],
|
22
23
|
ENV['test_sweet-target'],
|
23
24
|
ENV['retina'])
|
25
|
+
end
|
26
|
+
|
27
|
+
if !File.exists? ENV['test_sweet-app']
|
28
|
+
puts "No application at #{ENV['test_sweet-app']} - please build your app!"
|
29
|
+
else
|
24
30
|
Cucumber::Rake::Task.new(:features, "") do |t|
|
25
31
|
t.cucumber_opts = "--format pretty #{ENV["FEATURES"] || "features"}"
|
26
32
|
end.runner.run
|
data/lib/test_sweet.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
require "
|
2
|
-
require 'fileutils'
|
1
|
+
require "fileutils"
|
3
2
|
require "rubygems"
|
4
3
|
require "tasks/test_sweet"
|
5
|
-
require
|
4
|
+
require "cucumber/rake/task"
|
5
|
+
require "test_sweet/version"
|
6
|
+
require "test_sweet/config"
|
6
7
|
|
7
8
|
class TestSweet
|
8
9
|
def self.init
|
@@ -12,20 +13,20 @@ class TestSweet
|
|
12
13
|
gem_root = spec.gem_dir
|
13
14
|
|
14
15
|
files = [
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
"features/example.feature",
|
17
|
+
"features/step_definitions/example_steps.rb",
|
18
|
+
"features/support/env.rb"
|
18
19
|
]
|
19
20
|
|
20
21
|
files.each do |f|
|
21
22
|
content = File.open("#{gem_root}/templates/#{f}", "r").read
|
22
|
-
File.open(f,
|
23
|
+
File.open(f, "w+") { |file| file.write(content) }
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
27
|
def self.verify_initialized
|
27
28
|
begin
|
28
|
-
File.new(
|
29
|
+
File.new("features/support/env.rb")
|
29
30
|
true
|
30
31
|
rescue Errno::ENOENT
|
31
32
|
false
|
data/lib/test_sweet/version.rb
CHANGED
@@ -3,5 +3,28 @@ Given(/^I touch the screen$/) do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
Then(/^the application should have opened properly$/) do
|
6
|
-
|
6
|
+
|
7
|
+
# this example is somewhat contrived, you would want to do something more
|
8
|
+
# realistic to your actual application
|
9
|
+
|
10
|
+
# on iOS we're our xpaths are like this
|
11
|
+
#
|
12
|
+
# on android they are like this
|
13
|
+
#//android.view.View[1]
|
14
|
+
|
15
|
+
# for this example to just work on both, we have to do some investigating,
|
16
|
+
# again you probably would write your steps for the platform actually being
|
17
|
+
# used
|
18
|
+
#
|
19
|
+
# You'd more likely find a field by name, and expect that it had the right
|
20
|
+
# content, or tap on it...etc, but with a completely blank project there
|
21
|
+
# really is nothing like that to write samples steps against.
|
22
|
+
|
23
|
+
begin
|
24
|
+
@root = find_element(:xpath, "//UIAApplication[1]")
|
25
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
26
|
+
@root = find_element(:xpath, "//android.view.View[1]")
|
27
|
+
end
|
28
|
+
|
29
|
+
expect(@root.is_a?(Selenium::WebDriver::Element)).to eq(true)
|
7
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_sweet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Larrabee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appium_lib
|
@@ -117,9 +117,9 @@ files:
|
|
117
117
|
- bin/test_sweet
|
118
118
|
- lib/tasks/test_sweet.rb
|
119
119
|
- lib/test_sweet.rb
|
120
|
+
- lib/test_sweet/config.rb
|
120
121
|
- lib/test_sweet/core_steps.rb
|
121
122
|
- lib/test_sweet/cucumber_env.rb
|
122
|
-
- lib/test_sweet/provided_steps.rb
|
123
123
|
- lib/test_sweet/screenshotting_steps.rb
|
124
124
|
- lib/test_sweet/version.rb
|
125
125
|
- templates/features/example.feature
|
File without changes
|