cs-bdd 0.1.5 → 0.1.6
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 +2 -0
- data/cs-bdd.gemspec +5 -5
- data/lib/cs/bdd/version.rb +1 -1
- data/lib/skeleton/Gemfile +3 -11
- data/lib/skeleton/config/scripts/ios/build_app.rb +21 -15
- data/lib/skeleton/config/scripts/ios/build_app.yml +2 -0
- data/lib/skeleton/features/android/support/app_installation_hooks.rb +9 -15
- data/lib/skeleton/features/ios/support/01_launch.rb +65 -17
- data/lib/templates/screen.tt +4 -4
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77788c60608eb5143e09cdb2e2adc8b4285f5334
|
4
|
+
data.tar.gz: 13607e4f59453700a6d4f5757a52edeb98fe45ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c131b1b0fb8f9cb93a838048eef113bf74667222709def1128e074ac592015bbb234d48dca788a9843f0cb363d303c2ed2e61a60bef4f9fbf4fdaa23a929d7b5
|
7
|
+
data.tar.gz: cd77ac0ddf4d13a3685dcbe6e6745479eeffea5ded9518ef20f89107c2ba634220bbff7342c7ea0f5e19b40615d6a5a0af7fe7e260bc106cb9caca9c0ef42072
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
A simple gem to generate all files needed in a project that will support calabash for both Android and iOS.
|
5
5
|
|
6
|
+
iOS Build script works only with iOS SDK 9.2 or newer
|
7
|
+
|
6
8
|
[Calabash](http://calaba.sh/) uses cucumber to support functional tests in Android and iOS and has one gem for each Platform:
|
7
9
|
|
8
10
|
> calabash-android (for Android) [(link)](https://github.com/calabash/calabash-android)
|
data/cs-bdd.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'bundler', '
|
22
|
-
spec.add_runtime_dependency 'rake', '
|
23
|
-
spec.add_runtime_dependency 'thor', '
|
24
|
-
spec.add_runtime_dependency 'i18n', '
|
25
|
-
spec.add_runtime_dependency 'gherkin', '
|
21
|
+
spec.add_runtime_dependency 'bundler', '>=1.7'
|
22
|
+
spec.add_runtime_dependency 'rake', '>=10.0'
|
23
|
+
spec.add_runtime_dependency 'thor', '>=0.19.1'
|
24
|
+
spec.add_runtime_dependency 'i18n', '>=0.6.11'
|
25
|
+
spec.add_runtime_dependency 'gherkin', '>=2.12.2'
|
26
26
|
end
|
data/lib/cs/bdd/version.rb
CHANGED
data/lib/skeleton/Gemfile
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
# Gemfile to help setting up the initial development environment
|
2
2
|
source 'https://rubygems.org'
|
3
3
|
|
4
|
-
gem 'calabash-common', '~> 0.0.
|
5
|
-
gem 'calabash-android', '~> 0.5.
|
6
|
-
|
7
|
-
# Gems that will only be used with the computer is a Mac
|
8
|
-
group :mac_os do
|
9
|
-
# Remenber to fix the calabash-cucumber version. The update of this gem is
|
10
|
-
# a proccess that you need to update the Calabash Server on your iOS
|
11
|
-
# application code. So I suggest doing the update manually
|
12
|
-
gem 'calabash-cucumber', '~> 0.16.4'
|
13
|
-
gem 'cocoapods', '~> 0.35.0'
|
14
|
-
end
|
4
|
+
gem 'calabash-common', '~> 0.0.2'
|
5
|
+
gem 'calabash-android', '~> 0.5.15'
|
6
|
+
gem 'calabash-cucumber', '~> 0.17.1'
|
@@ -3,13 +3,13 @@
|
|
3
3
|
# ----------------------------------------------------------------------------
|
4
4
|
#
|
5
5
|
# $1 -> configuration environment (dev or jenkins)
|
6
|
-
# $2 -> device type. Builds for 'simulator' or 'device'
|
7
6
|
#
|
8
7
|
#
|
9
8
|
# REMEMBER to fill the configuration file build_app.yml
|
10
9
|
|
11
10
|
require 'fileutils'
|
12
11
|
require 'yaml'
|
12
|
+
require 'pathname'
|
13
13
|
|
14
14
|
# When running on CI
|
15
15
|
# It is a good pratice to run pod install when executing this script
|
@@ -19,11 +19,10 @@ require 'yaml'
|
|
19
19
|
# Parsing the yaml configuration file
|
20
20
|
config = YAML.load_file(File.join(File.dirname(__FILE__), 'build_app.yml'))
|
21
21
|
|
22
|
-
if ARGV.length
|
22
|
+
if ARGV.length != 1
|
23
23
|
puts 'Error: Wrong number of arguments!'
|
24
|
-
puts 'Usage: build_app.rb environment
|
24
|
+
puts 'Usage: build_app.rb environment'
|
25
25
|
puts "Available Environments: #{config.keys.join(', ')}"
|
26
|
-
puts "Device type: 'simulator' or 'device'"
|
27
26
|
exit 1
|
28
27
|
end
|
29
28
|
|
@@ -37,29 +36,36 @@ else
|
|
37
36
|
config = config[ARGV[0]]
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
# Creating a folder name from the destination configuration parameter
|
40
|
+
folder_name = config['destination'].gsub('platform=', '').gsub('name=', '')
|
41
|
+
.tr(' ', '_').tr(',', '_')
|
42
|
+
export_path = File.join(config['export_path'], folder_name)
|
43
|
+
|
44
|
+
# Removing the folder where the .app will be stored if it already exists
|
45
|
+
FileUtils.rm_r export_path if Dir.exist?(export_path)
|
41
46
|
|
42
47
|
# Creating the folder where the .app will be stored
|
43
48
|
FileUtils.mkdir_p export_path
|
44
49
|
|
45
|
-
# Choosing the SDK for device or simulator
|
46
|
-
sdk = ''
|
47
|
-
if ARGV[1] == 'device'
|
48
|
-
sdk = 'iphoneos'
|
49
|
-
else
|
50
|
-
sdk = 'iphonesimulator'
|
51
|
-
end
|
52
|
-
|
53
50
|
puts 'Building project'
|
54
51
|
|
55
52
|
system <<eos
|
56
53
|
xcodebuild -workspace "#{config['xcworkspace']}" \
|
57
|
-
-scheme "#{config['scheme']}" -
|
54
|
+
-scheme "#{config['scheme']}" -destination "#{config['destination']}" \
|
58
55
|
-configuration "#{config['configuration']}" clean build \
|
59
56
|
CONFIGURATION_BUILD_DIR="#{export_path}"
|
60
57
|
eos
|
61
58
|
|
62
|
-
|
59
|
+
# Getting the app folder that was created
|
60
|
+
# Listing all folders on the export path folder
|
61
|
+
folders = Pathname.new(export_path).children.select { |c| c.directory? }
|
62
|
+
# Getting the folder which ends with .app
|
63
|
+
app_pathname = folders.select { |f| f.to_s.match('.app$') }
|
64
|
+
# Getting the app folder path
|
65
|
+
app_path = app_pathname.first.to_s
|
66
|
+
|
67
|
+
# Printing the APP_BUNDLE_PATH in the terminal
|
68
|
+
puts "APP_BUNDLE_PATH=#{app_path}"
|
63
69
|
|
64
70
|
puts "End: #{Time.now.strftime('%H:%M:%S')}"
|
65
71
|
puts 'Bye!'
|
@@ -2,10 +2,12 @@ dev:
|
|
2
2
|
xcworkspace: "Path_to_the_xcworkspace_folder"
|
3
3
|
scheme: TargetName
|
4
4
|
configuration: Debug
|
5
|
+
destination: "platform=iOS Simulator,name=iPhone 6"
|
5
6
|
export_path: "Path_to_export_app_folder"
|
6
7
|
|
7
8
|
jenkins:
|
8
9
|
xcworkspace: <%= ENV['WORKSPACE']%>/Project.xcworkspace
|
9
10
|
scheme: TargetName
|
10
11
|
configuration: Debug
|
12
|
+
destination: "Any_platform_or_device_that_you_want"
|
11
13
|
export_path: <%= ENV['WORKSPACE']%>/releases/normal
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'calabash-android/management/app_installation'
|
2
2
|
|
3
3
|
AfterConfiguration do
|
4
|
-
|
4
|
+
FeatureMemory.feature = nil
|
5
5
|
end
|
6
6
|
|
7
7
|
Before('@reinstall') do
|
@@ -11,13 +11,11 @@ Before('@reinstall') do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
Before do |scenario|
|
14
|
-
|
15
|
-
|
16
|
-
scenario = scenario.scenario_outline if @scenario_is_outline
|
14
|
+
scenario = scenario.scenario_outline if
|
15
|
+
scenario.respond_to?(:scenario_outline)
|
17
16
|
|
18
|
-
|
19
|
-
if
|
20
|
-
ENV['RESET_BETWEEN_SCENARIOS'] == '1'
|
17
|
+
feature = scenario.feature
|
18
|
+
if FeatureMemory.feature != feature || ENV['RESET_BETWEEN_SCENARIOS'] == '1'
|
21
19
|
if ENV['RESET_BETWEEN_SCENARIOS'] == '1'
|
22
20
|
log 'New scenario - reinstalling apps'
|
23
21
|
else
|
@@ -28,15 +26,11 @@ Before do |scenario|
|
|
28
26
|
install_app(ENV['TEST_APP_PATH'])
|
29
27
|
install_app(ENV['APP_PATH'])
|
30
28
|
|
31
|
-
|
32
|
-
|
29
|
+
FeatureMemory.feature = feature
|
30
|
+
FeatureMemory.invocation = 1
|
33
31
|
else
|
34
|
-
|
32
|
+
FeatureMemory.invocation += 1
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
|
-
|
39
|
-
class << FeatureNameMemory
|
40
|
-
@feature_name = nil
|
41
|
-
attr_accessor :feature_name, :invocation
|
42
|
-
end
|
36
|
+
FeatureMemory = Struct.new(:feature, :invocation).new
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# When running calabash-ios tests at #
|
6
6
|
# www.xamarin.com/test-cloud #
|
7
7
|
# the methods invoked by #
|
8
|
-
# CalabashLauncher are
|
8
|
+
# CalabashLauncher are overridden. #
|
9
9
|
# It will automatically ensure #
|
10
10
|
# running on device, installing apps #
|
11
11
|
# etc. #
|
@@ -14,35 +14,54 @@
|
|
14
14
|
|
15
15
|
require 'calabash-cucumber/launcher'
|
16
16
|
|
17
|
+
module Calabash::Launcher
|
18
|
+
@@launcher = nil
|
19
|
+
def self.launcher
|
20
|
+
@@launcher ||= Calabash::Cucumber::Launcher.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.launcher=(launcher)
|
24
|
+
@@launcher = launcher
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
AfterConfiguration do
|
29
|
+
FeatureMemory.feature = nil
|
30
|
+
end
|
31
|
+
|
17
32
|
Before do |scenario|
|
18
|
-
|
33
|
+
launcher = Calabash::Launcher.launcher
|
34
|
+
# Relaunch options
|
35
|
+
options = { timeout: 3000 }
|
19
36
|
|
20
|
-
|
21
|
-
|
22
|
-
|
37
|
+
scenario = scenario.scenario_outline if
|
38
|
+
scenario.respond_to?(:scenario_outline)
|
39
|
+
feature = scenario.feature
|
23
40
|
|
24
41
|
scenario_tags = scenario.source_tag_names
|
25
|
-
|
26
|
-
# ENV['FEATURE_NAME'] is just an aux created to store the feature name
|
27
|
-
if ENV['FEATURE_NAME'] != scenario.feature.title ||
|
42
|
+
if FeatureMemory.feature != feature ||
|
28
43
|
ENV['RESET_BETWEEN_SCENARIOS'] == '1' ||
|
29
44
|
scenario_tags.include?('@reinstall')
|
45
|
+
reinstall_app
|
46
|
+
# Reset app if it is a new feature
|
47
|
+
options[:reset] = true
|
30
48
|
|
31
|
-
|
32
|
-
|
49
|
+
FeatureMemory.feature = feature
|
50
|
+
FeatureMemory.invocation = 1
|
51
|
+
else
|
52
|
+
FeatureMemory.invocation += 1
|
33
53
|
end
|
34
54
|
|
35
|
-
|
36
|
-
|
37
|
-
|
55
|
+
FeatureMemory.feature = feature
|
56
|
+
FeatureMemory.invocation = 1
|
57
|
+
unless launcher.calabash_no_launch?
|
58
|
+
launcher.relaunch(options)
|
59
|
+
launcher.calabash_notify(self)
|
38
60
|
end
|
39
61
|
end
|
40
62
|
|
41
63
|
After do
|
42
|
-
unless
|
43
|
-
calabash_exit
|
44
|
-
@calabash_launcher.stop if @calabash_launcher.active?
|
45
|
-
end
|
64
|
+
calabash_exit unless launcher.calabash_no_stop?
|
46
65
|
end
|
47
66
|
|
48
67
|
at_exit do
|
@@ -51,3 +70,32 @@ at_exit do
|
|
51
70
|
launcher.simulator_launcher.stop unless launcher.calabash_no_stop?
|
52
71
|
end
|
53
72
|
end
|
73
|
+
|
74
|
+
def device?
|
75
|
+
# Check if UUID (ENV['DEVICE_TARGET']) is from a device or a simulator
|
76
|
+
# Getting all the simulator's UUID
|
77
|
+
uuids = `xcrun simctl list`
|
78
|
+
return false if uuids.include? ENV['DEVICE_TARGET']
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
def reinstall_app
|
83
|
+
if device?
|
84
|
+
system "echo 'Installing the app...'"
|
85
|
+
# Trying to reinstall the app
|
86
|
+
success = system "ios-deploy -r -b #{ENV['APP_BUNDLE_PATH']} -i #{ENV['DEVICE_TARGET']} -t 5 > /dev/null"
|
87
|
+
|
88
|
+
# If the app is not installed the above command will throw an error
|
89
|
+
# So we just install the app
|
90
|
+
unless success
|
91
|
+
success = system "ios-deploy -b #{ENV['APP_BUNDLE_PATH']} -i #{ENV['DEVICE_TARGET']} -t 5 > /dev/null"
|
92
|
+
fail 'Error. Could not install the app.' unless
|
93
|
+
success # If there is any error raises an exception
|
94
|
+
end
|
95
|
+
|
96
|
+
system "echo 'Installed.'"
|
97
|
+
sleep(3) # Gives a time to finish the installation of the app in the device
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
FeatureMemory = Struct.new(:feature, :invocation).new
|
data/lib/templates/screen.tt
CHANGED
@@ -3,11 +3,11 @@ class <%= config[:name] %>Screen < <%= config[:platform] %>ScreenBase
|
|
3
3
|
# trait(:trait) { "* <%= (config[:platform] == 'Android') ? 'id' : 'marked' %>:'#{layout_name}'" }
|
4
4
|
|
5
5
|
# <%= I18n.translate 'comments.elements' %>
|
6
|
-
# element(:layout_name) { '
|
7
|
-
# element(:button) { '
|
6
|
+
# element(:layout_name) { pending 'Insert layout identificator' }
|
7
|
+
# element(:button) { pending 'Insert button identificator' }
|
8
8
|
|
9
9
|
# <%= I18n.translate 'comments.actions' %>
|
10
|
-
# action(:touch_button)
|
10
|
+
# action(:touch_button) do
|
11
11
|
# touch("* <%= (config[:platform] == 'Android') ? 'id' : 'marked' %>:'#{button}'")
|
12
|
-
#
|
12
|
+
# end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cs-bdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Tanner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.19.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.19.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: i18n
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.6.11
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.6.11
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gherkin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.12.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.12.2
|
83
83
|
description: A simple gem to generate all files needed in a project that will support
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.5.1
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Generates an android and iOS calabash project.
|