cs-webautomator 0.1.4
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 +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +1 -0
- data/bin/cs-webautomator +140 -0
- data/bin/cs-webautomator-helpers.rb +56 -0
- data/cs-webautomator.gemspec +26 -0
- data/lib/cs/webautomator/locales/en.yml +6 -0
- data/lib/cs/webautomator/locales/pt.yml +6 -0
- data/lib/cs/webautomator/version.rb +5 -0
- data/lib/cs/webautomator.rb +8 -0
- data/lib/skeleton/.gitignore +3 -0
- data/lib/skeleton/Gemfile +11 -0
- data/lib/skeleton/README.md +96 -0
- data/lib/skeleton/cucumber.yml +10 -0
- data/lib/skeleton/features/pages/.gitkeep +0 -0
- data/lib/skeleton/features/specifications/.gitkeep +0 -0
- data/lib/skeleton/features/steps_definitions/.gitkeep +0 -0
- data/lib/skeleton/features/support/config/dev.yaml +0 -0
- data/lib/skeleton/features/support/config/hmg.yaml +0 -0
- data/lib/skeleton/features/support/env.rb +23 -0
- data/lib/skeleton/features/support/hooks.rb +23 -0
- data/lib/skeleton/features/support/matchers/custom.rb +12 -0
- data/lib/templates/feature.tt +8 -0
- data/lib/templates/page.tt +6 -0
- data/lib/templates/steps.tt +5 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 691b30af57e0e224c75a34a51898ff106da92e04
|
4
|
+
data.tar.gz: 998d6a89066e4854a58b56f64f75906065cb016f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd9ca515c4a36174fed990c5c0590858ac881bd63285658b9f84b20cb504b64c7181d315b5a075da19ac06376326ec1e3d9607c47f7084bda3c5289c41378686
|
7
|
+
data.tar.gz: c9e03e379e1f9ac4ac3fb4ff0e58becc5d1e21757fa05fe4289fb29f972cd4b5c095fb2aed09c3621eddb27cb26bec72a2ea5bca283fcb9125b1a91275be36fe
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cs-webautomator (0.1.0)
|
5
|
+
bundler (>= 1.7)
|
6
|
+
gherkin (= 2.12.2)
|
7
|
+
i18n (>= 0.6.11)
|
8
|
+
rake (>= 10.0)
|
9
|
+
thor (>= 0.19.1)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
gherkin (2.12.2)
|
15
|
+
multi_json (~> 1.3)
|
16
|
+
i18n (0.7.0)
|
17
|
+
json (2.0.1)
|
18
|
+
multi_json (1.12.1)
|
19
|
+
rake (11.2.2)
|
20
|
+
thor (0.19.1)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
cs-webautomator!
|
27
|
+
gherkin
|
28
|
+
i18n
|
29
|
+
json
|
30
|
+
thor
|
31
|
+
|
32
|
+
BUNDLED WITH
|
33
|
+
1.12.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 CSOscarTanner
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# CS::WEBAUTOMATOR
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Install it as:
|
6
|
+
|
7
|
+
$ gem install cs-webautomator
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
In the terminal, type for help:
|
12
|
+
|
13
|
+
```
|
14
|
+
cs-webautomator
|
15
|
+
cs-webautomator generate
|
16
|
+
```
|
17
|
+
|
18
|
+
To see the gem version type:
|
19
|
+
|
20
|
+
```
|
21
|
+
cs-webautomator version
|
22
|
+
```
|
23
|
+
|
24
|
+
To generate a project that support both Android and iOS features type:
|
25
|
+
|
26
|
+
```
|
27
|
+
cs-webautomator new ProjectName
|
28
|
+
```
|
29
|
+
|
30
|
+
This command will create a folder named ProjectName in the current directory and will create all the needed files. This gem support localizations. To create a localized project, in Portuguese, type:
|
31
|
+
|
32
|
+
```
|
33
|
+
cs-webautomator new ProjectName --lang=pt
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
**The generators commands ONLY WORK in the ROOT FOLDER of the project**.
|
38
|
+
|
39
|
+
####Features
|
40
|
+
|
41
|
+
```
|
42
|
+
cs-webautomator generate feature FeatureName
|
43
|
+
```
|
44
|
+
The feature generator will create a Platform independent feature and its files. So this command will create the FeatureName.feature file inside the folder `feature`, the file FeatureName_steps.rb inside the folder `features/step_definitions`, the file FeatureName_page.rb inside the folder `features/pages`.
|
45
|
+
|
46
|
+
|
47
|
+
Don't forget about internationalization. All the generators accept the option `--lang=pt` or with some other language.
|
48
|
+
|
49
|
+
####Steps
|
50
|
+
|
51
|
+
```
|
52
|
+
cs-webautomator generate step StepName
|
53
|
+
```
|
54
|
+
The step generator will create a Platform independent step file named StepName_steps.rb in the folder `features/step_definitions`
|
55
|
+
|
56
|
+
|
57
|
+
####Pages
|
58
|
+
|
59
|
+
```
|
60
|
+
cs-webautomator generate page PageName
|
61
|
+
```
|
62
|
+
The step generator will create a Platform independent page file named StepName_page.rb in the folder `features/pages`
|
63
|
+
|
64
|
+
|
65
|
+
## Continuous Integration (CI)
|
66
|
+
|
67
|
+
The project contains a lot of scripts that will help you to configure you CI server.
|
68
|
+
|
69
|
+
> Documentation under development.
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it ( https://github.com/samycici/cs-webautomator )
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/cs-webautomator
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'thor/group'
|
5
|
+
require 'i18n'
|
6
|
+
require 'gherkin' # Used here as a translation source
|
7
|
+
require 'json'
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
require File.join(File.dirname(__FILE__), 'cs-webautomator-helpers')
|
11
|
+
require_relative '../lib/cs/webautomator/version'
|
12
|
+
|
13
|
+
module CS
|
14
|
+
module WEBAUTOMATOR
|
15
|
+
# Definition of all gem generators
|
16
|
+
class Generate < Thor
|
17
|
+
include Thor::Actions
|
18
|
+
|
19
|
+
desc 'feature [RESOURCE_NAME]', 'Generates a feature'
|
20
|
+
option :lang,
|
21
|
+
banner: 'any of the gherkin supported languages',
|
22
|
+
default: :pt
|
23
|
+
def feature(name)
|
24
|
+
I18n.config.default_locale = options[:lang]
|
25
|
+
in_root_project_folder?
|
26
|
+
|
27
|
+
create_feature_file(name)
|
28
|
+
create_steps_file name
|
29
|
+
create_page_file name
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'step [RESOURCE_NAME]', 'Generates a step'
|
33
|
+
option :lang,
|
34
|
+
banner: 'any of the gherkin supported languages',
|
35
|
+
default: :pt
|
36
|
+
def step(name)
|
37
|
+
I18n.config.default_locale = options[:lang]
|
38
|
+
in_root_project_folder?
|
39
|
+
create_steps_file name
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'page [RESOURCE_NAME]',
|
43
|
+
'Generates pages'
|
44
|
+
option :lang,
|
45
|
+
banner: 'any of the gherkin supported languages',
|
46
|
+
default: :pt
|
47
|
+
def page(name)
|
48
|
+
I18n.config.default_locale = options[:lang]
|
49
|
+
in_root_project_folder?
|
50
|
+
create_page_file name
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.source_root
|
54
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'templates')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module CS
|
61
|
+
module WEBAUTOMATOR
|
62
|
+
# Definition of the generators groups
|
63
|
+
class CsWebautomatorRunner < Thor
|
64
|
+
include Thor::Actions
|
65
|
+
|
66
|
+
map '-v' => :version
|
67
|
+
map '--version' => :version
|
68
|
+
|
69
|
+
default_task :help
|
70
|
+
|
71
|
+
register CS::WEBAUTOMATOR::Generate, 'generate',
|
72
|
+
'generate [GENERATOR] [RESOURCE_NAME]',
|
73
|
+
'Generates various resources'
|
74
|
+
register CS::WEBAUTOMATOR::Generate, 'g',
|
75
|
+
'g [GENERATOR] [RESOURCE_NAME]',
|
76
|
+
'Generates various resources'
|
77
|
+
|
78
|
+
desc 'new PROJECT_NAME',
|
79
|
+
'Generates the structure of a new project that uses '\
|
80
|
+
'Capybara, SitePrism, Selenium and Cucumber'
|
81
|
+
option :lang,
|
82
|
+
banner: 'any of the gherkin supported languages',
|
83
|
+
default: :pt
|
84
|
+
def new(name)
|
85
|
+
I18n.config.default_locale = options[:lang]
|
86
|
+
# Thor will be responsible to look for identical
|
87
|
+
# files and possibles conflicts
|
88
|
+
directory File.join(File.dirname(__FILE__),
|
89
|
+
'..', 'lib', 'skeleton'), name
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
desc 'version', 'Shows the gem version'
|
94
|
+
def version
|
95
|
+
puts "cs-webautomator Version #{CS::WEBAUTOMATOR::VERSION}"
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.source_root
|
99
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'templates')
|
100
|
+
end
|
101
|
+
|
102
|
+
# Overriding the initialize method to load all the
|
103
|
+
# translations supported by the gem gherkin
|
104
|
+
def initialize(*args)
|
105
|
+
super
|
106
|
+
# Loading gherkin accepted translations
|
107
|
+
translations_file_path = File.join(
|
108
|
+
Gem.loaded_specs['gherkin'].full_gem_path,
|
109
|
+
'lib',
|
110
|
+
'gherkin',
|
111
|
+
'i18n.json'
|
112
|
+
)
|
113
|
+
# Parsing the JSON file
|
114
|
+
# Removing the sequence *| and all the alternative
|
115
|
+
# options for the gherkin translations
|
116
|
+
translations_json = JSON.parse(
|
117
|
+
File.read(translations_file_path)
|
118
|
+
.gsub(/\*\|/, '')
|
119
|
+
.gsub(/\|.*\"/, '"'))
|
120
|
+
# Converting the translations to YAML and storing in a temp file
|
121
|
+
translations_temp_file = Tempfile.new(['translations', '.yml'])
|
122
|
+
File.write(translations_temp_file, translations_json.to_yaml)
|
123
|
+
# Loading the translations from gherkin and from the
|
124
|
+
# locales folder of this gem
|
125
|
+
locales_folder_path = File.join(
|
126
|
+
File.dirname(__FILE__),
|
127
|
+
'..', 'lib', 'cs', 'webautomator', 'locales'
|
128
|
+
)
|
129
|
+
I18n.load_path = Dir[
|
130
|
+
translations_temp_file,
|
131
|
+
File.join(locales_folder_path, '*.yml')
|
132
|
+
]
|
133
|
+
I18n.backend.load_translations
|
134
|
+
I18n.config.enforce_available_locales = true
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
CS::WEBAUTOMATOR::CsWebautomatorRunner.start
|
@@ -0,0 +1,56 @@
|
|
1
|
+
def create_feature_file(name)
|
2
|
+
# options used to generate the file in the template function
|
3
|
+
opts = { name: camelize(name) }
|
4
|
+
|
5
|
+
# Feature
|
6
|
+
file_path = File.join(FileUtils.pwd, 'features', 'specifications', "#{name.downcase}.feature")
|
7
|
+
|
8
|
+
# Thor creates a file based on the templates/feature.tt template
|
9
|
+
template('feature', file_path, opts)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_steps_file(name)
|
13
|
+
# options used to generate the file in the template function
|
14
|
+
opts = { name: camelize(name) }
|
15
|
+
|
16
|
+
# Step
|
17
|
+
file_path = File.join(
|
18
|
+
FileUtils.pwd, 'features', 'steps_definitions',
|
19
|
+
"#{name.downcase}_steps.rb"
|
20
|
+
)
|
21
|
+
|
22
|
+
# Thor creates a file based on the templates/steps.tt template
|
23
|
+
template('steps', file_path, opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_page_file(name)
|
27
|
+
# options used to generate the file in the template function
|
28
|
+
opts = { name: camelize(name) }
|
29
|
+
|
30
|
+
# Thor creates a file based on the templates/page.tt template
|
31
|
+
template('page',
|
32
|
+
File.join(
|
33
|
+
FileUtils.pwd, 'features', 'pages',
|
34
|
+
"#{name.downcase}_page.rb"),
|
35
|
+
opts)
|
36
|
+
end
|
37
|
+
|
38
|
+
def camelize(string)
|
39
|
+
camelized = ''
|
40
|
+
|
41
|
+
string.split('_').each do |s|
|
42
|
+
camelized += s.capitalize
|
43
|
+
end
|
44
|
+
|
45
|
+
camelized
|
46
|
+
end
|
47
|
+
|
48
|
+
def in_root_project_folder?
|
49
|
+
# Looks if the user is in the root folder of the project
|
50
|
+
if !Dir.exist?(File.join(FileUtils.pwd, 'features', 'specifications'))
|
51
|
+
puts 'Please run this command on the root folder of the project'
|
52
|
+
exit 1
|
53
|
+
end
|
54
|
+
|
55
|
+
true
|
56
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cs/webautomator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cs-webautomator'
|
8
|
+
spec.version = CS::WEBAUTOMATOR::VERSION
|
9
|
+
spec.authors = ['Samanta Cicilia']
|
10
|
+
spec.email = ['samycici@gmail.com']
|
11
|
+
spec.summary = 'Generates an Capybara project.'
|
12
|
+
spec.description = %q{A simple gem to generate all files needed in a project that will support Capybara.}
|
13
|
+
spec.homepage = 'https://github.com/concretesolutions/cs-bdd'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ['cs-webautomator']
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
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
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
## Configurando o ambiente ##
|
2
|
+
|
3
|
+
### Instalar rbenv ###
|
4
|
+
Execute o seguinte comando:
|
5
|
+
```shell
|
6
|
+
brew install rbenv
|
7
|
+
```
|
8
|
+
|
9
|
+
Inclua no ~/.bash_profile:
|
10
|
+
```shell
|
11
|
+
eval "$(rbenv init -)"
|
12
|
+
```
|
13
|
+
|
14
|
+
Listar as versões disponíveis:
|
15
|
+
```shell
|
16
|
+
rbenv install -l
|
17
|
+
```
|
18
|
+
|
19
|
+
Instalar uma versão:
|
20
|
+
```shell
|
21
|
+
rbenv install 2.3.1
|
22
|
+
```
|
23
|
+
|
24
|
+
### Ativar rbenv 2.3.1 ###
|
25
|
+
Navegar para pasta desejada e executar o seguinte comando:
|
26
|
+
```shell
|
27
|
+
rbenv local 2.3.1
|
28
|
+
```
|
29
|
+
|
30
|
+
### Instalando o bundler ###
|
31
|
+
Navegar para pasta desejada e executar o seguinte comando:
|
32
|
+
```shell
|
33
|
+
gem install bundler
|
34
|
+
```
|
35
|
+
|
36
|
+
### Instalando as gems ###
|
37
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
38
|
+
```shell
|
39
|
+
bundle install
|
40
|
+
```
|
41
|
+
|
42
|
+
### Drivers necessários: ###
|
43
|
+
Instalar [chromedriver](https://sites.google.com/a/chromium.org/chromedriver/) e [phantomjs](http://phantomjs.org/) e adicionar ao PATH
|
44
|
+
|
45
|
+
### Executando os testes em DEV usando Chrome###
|
46
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
47
|
+
```shell
|
48
|
+
bundle exec cucumber
|
49
|
+
```
|
50
|
+
|
51
|
+
### Executando os testes em DEV usando Firefox###
|
52
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
53
|
+
```shell
|
54
|
+
bundle exec cucumber -p firefox -p dev
|
55
|
+
```
|
56
|
+
|
57
|
+
### Executando os testes em DEV usando Poltergeist###
|
58
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
59
|
+
```shell
|
60
|
+
bundle exec cucumber -p poltergeist -p dev
|
61
|
+
```
|
62
|
+
|
63
|
+
### Executando os testes em HMG usando Chrome###
|
64
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
65
|
+
```shell
|
66
|
+
bundle exec cucumber -p chrome -p hmg
|
67
|
+
```
|
68
|
+
|
69
|
+
### Executando os testes em HMG usando Firefox###
|
70
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
71
|
+
```shell
|
72
|
+
bundle exec cucumber -p firefox -p hmg
|
73
|
+
```
|
74
|
+
### Executando os testes em HMG usando Poltergeist###
|
75
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
76
|
+
```shell
|
77
|
+
bundle exec cucumber -p poltergeist -p hmg
|
78
|
+
```
|
79
|
+
|
80
|
+
### Gerando relatório HTML###
|
81
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
82
|
+
```shell
|
83
|
+
bundle exec cucumber -p html_report
|
84
|
+
```
|
85
|
+
|
86
|
+
### Executando tags###
|
87
|
+
Execute o seguinte comando dentro da raiz do projeto:
|
88
|
+
```shell
|
89
|
+
bundle exec cucumber --tags @run
|
90
|
+
```
|
91
|
+
|
92
|
+
### Rodados specs de TDD###
|
93
|
+
Execute o seguinte comando dentro de TDD:
|
94
|
+
```shell
|
95
|
+
bundle exec rspec
|
96
|
+
```
|
@@ -0,0 +1,10 @@
|
|
1
|
+
##YAML Template
|
2
|
+
---
|
3
|
+
default: -p html_report -p chrome -p dev
|
4
|
+
html_report: --format progress --format html --out=features_report.html
|
5
|
+
firefox: BROWSER=firefox
|
6
|
+
chrome: BROWSER=chrome
|
7
|
+
poltergeist: BROWSER=poltergeist
|
8
|
+
internet_explorer: BROWSER=internet_explorer
|
9
|
+
dev: AMBIENTE=dev
|
10
|
+
hmg: AMBIENTE=hmg
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'capybara'
|
2
|
+
require 'capybara/cucumber'
|
3
|
+
require 'selenium-webdriver'
|
4
|
+
require 'site_prism'
|
5
|
+
require 'rspec'
|
6
|
+
require 'yaml'
|
7
|
+
require 'capybara/poltergeist'
|
8
|
+
|
9
|
+
BROWSER = ENV['BROWSER']
|
10
|
+
AMBIENTE = ENV['AMBIENTE']
|
11
|
+
|
12
|
+
Capybara.register_driver :selenium do |app|
|
13
|
+
if BROWSER.eql?('chrome')
|
14
|
+
Capybara::Selenium::Driver.new(app, :browser => :chrome)
|
15
|
+
elsif BROWSER.eql?('firefox')
|
16
|
+
Capybara::Selenium::Driver.new(app, :browser => :firefox)
|
17
|
+
elsif BROWSER.eql?('internet_explorer')
|
18
|
+
Capybara::Selenium::Driver.new(app, :browser => :internet_explorer)
|
19
|
+
elsif BROWSER.eql?('poltergeist')
|
20
|
+
options = { js_errors: false }
|
21
|
+
Capybara::Poltergeist::Driver.new(app, options)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Before do |feature|
|
2
|
+
CONFIG = YAML.load_file(File.dirname(__FILE__) + "/config/#{AMBIENTE}.yaml")
|
3
|
+
Capybara.configure do |config|
|
4
|
+
config.default_driver = :selenium
|
5
|
+
end
|
6
|
+
Capybara.default_max_wait_time = 20
|
7
|
+
end
|
8
|
+
|
9
|
+
After do |scenario|
|
10
|
+
if scenario.failed?
|
11
|
+
diretorio = 'screenshots'
|
12
|
+
arquivo = "#{diretorio}/#{scenario.name}.png"
|
13
|
+
Dir.mkdir(diretorio) unless File.exist?(diretorio)
|
14
|
+
if BROWSER.eql?('poltergeist')
|
15
|
+
Capybara.page.save_screenshot(arquivo)
|
16
|
+
else
|
17
|
+
Capybara.page.driver.browser.save_screenshot(arquivo)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
unless BROWSER.eql?('poltergeist')
|
21
|
+
Capybara.current_session.driver.quit
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
RSpec::Matchers.define :all_list_elements_eq do |expected|
|
4
|
+
match do |actual|
|
5
|
+
actual.each do |i|
|
6
|
+
expect(i).to eq(expected)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
failure_message_for_should do |actual|
|
10
|
+
"expected that all elements in #{actual} list would be equals #{expected}"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= "# language: #{options[:lang]}" %>
|
2
|
+
<%= I18n.translate( :feature ) %>: <%= config[:name] %>
|
3
|
+
|
4
|
+
<%= I18n.translate( :background ) %>:
|
5
|
+
# <%= I18n.translate( "comments.insert_steps" ) %>
|
6
|
+
|
7
|
+
<%= I18n.translate( :scenario ) %>: <%= I18n.translate( :first_scenario ) %>
|
8
|
+
# <%= I18n.translate( "comments.insert_steps" ) %>
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cs-webautomator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samanta Cicilia
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: i18n
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.11
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.11
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gherkin
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.12.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.12.2
|
83
|
+
description: A simple gem to generate all files needed in a project that will support
|
84
|
+
Capybara.
|
85
|
+
email:
|
86
|
+
- samycici@gmail.com
|
87
|
+
executables:
|
88
|
+
- cs-webautomator
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/cs-webautomator
|
98
|
+
- bin/cs-webautomator-helpers.rb
|
99
|
+
- cs-webautomator.gemspec
|
100
|
+
- lib/cs/webautomator.rb
|
101
|
+
- lib/cs/webautomator/locales/en.yml
|
102
|
+
- lib/cs/webautomator/locales/pt.yml
|
103
|
+
- lib/cs/webautomator/version.rb
|
104
|
+
- lib/skeleton/.gitignore
|
105
|
+
- lib/skeleton/Gemfile
|
106
|
+
- lib/skeleton/README.md
|
107
|
+
- lib/skeleton/cucumber.yml
|
108
|
+
- lib/skeleton/features/pages/.gitkeep
|
109
|
+
- lib/skeleton/features/specifications/.gitkeep
|
110
|
+
- lib/skeleton/features/steps_definitions/.gitkeep
|
111
|
+
- lib/skeleton/features/support/config/dev.yaml
|
112
|
+
- lib/skeleton/features/support/config/hmg.yaml
|
113
|
+
- lib/skeleton/features/support/env.rb
|
114
|
+
- lib/skeleton/features/support/hooks.rb
|
115
|
+
- lib/skeleton/features/support/matchers/custom.rb
|
116
|
+
- lib/templates/feature.tt
|
117
|
+
- lib/templates/page.tt
|
118
|
+
- lib/templates/steps.tt
|
119
|
+
homepage: https://github.com/concretesolutions/cs-bdd
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.5.1
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Generates an Capybara project.
|
143
|
+
test_files: []
|