cs-webautomator 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +58 -21
- data/bin/cs-webautomator +4 -4
- data/lib/cs/webautomator/version.rb +1 -1
- data/lib/skeleton/README.md +30 -36
- data/lib/skeleton/features/support/env.rb +10 -2
- data/lib/skeleton/features/support/hooks.rb +16 -6
- data/lib/skeleton/features/support/matchers/custom.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e7a731683e759d9bf74f8ca3b1a7ccf437c774
|
4
|
+
data.tar.gz: e0e20b93f4093665f8d18def462a749b287672ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b30226ac893e581dd89c3529c8d77d51238dfebe49c3014d1263f788d6f68f0d41d2ab183b91812e39d0cb9a118bccf42e930581b270ef5736ef24d15989302
|
7
|
+
data.tar.gz: a62156bae4e03f3cbe66d56d04eb7dfa74eaaff82d1ee34cc91cb13645f339e5e5c4ef7c334db87d5d574fff1a99e4155aeceb501c31c06d85da4cdec11379e7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,62 +1,99 @@
|
|
1
1
|
# CS::WEBAUTOMATOR
|
2
2
|
|
3
|
-
|
3
|
+
A simple gem to generate web automation project with:
|
4
4
|
|
5
|
-
|
5
|
+
> Cucumber [(link)](https://cucumber.io/)
|
6
|
+
|
7
|
+
> Capybara [(link)](https://github.com/jnicklas/capybara)
|
8
|
+
|
9
|
+
> SitePrism [(link)](https://github.com/natritmeyer/site_prism)
|
10
|
+
|
11
|
+
> Selenium Webdriver [(link)](http://www.seleniumhq.org/)
|
12
|
+
|
13
|
+
The structure is based on three layers: features, steps and pages.
|
14
|
+
|
15
|
+
1. Features: Contains all the features of the project;
|
16
|
+
2. Steps: Contains all the steps implementations;
|
17
|
+
3. Pages: Contains all the pages in the website. A page must contain the declaration of all the elements of the page and the declaration of its actions.
|
18
|
+
|
19
|
+
## Instalation
|
20
|
+
|
21
|
+
Install it as:
|
6
22
|
|
7
23
|
$ gem install cs-webautomator
|
8
24
|
|
9
|
-
##
|
25
|
+
## Usage
|
10
26
|
|
11
|
-
|
27
|
+
In the terminal, type for help:
|
12
28
|
|
13
29
|
```
|
14
30
|
cs-webautomator
|
15
31
|
cs-webautomator generate
|
16
32
|
```
|
17
33
|
|
18
|
-
|
34
|
+
To see the gem version type:
|
19
35
|
|
20
36
|
```
|
21
37
|
cs-webautomator version
|
22
38
|
```
|
23
39
|
|
24
|
-
|
40
|
+
To generate a project type:
|
25
41
|
|
26
42
|
```
|
27
|
-
cs-webautomator new
|
43
|
+
cs-webautomator new ProjectName
|
28
44
|
```
|
29
45
|
|
30
|
-
|
31
|
-
|
32
|
-
Para gerar em inglês, por exemplo, utilize:
|
46
|
+
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:
|
33
47
|
|
34
48
|
```
|
35
|
-
cs-webautomator new
|
49
|
+
cs-webautomator new ProjectName --lang=pt
|
36
50
|
```
|
51
|
+
> The default language is English ('en'). The elements of Gherkin such as Given, When, Then, And, Scenario will be translated to all Gherkin supported languages, but this gem has just a few translation files (see that in folder: `lib/cs/webautomator/locales`).
|
52
|
+
|
53
|
+
> **CS-WEBAUTOMATOR doesn't support your mother language?** No problem. Fork it, create your yml translation file, uses the en.yml file as a template. Translate it and make a pull request. There are only 15 lines to be translated, this will take no time.
|
37
54
|
|
38
|
-
**
|
55
|
+
> **Want to 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.
|
39
56
|
|
40
|
-
|
57
|
+
Once the project is created, open its folder (`cd ProjectName`) and run `bundle install`
|
58
|
+
|
59
|
+
There are three generators that are responsible to create the templates for Features, Step definitions and Pages.
|
60
|
+
|
61
|
+
**The generators commands ONLY WORK in the ROOT FOLDER of the project.**
|
62
|
+
|
63
|
+
#### Features
|
41
64
|
|
42
65
|
```
|
43
|
-
cs-webautomator generate feature
|
66
|
+
cs-webautomator generate feature FeatureName
|
44
67
|
```
|
68
|
+
The feature generator will create a feature and its files. So this command will create the FeatureName.feature file inside the folder `features/specifications`, the file FeatureName_steps.rb inside the folder `features/step_definitions`, the files FeatureName_page.rb inside the folder `features/pages`.
|
45
69
|
|
46
|
-
|
47
|
-
|
48
|
-
####Steps
|
70
|
+
#### Steps
|
49
71
|
|
50
72
|
```
|
51
|
-
cs-webautomator generate step
|
73
|
+
cs-webautomator generate step StepName
|
52
74
|
```
|
53
|
-
|
75
|
+
The step generator will create a step file named StepName_steps.rb in the folder `features/step_definitions`
|
54
76
|
|
55
77
|
|
56
|
-
####Pages
|
78
|
+
#### Pages
|
57
79
|
|
58
80
|
```
|
59
81
|
cs-webautomator generate page PageName
|
60
82
|
```
|
61
83
|
|
62
|
-
|
84
|
+
The screen generator will create both Platform dependent screens in the folder `features/pages`
|
85
|
+
|
86
|
+
## TODO
|
87
|
+
|
88
|
+
1. Run tests in Remote Server
|
89
|
+
2. Run tests in Internet Explorer and Safari
|
90
|
+
3. Create base methods (click, set, etc) to use with elements
|
91
|
+
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
|
95
|
+
1. Fork it ( https://github.com/samycici/cs-webautomator/fork )
|
96
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
97
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
98
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
99
|
+
5. Create a new Pull Request
|
data/bin/cs-webautomator
CHANGED
@@ -19,7 +19,7 @@ module CS
|
|
19
19
|
desc 'feature [RESOURCE_NAME]', 'Generates a feature'
|
20
20
|
option :lang,
|
21
21
|
banner: 'any of the gherkin supported languages',
|
22
|
-
default: :
|
22
|
+
default: :en
|
23
23
|
def feature(name)
|
24
24
|
I18n.config.default_locale = options[:lang]
|
25
25
|
in_root_project_folder?
|
@@ -32,7 +32,7 @@ module CS
|
|
32
32
|
desc 'step [RESOURCE_NAME]', 'Generates a step'
|
33
33
|
option :lang,
|
34
34
|
banner: 'any of the gherkin supported languages',
|
35
|
-
default: :
|
35
|
+
default: :en
|
36
36
|
def step(name)
|
37
37
|
I18n.config.default_locale = options[:lang]
|
38
38
|
in_root_project_folder?
|
@@ -43,7 +43,7 @@ module CS
|
|
43
43
|
'Generates pages'
|
44
44
|
option :lang,
|
45
45
|
banner: 'any of the gherkin supported languages',
|
46
|
-
default: :
|
46
|
+
default: :en
|
47
47
|
def page(name)
|
48
48
|
I18n.config.default_locale = options[:lang]
|
49
49
|
in_root_project_folder?
|
@@ -80,7 +80,7 @@ module CS
|
|
80
80
|
'Capybara, SitePrism, Selenium and Cucumber'
|
81
81
|
option :lang,
|
82
82
|
banner: 'any of the gherkin supported languages',
|
83
|
-
default: :
|
83
|
+
default: :en
|
84
84
|
def new(name)
|
85
85
|
I18n.config.default_locale = options[:lang]
|
86
86
|
# Thor will be responsible to look for identical
|
data/lib/skeleton/README.md
CHANGED
@@ -1,96 +1,90 @@
|
|
1
|
-
##
|
1
|
+
## Getting Started ##
|
2
2
|
|
3
|
-
###
|
4
|
-
|
3
|
+
### Installing rbenv ###
|
4
|
+
Run this:
|
5
5
|
```shell
|
6
6
|
brew install rbenv
|
7
7
|
```
|
8
8
|
|
9
|
-
|
9
|
+
Add to ~/.bash_profile:
|
10
10
|
```shell
|
11
11
|
eval "$(rbenv init -)"
|
12
12
|
```
|
13
13
|
|
14
|
-
|
14
|
+
List all available versions:
|
15
15
|
```shell
|
16
16
|
rbenv install -l
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
Install a Ruby version:
|
20
20
|
```shell
|
21
21
|
rbenv install 2.3.1
|
22
22
|
```
|
23
23
|
|
24
|
-
|
25
|
-
Navegar para pasta desejada e executar o seguinte comando:
|
24
|
+
Sets a local application-specific Ruby 2.3.1:
|
26
25
|
```shell
|
27
26
|
rbenv local 2.3.1
|
28
27
|
```
|
29
28
|
|
30
|
-
###
|
31
|
-
|
29
|
+
### Installing bundler ###
|
30
|
+
Run this:
|
32
31
|
```shell
|
33
32
|
gem install bundler
|
34
33
|
```
|
35
34
|
|
36
|
-
###
|
37
|
-
|
35
|
+
### Installing gems ###
|
36
|
+
Run this:
|
38
37
|
```shell
|
39
38
|
bundle install
|
40
39
|
```
|
41
40
|
|
42
|
-
### Drivers
|
43
|
-
|
41
|
+
### Drivers: ###
|
42
|
+
Install [chromedriver](https://sites.google.com/a/chromium.org/chromedriver/) and [phantomjs](http://phantomjs.org/).
|
43
|
+
Remenber include in the PATH.
|
44
44
|
|
45
|
-
###
|
46
|
-
|
45
|
+
### Run tests in DEV with Chrome###
|
46
|
+
Run this in the tests folder:
|
47
47
|
```shell
|
48
48
|
bundle exec cucumber
|
49
49
|
```
|
50
50
|
|
51
|
-
###
|
52
|
-
|
51
|
+
### Run tests in DEV with Firefox###
|
52
|
+
Run this in the tests folder:
|
53
53
|
```shell
|
54
54
|
bundle exec cucumber -p firefox -p dev
|
55
55
|
```
|
56
56
|
|
57
|
-
###
|
58
|
-
|
57
|
+
### Run tests in DEV with Poltergeist###
|
58
|
+
Run this in the tests folder:
|
59
59
|
```shell
|
60
60
|
bundle exec cucumber -p poltergeist -p dev
|
61
61
|
```
|
62
62
|
|
63
|
-
###
|
64
|
-
|
63
|
+
### Run tests in HMG with Chrome###
|
64
|
+
Run this in the tests folder:
|
65
65
|
```shell
|
66
66
|
bundle exec cucumber -p chrome -p hmg
|
67
67
|
```
|
68
68
|
|
69
|
-
###
|
70
|
-
|
69
|
+
### Run tests in HMG with Firefox###
|
70
|
+
Run this in the tests folder:
|
71
71
|
```shell
|
72
72
|
bundle exec cucumber -p firefox -p hmg
|
73
73
|
```
|
74
|
-
###
|
75
|
-
|
74
|
+
### Run tests in HMG with Poltergeist###
|
75
|
+
Run this in the tests folder:
|
76
76
|
```shell
|
77
77
|
bundle exec cucumber -p poltergeist -p hmg
|
78
78
|
```
|
79
79
|
|
80
|
-
###
|
81
|
-
|
80
|
+
### HTML Report###
|
81
|
+
Run this in the tests folder:
|
82
82
|
```shell
|
83
83
|
bundle exec cucumber -p html_report
|
84
84
|
```
|
85
85
|
|
86
|
-
###
|
87
|
-
|
86
|
+
### Run with tags###
|
87
|
+
Run this in the tests folder:
|
88
88
|
```shell
|
89
89
|
bundle exec cucumber --tags @run
|
90
90
|
```
|
91
|
-
|
92
|
-
### Rodados specs de TDD###
|
93
|
-
Execute o seguinte comando dentro de TDD:
|
94
|
-
```shell
|
95
|
-
bundle exec rspec
|
96
|
-
```
|
@@ -7,11 +7,19 @@ require 'yaml'
|
|
7
7
|
require 'capybara/poltergeist'
|
8
8
|
|
9
9
|
BROWSER = ENV['BROWSER']
|
10
|
-
|
10
|
+
ENVIRONMENT_TYPE = ENV['ENVIRONMENT_TYPE']
|
11
11
|
|
12
|
+
## register driver according with browser chosen
|
12
13
|
Capybara.register_driver :selenium do |app|
|
13
14
|
if BROWSER.eql?('chrome')
|
14
|
-
Capybara::Selenium::Driver.new(app,
|
15
|
+
Capybara::Selenium::Driver.new(app,
|
16
|
+
:browser => :chrome,
|
17
|
+
:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(
|
18
|
+
'chromeOptions' => {
|
19
|
+
'args' => [ "--start-maximized" ]
|
20
|
+
}
|
21
|
+
)
|
22
|
+
)
|
15
23
|
elsif BROWSER.eql?('firefox')
|
16
24
|
Capybara::Selenium::Driver.new(app, :browser => :firefox)
|
17
25
|
elsif BROWSER.eql?('internet_explorer')
|
@@ -1,22 +1,32 @@
|
|
1
1
|
Before do |feature|
|
2
|
-
|
2
|
+
## variable which loads the data file according to the environment
|
3
|
+
CONFIG = YAML.load_file(File.dirname(__FILE__) + "/config/#{ENVIRONMENT_TYPE}.yaml")
|
4
|
+
|
5
|
+
## configure the chosen browser
|
3
6
|
Capybara.configure do |config|
|
4
7
|
config.default_driver = :selenium
|
5
8
|
end
|
9
|
+
|
10
|
+
## set default max wait and maximize browser
|
6
11
|
Capybara.default_max_wait_time = 20
|
12
|
+
Capybara.current_session.driver.browser.manage.window.maximize
|
7
13
|
end
|
8
14
|
|
9
15
|
After do |scenario|
|
16
|
+
|
17
|
+
## take screenshot if scenario fail
|
10
18
|
if scenario.failed?
|
11
|
-
|
12
|
-
|
13
|
-
Dir.mkdir(
|
19
|
+
folder = 'screenshots'
|
20
|
+
file = "#{folder}/#{scenario.name}.png"
|
21
|
+
Dir.mkdir(folder) unless File.exist?(folder)
|
14
22
|
if BROWSER.eql?('poltergeist')
|
15
|
-
Capybara.page.save_screenshot(
|
23
|
+
Capybara.page.save_screenshot(file)
|
16
24
|
else
|
17
|
-
Capybara.page.driver.browser.save_screenshot(
|
25
|
+
Capybara.page.driver.browser.save_screenshot(file)
|
18
26
|
end
|
19
27
|
end
|
28
|
+
|
29
|
+
## if the browser is different from poltergeist, kills instance
|
20
30
|
unless BROWSER.eql?('poltergeist')
|
21
31
|
Capybara.current_session.driver.quit
|
22
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cs-webautomator
|
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
|
- Samanta Cicilia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|