test_sweet 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f456b282e542f1c05a02fa9a0dcc759c800283b3
4
- data.tar.gz: bf9f7de31605d2d29bb0a215b935d42fda16c652
3
+ metadata.gz: 3c452fde1b462a27c6d7274cf2aa12ff2009bdf6
4
+ data.tar.gz: 22bc2dca5482f448675e143cfa60de50aef5d979
5
5
  SHA512:
6
- metadata.gz: 5dd54ccc48565a3ea75e82e4eb1c608a06d6634048efb8b6d015e5f4c53f0172d3afe6509944729e540d5fd0b2fec05277717e1aa92a1d831db3bb330b5e0f8e
7
- data.tar.gz: 48c434d57017435d9f08d56f9d6c6333f86317becfa4adbbfa37c9ddab231826337bbd7ed0324dff7ca779b4f2726308ee524d804b385ab6a3691dc3cea01516
6
+ metadata.gz: 58bb3bb908be088954cfaf0c761778cc22da00df5e888d886c9d55ee5ea256d41537ae6c426fc43bb0316e05b5ac23c50597397a4ecfa657f8d2da8ca2179001
7
+ data.tar.gz: 35872077ace5d00eb0337f7c3c3428da0cd089ba234de4f1c573defa628ab2d5f966f66eac75c3e0f622c5432910aac141ba2af856b87361e86944b98bdb2ef3
@@ -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
- ENV['test_sweet-target'] = Motion::Project::App.config.deployment_target || ENV['target']
14
- ENV['test_sweet-app'] = Motion::Project::App.config.app_bundle('iPhoneSimulator')
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 "test_sweet/version"
2
- require 'fileutils'
1
+ require "fileutils"
3
2
  require "rubygems"
4
3
  require "tasks/test_sweet"
5
- require 'cucumber/rake/task'
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
- 'features/example.feature',
16
- 'features/step_definitions/example_steps.rb',
17
- 'features/support/env.rb'
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, 'w+') { |file| file.write(content) }
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('features/support/env.rb')
29
+ File.new("features/support/env.rb")
29
30
  true
30
31
  rescue Errno::ENOENT
31
32
  false
@@ -0,0 +1,7 @@
1
+ class TestSweet
2
+ class Config
3
+ def self.android?
4
+ defined?(Motion::Project::AndroidConfig)
5
+ end
6
+ end
7
+ end
@@ -12,7 +12,7 @@ class AppiumWorld; end
12
12
 
13
13
  caps = {
14
14
  caps: {
15
- platformName: "ios",
15
+ platformName: ENV['test_sweet-platform'],
16
16
  platformVersion: ENV['test_sweet-target'],
17
17
  app: ENV['test_sweet-app'],
18
18
  deviceName: ENV['test_sweet-device-name']
@@ -1,3 +1,3 @@
1
1
  class TestSweet
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  Feature: Running a test
2
- As an iOS developer
2
+ As an mobile developer
3
3
  I want to have a sample feature file
4
4
  So I can begin testing quickly
5
5
 
@@ -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
- expect(find_element(:xpath, "//UIAApplication[1]").is_a?(Selenium::WebDriver::Element)).to eq(true)
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.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-07-17 00:00:00.000000000 Z
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