cs-bdd 0.1.2 → 0.1.3
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/Gemfile +0 -9
- data/README.md +7 -3
- data/bin/cs-bdd +62 -50
- data/cs-bdd.gemspec +2 -2
- data/lib/cs/bdd/locales/en.yml +2 -1
- data/lib/cs/bdd/locales/pt.yml +2 -1
- data/lib/cs/bdd/version.rb +1 -1
- data/lib/skeleton/.gitignore +2 -1
- data/lib/skeleton/Gemfile +15 -0
- data/lib/skeleton/config/email/template.html +0 -2
- data/lib/skeleton/config/scripts/android/start_emulators.sh +1 -1
- data/lib/skeleton/config/scripts/ios/build_app.rb +57 -0
- data/lib/skeleton/config/scripts/ios/build_app.yml +15 -0
- data/lib/skeleton/features/ios/support/01_launch.rb +1 -1
- data/lib/templates/android_screen_base.tt +8 -2
- data/lib/templates/base_steps.tt +6 -2
- data/lib/templates/ios_screen_base.tt +8 -2
- data/lib/templates/screen.tt +3 -3
- metadata +8 -6
- data/lib/skeleton/config/scripts/ios/build_app.sh +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2875a3961df23b83a153a8e7dfba33a9de05977
|
4
|
+
data.tar.gz: 72838f4d189d390f3f16d3ebc55a00a771507c8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba40751df0d1886c4355bacb3e3ffae1fcb284af45909b97f23bf2040a15d1f1cc48aa9ba594ff153109daad206f58458fa1bde6574fa0627836f29f296ca506
|
7
|
+
data.tar.gz: 7990fe160d13effec743a506a8de0f4730d2aa6c0c89320751338b646462b838a50690e9c622a67784cd1d8c0c27f6b32ded49f8fb1b375e6e2ee283c4ae20c1
|
data/Gemfile
CHANGED
@@ -7,12 +7,3 @@ gem 'thor'
|
|
7
7
|
gem 'i18n'
|
8
8
|
gem 'json'
|
9
9
|
gem 'gherkin'
|
10
|
-
|
11
|
-
# calabash gems
|
12
|
-
gem 'calabash-common'
|
13
|
-
# Only for Linux
|
14
|
-
if RUBY_PLATFORM.include? 'linux'
|
15
|
-
gem 'calabash-android'
|
16
|
-
else # Only for Mac. This gem will not be used in Windows
|
17
|
-
gem 'calabash-cucumber'
|
18
|
-
end
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# CS::BDD
|
2
|
+
[](https://www.omniref.com/ruby/gems/cs-bdd)
|
2
3
|
|
3
4
|
A simple gem to generate all files needed in a project that will support calabash for both Android and iOS.
|
4
5
|
|
@@ -57,14 +58,17 @@ This command will create a folder named ProjectName in the current directory and
|
|
57
58
|
|
58
59
|
> **Don't you know how to name your translation yml file?** See the Gherkin supported languages [here](https://github.com/cucumber/gherkin/blob/master/lib/gherkin/i18n.json) for reference.
|
59
60
|
|
60
|
-
Once the project is created, open its folder (`cd ProjectName`)
|
61
|
+
Once the project is created, open its folder (`cd ProjectName`) and run `bundle install`
|
61
62
|
|
62
|
-
|
63
|
-
|
63
|
+
> This project supports both Android and iOS, so if you are on a PC you will not need the gems that are only for Macs, so you can run the command `bundle install --without mac_os`
|
64
|
+
|
65
|
+
> Remember to fix a calabash-cucumber version on the Gemfile. When updating the calabash-cucumber gem version you need to update the Calabash framework that was embeded on your iOS code. So I suggest doing the update manually. [In this page](https://github.com/calabash/calabash-ios/wiki/B1-Updating-your-Calabash-iOS-version) you can find more informations on how to update the Calabash framework.
|
64
66
|
|
65
67
|
|
66
68
|
There are nine generators that are responsible to create the templates for Features, Step definitions and Screens.
|
67
69
|
|
70
|
+
**The generators commands ONLY WORK in the ROOT FOLDER of the project**.
|
71
|
+
|
68
72
|
####Features
|
69
73
|
|
70
74
|
```
|
data/bin/cs-bdd
CHANGED
@@ -7,29 +7,30 @@ require 'gherkin' # Used here as a translation source
|
|
7
7
|
require 'json'
|
8
8
|
require 'yaml'
|
9
9
|
|
10
|
-
require File.join(File.dirname(__FILE__),
|
10
|
+
require File.join(File.dirname(__FILE__), 'cs-bdd-helpers')
|
11
11
|
require_relative '../lib/cs/bdd/version'
|
12
12
|
|
13
13
|
module CS
|
14
14
|
module BDD
|
15
|
+
# Definition of all gem generators
|
15
16
|
class Generate < Thor
|
16
17
|
include Thor::Actions
|
17
18
|
|
18
|
-
desc
|
19
|
-
option :lang, :
|
20
|
-
def feature
|
19
|
+
desc 'feature [RESOURCE_NAME]', 'Generates an OS independent feature'
|
20
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
21
|
+
def feature(name)
|
21
22
|
I18n.config.default_locale = options[:lang]
|
22
23
|
in_root_project_folder?
|
23
24
|
|
24
|
-
create_feature_file
|
25
|
+
create_feature_file(name)
|
25
26
|
create_steps_file name
|
26
27
|
create_screen_file name, 'Android'
|
27
28
|
create_screen_file name, 'IOS'
|
28
29
|
end
|
29
30
|
|
30
|
-
desc
|
31
|
-
option :lang, :
|
32
|
-
def aFeature
|
31
|
+
desc 'aFeature [RESOURCE_NAME]', 'Generates an Android dependent feature'
|
32
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
33
|
+
def aFeature(name)
|
33
34
|
I18n.config.default_locale = options[:lang]
|
34
35
|
in_root_project_folder?
|
35
36
|
|
@@ -38,9 +39,9 @@ module CS
|
|
38
39
|
create_screen_file name, 'Android'
|
39
40
|
end
|
40
41
|
|
41
|
-
desc
|
42
|
-
option :lang, :
|
43
|
-
def iFeature
|
42
|
+
desc 'iFeature [RESOURCE_NAME]', 'Generates an iOS dependent feature'
|
43
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
44
|
+
def iFeature(name)
|
44
45
|
I18n.config.default_locale = options[:lang]
|
45
46
|
in_root_project_folder?
|
46
47
|
|
@@ -49,57 +50,57 @@ module CS
|
|
49
50
|
create_screen_file name, 'IOS'
|
50
51
|
end
|
51
52
|
|
52
|
-
desc
|
53
|
-
option :lang, :
|
54
|
-
def step
|
53
|
+
desc 'step [RESOURCE_NAME]', 'Generates an OS independent step'
|
54
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
55
|
+
def step(name)
|
55
56
|
I18n.config.default_locale = options[:lang]
|
56
57
|
in_root_project_folder?
|
57
58
|
create_steps_file name
|
58
59
|
end
|
59
60
|
|
60
|
-
desc
|
61
|
-
option :lang, :
|
62
|
-
def aStep
|
61
|
+
desc 'aStep [RESOURCE_NAME]', 'Generates an Android dependent step'
|
62
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
63
|
+
def aStep(name)
|
63
64
|
I18n.config.default_locale = options[:lang]
|
64
65
|
in_root_project_folder?
|
65
66
|
create_steps_file name, 'Android'
|
66
67
|
end
|
67
68
|
|
68
|
-
desc
|
69
|
-
option :lang, :
|
70
|
-
def iStep
|
69
|
+
desc 'iStep [RESOURCE_NAME]', 'Generates an iOS dependent step'
|
70
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
71
|
+
def iStep(name)
|
71
72
|
I18n.config.default_locale = options[:lang]
|
72
73
|
in_root_project_folder?
|
73
74
|
create_steps_file name, 'IOS'
|
74
75
|
end
|
75
76
|
|
76
|
-
desc
|
77
|
-
option :lang, :
|
78
|
-
def screen
|
77
|
+
desc 'screen [RESOURCE_NAME]', 'Generates the Android and iOS dependent screens'
|
78
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
79
|
+
def screen(name)
|
79
80
|
I18n.config.default_locale = options[:lang]
|
80
81
|
in_root_project_folder?
|
81
82
|
create_screen_file name, 'Android'
|
82
|
-
create_screen_file name, 'IOS'
|
83
|
+
create_screen_file name, 'IOS'
|
83
84
|
end
|
84
85
|
|
85
|
-
desc
|
86
|
-
option :lang, :
|
87
|
-
def aScreen
|
86
|
+
desc 'aScreen [RESOURCE_NAME]', 'Generates an Android dependent screen'
|
87
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
88
|
+
def aScreen(name)
|
88
89
|
I18n.config.default_locale = options[:lang]
|
89
90
|
in_root_project_folder?
|
90
91
|
create_screen_file name, 'Android'
|
91
92
|
end
|
92
93
|
|
93
|
-
desc
|
94
|
-
option :lang, :
|
95
|
-
def iScreen
|
94
|
+
desc 'iScreen [RESOURCE_NAME]', 'Generates an iOS dependent screen'
|
95
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
96
|
+
def iScreen(name)
|
96
97
|
I18n.config.default_locale = options[:lang]
|
97
98
|
in_root_project_folder?
|
98
99
|
create_screen_file name, 'IOS'
|
99
100
|
end
|
100
101
|
|
101
102
|
def self.source_root
|
102
|
-
File.join(
|
103
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'templates')
|
103
104
|
end
|
104
105
|
end
|
105
106
|
end
|
@@ -107,58 +108,69 @@ end
|
|
107
108
|
|
108
109
|
module CS
|
109
110
|
module BDD
|
111
|
+
# Definition of the generators groups
|
110
112
|
class CsBddRunner < Thor
|
111
113
|
include Thor::Actions
|
112
114
|
|
115
|
+
map '-v' => :version
|
116
|
+
map '--version' => :version
|
117
|
+
|
113
118
|
default_task :help
|
114
119
|
|
115
120
|
register CS::BDD::Generate, 'generate', 'generate [GENERATOR] [RESOURCE_NAME]', 'Generates various resources'
|
121
|
+
register CS::BDD::Generate, 'g', 'g [GENERATOR] [RESOURCE_NAME]', 'Generates various resources'
|
116
122
|
|
117
|
-
desc
|
118
|
-
option :lang, :
|
123
|
+
desc 'new PROJECT_NAME', 'Generates the structure of a new project that uses Calabash in both Android and iOS apps'
|
124
|
+
option :lang, banner: 'any of the gherkin supported languages', default: :en
|
119
125
|
def new name
|
120
126
|
I18n.config.default_locale = options[:lang]
|
121
|
-
# Thor will be responsible to look for identical
|
122
|
-
|
127
|
+
# Thor will be responsible to look for identical
|
128
|
+
# files and possibles conflicts
|
129
|
+
directory File.join(File.dirname(__FILE__),
|
130
|
+
'..', 'lib', 'skeleton'), name
|
123
131
|
|
124
132
|
# Copying base steps file with localization
|
125
|
-
template(
|
133
|
+
template('base_steps', File.join(name, 'features', 'step_definitions',
|
134
|
+
'base_steps.rb'))
|
126
135
|
|
127
136
|
# Copying android screen base file with localization
|
128
|
-
template(
|
137
|
+
template('android_screen_base', File.join(name, 'features', 'android',
|
138
|
+
'android_screen_base.rb'))
|
129
139
|
|
130
140
|
# Copying ios screen base file with localization
|
131
|
-
template(
|
132
|
-
|
141
|
+
template('ios_screen_base',
|
142
|
+
File.join(name, 'features', 'ios', 'ios_screen_base.rb'))
|
133
143
|
end
|
134
144
|
|
135
|
-
desc
|
145
|
+
desc 'version', 'Shows the gem version'
|
136
146
|
def version
|
137
147
|
puts "cs-bdd Version #{CS::BDD::VERSION}"
|
138
148
|
end
|
139
149
|
|
140
150
|
def self.source_root
|
141
|
-
File.join(
|
151
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'templates')
|
142
152
|
end
|
143
153
|
|
144
|
-
# Overriding the initialize method to load all the
|
154
|
+
# Overriding the initialize method to load all the
|
155
|
+
# translations supported by the gem gherkin
|
145
156
|
def initialize(*args)
|
146
157
|
super
|
147
158
|
# Loading gherkin accepted translations
|
148
159
|
translations_file_path = File.join(Gem.loaded_specs['gherkin'].full_gem_path, 'lib', 'gherkin', 'i18n.json')
|
149
160
|
# Parsing the JSON file
|
150
|
-
# Removing the sequence *| and all the alternative
|
151
|
-
|
161
|
+
# Removing the sequence *| and all the alternative
|
162
|
+
# options for the gherkin translations
|
163
|
+
translations_json = JSON.parse(File.read(translations_file_path).gsub(/\*\|/, '').gsub(/\|.*\"/, '"'))
|
152
164
|
# Converting the translations to YAML and storing in a temp file
|
153
|
-
translations_temp_file = Tempfile.new(
|
154
|
-
File.write(
|
155
|
-
# Loading the translations from gherkin and from the
|
156
|
-
|
157
|
-
|
165
|
+
translations_temp_file = Tempfile.new(['translations', '.yml'])
|
166
|
+
File.write(translations_temp_file, translations_json.to_yaml)
|
167
|
+
# Loading the translations from gherkin and from the
|
168
|
+
# locales folder of this gem
|
169
|
+
locales_folder_path = File.join(File.dirname(__FILE__),'..', 'lib', 'cs', 'bdd', 'locales')
|
170
|
+
I18n.load_path = Dir[translations_temp_file, File.join(locales_folder_path, '*.yml')]
|
158
171
|
I18n.backend.load_translations
|
159
172
|
I18n.config.enforce_available_locales = true
|
160
173
|
end
|
161
|
-
|
162
174
|
end
|
163
175
|
end
|
164
176
|
end
|
data/cs-bdd.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Oscar Tanner"]
|
10
10
|
spec.email = ["oscar.tanner@concretesolutions.com.br"]
|
11
11
|
spec.summary = %q{Generates an android and iOS calabash project.}
|
12
|
-
spec.description = %q{A simple gem to generate all
|
12
|
+
spec.description = %q{A simple gem to generate all files needed in a project that will support Calabash for both Android and iOS.}
|
13
13
|
spec.homepage = "https://github.com/CSOscarTanner/cs-bdd"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -24,4 +24,4 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "i18n", "~> 0.6.11"
|
25
25
|
spec.add_runtime_dependency "gherkin", "~> 2.12.2"
|
26
26
|
|
27
|
-
end
|
27
|
+
end
|
data/lib/cs/bdd/locales/en.yml
CHANGED
@@ -16,8 +16,9 @@ en:
|
|
16
16
|
wait_progress_bar: "I (?:wait|waited) for the progress bar to vanish"
|
17
17
|
should_see_page: "I should see the page '(.*?)'"
|
18
18
|
should_see_page_that_contains: "I should see a page that contains '(.*?)'"
|
19
|
+
take_print: "take picture"
|
19
20
|
directions:
|
20
21
|
up: 'up'
|
21
22
|
down: 'down'
|
22
23
|
left: 'left'
|
23
|
-
right: 'right'
|
24
|
+
right: 'right'
|
data/lib/cs/bdd/locales/pt.yml
CHANGED
@@ -16,8 +16,9 @@ pt:
|
|
16
16
|
wait_progress_bar: "Eu (?:espero|esperei) até a barra de progresso sumir"
|
17
17
|
should_see_page: "Eu deveria ver a página '(.*?)'"
|
18
18
|
should_see_page_that_contains: "Eu deveria ver uma página que contem '(.*?)'"
|
19
|
+
take_print: "faço um print"
|
19
20
|
directions:
|
20
21
|
up: 'cima'
|
21
22
|
down: 'baixo'
|
22
23
|
left: 'esquerda'
|
23
|
-
right: 'direita'
|
24
|
+
right: 'direita'
|
data/lib/cs/bdd/version.rb
CHANGED
data/lib/skeleton/.gitignore
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Gemfile to help setting up the initial development environment
|
2
|
+
source "https://rubygems.org"
|
3
|
+
|
4
|
+
gem 'calabash-common', '~> 0.0.1'
|
5
|
+
gem 'calabash-android', '~> 0.5.5'
|
6
|
+
|
7
|
+
# Gems that will only be used with the computer is a Mac
|
8
|
+
group :mac_os do
|
9
|
+
# Rementer to fix a calabash-cucumber version. The update of this gem is a proccess
|
10
|
+
# that you need to update de Calabash Server on your iOS application code. So I suggest
|
11
|
+
# doing the update manually
|
12
|
+
gem 'calabash-cucumber', '~> 0.12.2'
|
13
|
+
gem 'cocoapods', '~> 0.35.0'
|
14
|
+
end
|
15
|
+
|
@@ -5,12 +5,10 @@
|
|
5
5
|
</head>
|
6
6
|
<body>
|
7
7
|
<center>
|
8
|
-
<font face="Trebuchet MS" size="3">
|
9
8
|
<h1>Continuous Integration</h1>
|
10
9
|
<h2>Job Status: _JOB_NAME_, build number: #_BUILD_NUMBER_</h2>
|
11
10
|
Hello. I'm here to let you know that the tests <strong>_STATUS_</strong>.<br>
|
12
11
|
To view the reports, click <a href="http://jenkins_url/reports/_JOB_NAME_/_BUILD_NUMBER_">here.</a><br>
|
13
|
-
</font>
|
14
12
|
</center>
|
15
13
|
</body>
|
16
14
|
</html>
|
@@ -15,7 +15,7 @@ do
|
|
15
15
|
echo $AVD
|
16
16
|
AVD="$(basename ${AVD/.avd/})"
|
17
17
|
echo starting "$AVD"...
|
18
|
-
emulator -gpu on -noaudio -scale 0.5 -no-boot-anim -accel on -avd "$AVD" -qemu -m 1024 -enable-kvm &
|
18
|
+
emulator -wipe-data -gpu on -noaudio -scale 0.5 -no-boot-anim -accel on -avd "$AVD" -qemu -m 1024 -enable-kvm &
|
19
19
|
done
|
20
20
|
|
21
21
|
sleep 15
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
# ----------------------------------------------------------------------------
|
4
|
+
#
|
5
|
+
# $1 -> configuration environment (dev or jenkins)
|
6
|
+
# $2 -> device type. Builds for 'simulator' or 'device'
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# REMEMBER to fill the configuration file build_app.yml
|
10
|
+
|
11
|
+
require 'fileutils'
|
12
|
+
require 'yaml'
|
13
|
+
|
14
|
+
# When running on CI
|
15
|
+
# It is a good pratice to run pod install when executing this script
|
16
|
+
# on the CI to avoid building problems
|
17
|
+
# %x(pod install)
|
18
|
+
|
19
|
+
# Parsing the yaml configuration file
|
20
|
+
config = YAML.load_file(File.join(File.dirname(__FILE__), 'build_app.yml'))
|
21
|
+
|
22
|
+
if ARGV.length < 2
|
23
|
+
puts 'Error: Wrong number of arguments!'
|
24
|
+
puts 'Usage: build_app.rb environment device_type'
|
25
|
+
puts "Available Environments: #{config.keys.join(', ')}"
|
26
|
+
puts "Device type: 'simulator' or 'device'"
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
|
30
|
+
puts "Starting at #{Time.now.strftime('%H:%M:%S')}"
|
31
|
+
|
32
|
+
if config[ARGV[0]].nil?
|
33
|
+
puts 'Error: Wrong configuration environment!'
|
34
|
+
puts "Available Environments: #{config.keys}"
|
35
|
+
exit 1
|
36
|
+
else
|
37
|
+
config = config[ARGV[0]]
|
38
|
+
end
|
39
|
+
|
40
|
+
export_path = File.join(config['export_path'], ARGV[1])
|
41
|
+
|
42
|
+
# Creating the folder where the .app will be stored
|
43
|
+
FileUtils.mkdir_p export_path
|
44
|
+
|
45
|
+
puts 'Building project'
|
46
|
+
|
47
|
+
system <<eos
|
48
|
+
xcodebuild -workspace "#{config['xcworkspace']}" \
|
49
|
+
-scheme "#{config['scheme']}" -sdk "#{config["sdk_#{ARGV[1]}"]}" \
|
50
|
+
-configuration "#{config['configuration']}" clean build \
|
51
|
+
CONFIGURATION_BUILD_DIR="#{export_path}"
|
52
|
+
eos
|
53
|
+
|
54
|
+
puts "APP_BUNDLE_PATH=#{File.join(export_path, config['scheme'])}.app"
|
55
|
+
|
56
|
+
puts "End: #{Time.now.strftime('%H:%M:%S')}"
|
57
|
+
puts 'Bye!'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
dev:
|
2
|
+
xcworkspace: "Path_to_the_xcworkspace_folder"
|
3
|
+
scheme: TargetName
|
4
|
+
sdk_simulator: iphonesimulator8.1
|
5
|
+
sdk_device: iphoneos8.1
|
6
|
+
configuration: Debug
|
7
|
+
export_path: "Path_to_export_app_folder"
|
8
|
+
|
9
|
+
jenkins:
|
10
|
+
xcworkspace: <%= ENV['WORKSPACE']%>/Project.xcworkspace
|
11
|
+
scheme: TargetName
|
12
|
+
sdk_simulator: iphonesimulator8.1
|
13
|
+
sdk_device: iphoneos8.1
|
14
|
+
configuration: Debug
|
15
|
+
export_path: <%= ENV['WORKSPACE']%>/releases/normal
|
@@ -39,7 +39,7 @@ Before do |scenario|
|
|
39
39
|
|
40
40
|
@calabash_launcher = Calabash::Cucumber::Launcher.new
|
41
41
|
unless @calabash_launcher.calabash_no_launch?
|
42
|
-
@calabash_launcher.relaunch
|
42
|
+
@calabash_launcher.relaunch({:timeout => 300})
|
43
43
|
@calabash_launcher.calabash_notify(self)
|
44
44
|
end
|
45
45
|
|
@@ -71,14 +71,20 @@ class AndroidScreenBase < Calabash::ABase
|
|
71
71
|
|
72
72
|
# Negation indicates that we want a page that doesn't has the message passed as parameter
|
73
73
|
def is_on_page? page_text, negation = ''
|
74
|
+
should_not_have_exception = false
|
75
|
+
should_have_exception = false
|
74
76
|
begin
|
75
77
|
wait_for(timeout: 5) { has_text? page_text }
|
76
78
|
# If negation is not nil, we should raise an error if this message was found on the view
|
77
|
-
|
79
|
+
should_not_have_exception = true unless negation == ''
|
78
80
|
rescue
|
79
81
|
# only raise exception if negation is nil, otherwise this is the expected behaviour
|
80
|
-
|
82
|
+
should_have_exception = true if negation == ''
|
81
83
|
end
|
84
|
+
|
85
|
+
raise "Unexpected Page. The page should not have: '#{page_text}'" if should_not_have_exception
|
86
|
+
|
87
|
+
raise "Unexpected Page. Expected was: '#{page_text}'" if should_have_exception
|
82
88
|
end
|
83
89
|
|
84
90
|
def enter text, element, query = nil
|
data/lib/templates/base_steps.tt
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
@page.drag_until_element_is_visible_with_special_query direction.to_sym, element
|
4
4
|
end
|
5
5
|
|
6
|
-
<%= I18n.translate( :given ).capitalize %>(/^<%= I18n.translate( "steps.
|
6
|
+
<%= I18n.translate( :given ).capitalize %>(/^<%= I18n.translate( "steps.page_contains" ) %>$/) do |page_text|
|
7
7
|
@page.is_on_page? page_text
|
8
8
|
end
|
9
9
|
|
@@ -35,4 +35,8 @@ end
|
|
35
35
|
|
36
36
|
<%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.should_see_page_that_contains" %>$/) do |page_text|
|
37
37
|
@page.is_on_page? page_text
|
38
|
-
end
|
38
|
+
end
|
39
|
+
|
40
|
+
<%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.take_print" %>$/) do
|
41
|
+
screenshot_embed
|
42
|
+
end
|
@@ -105,14 +105,20 @@ class IOSScreenBase < Calabash::IBase
|
|
105
105
|
|
106
106
|
# Negation indicates that we want a page that doesn't has the message passed as parameter
|
107
107
|
def is_on_page?(page_text, negation = '')
|
108
|
+
should_not_have_exception = false
|
109
|
+
should_have_exception = false
|
108
110
|
begin
|
109
111
|
wait_for(timeout: 5) { has_text? page_text }
|
110
112
|
# If negation is not nil, we should raise an error if this message was found on the view
|
111
|
-
|
113
|
+
should_not_have_exception = true unless negation == ''
|
112
114
|
rescue
|
113
115
|
# only raise exception if negation is nil, otherwise this is the expected behaviour
|
114
|
-
|
116
|
+
should_have_exception = true if negation == ''
|
115
117
|
end
|
118
|
+
|
119
|
+
raise "Unexpected Page. The page should not have: '#{page_text}'" if should_not_have_exception
|
120
|
+
|
121
|
+
raise "Unexpected Page. Expected was: '#{page_text}'" if should_have_exception
|
116
122
|
end
|
117
123
|
|
118
124
|
def enter text, element, query = nil
|
data/lib/templates/screen.tt
CHANGED
@@ -4,12 +4,12 @@ class <%= config[:name] %>Screen < <%= config[:platform] %>ScreenBase
|
|
4
4
|
#trait(:trait) { "* <%= (config[:platform] == 'Android') ? 'id' : 'marked' %>:'#{layout_name}'" }
|
5
5
|
|
6
6
|
# <%= I18n.translate 'comments.elements' %>
|
7
|
-
#element(:layout_name) {'insert_layout_identificator'}
|
8
|
-
#element(:button) {'insert_button_identificator'}
|
7
|
+
#element(:layout_name) { 'insert_layout_identificator' }
|
8
|
+
#element(:button) { 'insert_button_identificator' }
|
9
9
|
|
10
10
|
# <%= I18n.translate 'comments.actions' %>
|
11
11
|
# action(:touch_button) {
|
12
12
|
# touch("* <%= (config[:platform] == 'Android') ? 'id' : 'marked' %>:'#{button}'")
|
13
13
|
# }
|
14
14
|
|
15
|
-
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Tanner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,8 +80,8 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.12.2
|
83
|
-
description: A simple gem to generate all
|
84
|
-
|
83
|
+
description: A simple gem to generate all files needed in a project that will support
|
84
|
+
Calabash for both Android and iOS.
|
85
85
|
email:
|
86
86
|
- oscar.tanner@concretesolutions.com.br
|
87
87
|
executables:
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/cs/bdd/locales/pt.yml
|
103
103
|
- lib/cs/bdd/version.rb
|
104
104
|
- lib/skeleton/.gitignore
|
105
|
+
- lib/skeleton/Gemfile
|
105
106
|
- lib/skeleton/README.md
|
106
107
|
- lib/skeleton/config/cucumber.yml
|
107
108
|
- lib/skeleton/config/email/template.html
|
@@ -110,7 +111,8 @@ files:
|
|
110
111
|
- lib/skeleton/config/scripts/android/stop_emulators.sh
|
111
112
|
- lib/skeleton/config/scripts/break_build_if_failed.sh
|
112
113
|
- lib/skeleton/config/scripts/check_if_tests_failed.sh
|
113
|
-
- lib/skeleton/config/scripts/ios/build_app.
|
114
|
+
- lib/skeleton/config/scripts/ios/build_app.rb
|
115
|
+
- lib/skeleton/config/scripts/ios/build_app.yml
|
114
116
|
- lib/skeleton/config/scripts/ios/devices.txt
|
115
117
|
- lib/skeleton/config/scripts/ios/run_tests_all_devices.sh
|
116
118
|
- lib/skeleton/features/android/features/.gitkeep
|
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
153
|
version: '0'
|
152
154
|
requirements: []
|
153
155
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.4.
|
156
|
+
rubygems_version: 2.4.5
|
155
157
|
signing_key:
|
156
158
|
specification_version: 4
|
157
159
|
summary: Generates an android and iOS calabash project.
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
# ----------------------------------------------------------------------------
|
3
|
-
# Uncomment the next line to enable debug
|
4
|
-
# set -x
|
5
|
-
#
|
6
|
-
# $1 -> xcworkspace path
|
7
|
-
# $2 -> target (scheme) name created by the command calabash-ios setup
|
8
|
-
# $3 -> sdk. This will differ from simulator and device build
|
9
|
-
# When this script was created the available sdks were: 'iphoneos8.1' for
|
10
|
-
# devices and iphonesimulator8.1 for simulator
|
11
|
-
# $4 -> Configuration type. Ex.: 'Dev'
|
12
|
-
# $5 -> The path to save the .app bundle
|
13
|
-
|
14
|
-
## CODE BEGIN #############################################################
|
15
|
-
|
16
|
-
# When running on CI
|
17
|
-
# It is a good pratice to run pod install when executing this script on the CI to avoid
|
18
|
-
# building problems
|
19
|
-
# pod install
|
20
|
-
|
21
|
-
[ $# -ne 5 ] && echo "Wrong number of parameters." && exit 1
|
22
|
-
|
23
|
-
echo Inicio da execução: $(date)
|
24
|
-
|
25
|
-
# Creating .app bundle path folder if it doesn't exists
|
26
|
-
mkdir -p "$5"
|
27
|
-
|
28
|
-
# Changing relative to absolute path if that is the case
|
29
|
-
original_path="$(pwd)" # Saving the original path where the command was executed
|
30
|
-
cd "$5"
|
31
|
-
path="$(pwd)"
|
32
|
-
cd "$original_path" # Going back to the original path
|
33
|
-
|
34
|
-
echo "Building project for calabash"
|
35
|
-
|
36
|
-
xcodebuild -workspace "$1" -scheme "$2" -sdk "$3" -configuration "$4" clean build CONFIGURATION_BUILD_DIR="$path"
|
37
|
-
|
38
|
-
echo "APP_BUNDLE_PATH=$path/$2.app"
|
39
|
-
|
40
|
-
echo End: $(date)
|
41
|
-
echo 'Bye!'
|
42
|
-
## CODE END #############################################################
|