magneton 0.1.0 → 0.2.0
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/.gitignore +15 -0
- data/.rspec +4 -0
- data/Gemfile +4 -1
- data/README.md +15 -1
- data/Rakefile +8 -0
- data/circle.yml +16 -0
- data/lib/magneton/version.rb +1 -1
- data/lib/skeleton/.gitignore +5 -3
- data/lib/skeleton/Gemfile +7 -0
- data/lib/skeleton/README.md +1 -0
- data/lib/skeleton/Rakefile +29 -0
- data/lib/skeleton/features/support/env.rb +16 -10
- data/lib/skeleton/features/support/helper.rb +42 -10
- data/lib/skeleton/features/support/hooks.rb +8 -4
- data/lib/skeleton/features/support/matchers/custom.rb +18 -0
- data/magneton.gemspec +5 -4
- data/spec/magneton_test.rb +177 -0
- data/spec/spec_helper.rb +106 -0
- metadata +25 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb2b9e102bd2a4efe57d5afb37d6e7f1a1ac8016
|
4
|
+
data.tar.gz: 0cb260de62e63a6773607e094cf7633cfd10a17a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77a3ffb04df77dcc5f5135d0fe8ab6d7608bc2dacf78453387fa45c765c5317dea86efb9e08f22885fa0fdb739ef9ba8c2445b6808d6422c0c607dae89948ee2
|
7
|
+
data.tar.gz: fbe84b92cc29c31bf95045c6f7f2c312e2ea80f84da2e0ed4dd3107987f3e7dd89af768a2f88098f574338a5563c603207a1b8d02b3e3296d24efb3e14e1ea51
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in
|
3
|
+
# Specify your gem's dependencies in magneton.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'thor'
|
7
7
|
gem 'i18n'
|
8
8
|
gem 'json'
|
9
9
|
gem 'gherkin'
|
10
|
+
gem 'rspec'
|
11
|
+
gem "simplecov"
|
12
|
+
gem "codeclimate-test-reporter", "~> 1.0.0"
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# MAGNETON
|
1
|
+
# MAGNETON [](https://circleci.com/gh/concretesolutions/magneton) [](https://codeclimate.com/github/concretesolutions/magneton) [](https://codeclimate.com/github/concretesolutions/magneton/coverage) [](https://codeclimate.com/github/concretesolutions/magneton) [](https://badge.fury.io/rb/magneton)
|
2
2
|
|
3
3
|
A simple gem to generate web automation project with:
|
4
4
|
|
@@ -100,6 +100,20 @@ In the file `features/support/helper.rb` you will find utilities to help your te
|
|
100
100
|
Implemented so far:
|
101
101
|
- take_screenshot
|
102
102
|
- mouse_over
|
103
|
+
- visual matching
|
104
|
+
- crop screenshot
|
105
|
+
|
106
|
+
##### Visual Matching
|
107
|
+
|
108
|
+
You can compare images using the `visual_matcher` method:
|
109
|
+
`expect('imagem_atual').to visual_match('imagem_baseline')`
|
110
|
+
|
111
|
+
You can create the baseline_images if you include the tag `@create_baseline_image` on your scenarios.
|
112
|
+
|
113
|
+
##### Crop screenshot
|
114
|
+
|
115
|
+
You can crop a screenshot around element, just only use `take_screenshot_and_crop` method:
|
116
|
+
`take_screenshot_and_crop(name_file, folder_to_save, css_selector)`
|
103
117
|
|
104
118
|
## TODO
|
105
119
|
|
data/Rakefile
CHANGED
data/circle.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
machine:
|
2
|
+
ruby:
|
3
|
+
version: 2.3.0
|
4
|
+
environment:
|
5
|
+
CODECLIMATE_REPO_TOKEN: c992e4ea792ab168d686a2b1779b2adf2c95d64a47145c87d2ba50d70b398428
|
6
|
+
|
7
|
+
dependencies:
|
8
|
+
override:
|
9
|
+
- gem install bundler
|
10
|
+
- gem install rake
|
11
|
+
- bundle install
|
12
|
+
|
13
|
+
test:
|
14
|
+
override:
|
15
|
+
- bundle exec rake spec_tests
|
16
|
+
- bundle exec codeclimate-test-reporter
|
data/lib/magneton/version.rb
CHANGED
data/lib/skeleton/.gitignore
CHANGED
data/lib/skeleton/Gemfile
CHANGED
data/lib/skeleton/README.md
CHANGED
@@ -62,6 +62,7 @@ Install and include in PATH
|
|
62
62
|
- [chromedriver](https://sites.google.com/a/chromium.org/chromedriver/)
|
63
63
|
- [phantomjs](http://phantomjs.org/)
|
64
64
|
- [internetExplorerDriver](http://www.seleniumhq.org/download/)
|
65
|
+
- [Firefox Geckodriver](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver)
|
65
66
|
|
66
67
|
Install [Webdriver Safari extension](http://selenium-release.storage.googleapis.com/2.48/SafariDriver.safariextz).
|
67
68
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
desc "Executar os testes em dev usando o Chrome"
|
2
|
+
task :test_chrome_dev do
|
3
|
+
puts "Executando test:chrome:dev"
|
4
|
+
sh "bundle exec cucumber -p chrome -p dev"
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "Executar os testes em dev usando o Firefox"
|
8
|
+
task :test_firefox_dev do
|
9
|
+
puts "Executando test:firefox:dev"
|
10
|
+
sh "bundle exec cucumber -p firefox -p dev"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Executar os testes em dev usando o Safari"
|
14
|
+
task :test_safari_dev do
|
15
|
+
puts "Executando test:safari:dev"
|
16
|
+
sh "bundle exec cucumber -p safari -p dev"
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Executar os testes em dev usando o Poltergeist"
|
20
|
+
task :test_poltergeist_dev do
|
21
|
+
puts "Executando test:poltergeist:dev"
|
22
|
+
sh "bundle exec cucumber -p poltergeist -p dev"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Executar os testes em dev usando o Internet Explorer"
|
26
|
+
task :test_internet_explorer_dev do
|
27
|
+
puts "Executando test:internet_explorer:dev"
|
28
|
+
sh "bundle exec cucumber -p internet_explorer -p dev"
|
29
|
+
end
|
@@ -5,6 +5,12 @@ require 'site_prism'
|
|
5
5
|
require 'rspec'
|
6
6
|
require 'yaml'
|
7
7
|
require 'capybara/poltergeist'
|
8
|
+
require 'fileutils'
|
9
|
+
require "i18n"
|
10
|
+
require_relative 'helper.rb'
|
11
|
+
require 'imatcher'
|
12
|
+
require 'chunky_png'
|
13
|
+
require 'os'
|
8
14
|
|
9
15
|
BROWSER = ENV['BROWSER']
|
10
16
|
ENVIRONMENT_TYPE = ENV['ENVIRONMENT_TYPE']
|
@@ -12,22 +18,22 @@ ENVIRONMENT_TYPE = ENV['ENVIRONMENT_TYPE']
|
|
12
18
|
## register driver according with browser chosen
|
13
19
|
Capybara.register_driver :selenium do |app|
|
14
20
|
if BROWSER.eql?('chrome')
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
'args' => [ "--start-maximized" ]
|
20
|
-
}
|
21
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
|
22
|
+
'chromeOptions' => {
|
23
|
+
"args" => [ "--window-size=1600,1300"]
|
24
|
+
}
|
21
25
|
)
|
22
|
-
|
26
|
+
Capybara::Selenium::Driver.new(app, {:browser => :chrome, :desired_capabilities => caps})
|
23
27
|
elsif BROWSER.eql?('firefox')
|
24
|
-
Capybara::Selenium::Driver.new(app, :
|
28
|
+
Capybara::Selenium::Driver.new(app, browser: :firefox)
|
25
29
|
elsif BROWSER.eql?('internet_explorer')
|
26
|
-
Capybara::Selenium::Driver.new(app, :
|
30
|
+
Capybara::Selenium::Driver.new(app, browser: :internet_explorer)
|
27
31
|
elsif BROWSER.eql?('safari')
|
28
|
-
Capybara::Selenium::Driver.new(app, :
|
32
|
+
Capybara::Selenium::Driver.new(app, browser: :safari)
|
29
33
|
elsif BROWSER.eql?('poltergeist')
|
30
34
|
options = { js_errors: false }
|
31
35
|
Capybara::Poltergeist::Driver.new(app, options)
|
32
36
|
end
|
33
37
|
end
|
38
|
+
|
39
|
+
IMATCHER = Imatcher::Matcher.new mode: :grayscale, tolerance: 1
|
@@ -1,19 +1,51 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# !/usr/bin/env ruby
|
3
|
-
require 'fileutils'
|
4
3
|
class Helper
|
5
4
|
def mouse_over(element_selector)
|
6
5
|
element = Capybara.page.driver.browser.find_element(:css, element_selector)
|
7
6
|
Capybara.page.driver.browser.mouse.move_to element
|
8
7
|
end
|
9
8
|
|
10
|
-
def take_screenshot(name_file, folder='screenshots/test_screens')
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
def take_screenshot(name_file, folder = 'screenshots/test_screens')
|
10
|
+
file = "#{folder}/#{name_file}.png"
|
11
|
+
FileUtils.mkdir_p(folder) unless File.exist?(folder)
|
12
|
+
if BROWSER.eql?('poltergeist')
|
13
|
+
Capybara.page.save_screenshot(file)
|
14
|
+
else
|
15
|
+
Capybara.page.driver.browser.save_screenshot(file)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def take_screenshot_and_crop(name_file, folder = 'screenshots/croped_files', css_element_crop)
|
20
|
+
file = "#{folder}/#{name_file}.png"
|
21
|
+
FileUtils.mkdir_p(folder) unless File.exist?(folder)
|
22
|
+
#scroll to element
|
23
|
+
element = Capybara.page.driver.browser.find_element(:css, css_element_crop)
|
24
|
+
element.location_once_scrolled_into_view
|
25
|
+
|
26
|
+
# get location and size of element
|
27
|
+
location = element.location
|
28
|
+
size = element.size
|
29
|
+
|
30
|
+
# take original screenshot
|
31
|
+
take_screenshot('image_to_crop')
|
32
|
+
|
33
|
+
# read original screenshot
|
34
|
+
image = ChunkyPNG::Image.from_file('screenshots/test_screens/image_to_crop.png')
|
35
|
+
|
36
|
+
# get X, Y, width and height
|
37
|
+
left = location['x']
|
38
|
+
top = location['y']
|
39
|
+
right = size['width']
|
40
|
+
bottom = size['height']
|
41
|
+
|
42
|
+
# crop original image and save
|
43
|
+
# crop original image
|
44
|
+
if OS.mac?
|
45
|
+
image.crop!(left * 2 , top * 2, right * 2, bottom * 2)
|
46
|
+
else
|
47
|
+
image.crop!(left , top, right, bottom)
|
48
|
+
end
|
49
|
+
image.save(file)
|
50
|
+
end
|
19
51
|
end
|
@@ -4,6 +4,8 @@ Before do |feature|
|
|
4
4
|
## variable which loads the data file according to the environment
|
5
5
|
CONFIG = YAML.load_file(File.dirname(__FILE__) + "/config/#{ENVIRONMENT_TYPE}.yaml")
|
6
6
|
|
7
|
+
I18n.config.available_locales = :en
|
8
|
+
|
7
9
|
## configure the chosen browser
|
8
10
|
Capybara.configure do |config|
|
9
11
|
config.default_driver = :selenium
|
@@ -22,8 +24,10 @@ After do |scenario|
|
|
22
24
|
if scenario.failed?
|
23
25
|
@helper.take_screenshot(scenario.name, 'screenshots/test_failed')
|
24
26
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
end
|
28
|
+
|
29
|
+
After('@create_baseline_image') do |scenario|
|
30
|
+
# Add screenshot to baseline folder.
|
31
|
+
@helper = Helper.new
|
32
|
+
@helper.take_screenshot(scenario.name, 'screenshots/baseline')
|
29
33
|
end
|
@@ -11,3 +11,21 @@ RSpec::Matchers.define :all_list_elements_eq do |expected|
|
|
11
11
|
"expected that all elements in #{actual} list would be equals #{expected}"
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
RSpec::Matchers.define :visual_match do |expected|
|
16
|
+
match do |actual|
|
17
|
+
base_path = File.expand_path(".", Dir.pwd) + '/screenshots/'
|
18
|
+
file_atual = File.join(base_path, 'current_images/') + actual + '.png'
|
19
|
+
file_baseline = File.join(base_path, 'baseline/') + expected + '.png'
|
20
|
+
file_diff = File.join(base_path, 'diffs/') + actual + '_diff_' + expected + '.png'
|
21
|
+
comparison = IMATCHER.compare(file_atual, file_baseline)
|
22
|
+
@score = comparison.score
|
23
|
+
if comparison.match? != true
|
24
|
+
comparison.difference_image.save(file_diff)
|
25
|
+
end
|
26
|
+
expect(comparison.match?).to be true
|
27
|
+
end
|
28
|
+
failure_message_for_should do |actual|
|
29
|
+
"expected that two images are equals, but they are #{@score} different"
|
30
|
+
end
|
31
|
+
end
|
data/magneton.gemspec
CHANGED
@@ -18,9 +18,10 @@ 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', '
|
21
|
+
spec.add_runtime_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_runtime_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_runtime_dependency 'thor', '~> 0.19'
|
24
|
+
spec.add_runtime_dependency 'i18n', '~> 0.6'
|
25
25
|
spec.add_runtime_dependency 'gherkin', '2.12.2'
|
26
|
+
|
26
27
|
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
4
|
+
|
5
|
+
describe 'MAGNETON' do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@project_name = 'web_automator'
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:each) do
|
12
|
+
FileUtils.rm_rf(@project_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'Magneton gem commands test' do
|
16
|
+
context 'Create new project using default command' do
|
17
|
+
it 'Returns project created with all files' do
|
18
|
+
system "magneton new #{@project_name}"
|
19
|
+
|
20
|
+
expect(Dir.entries(@project_name)).to include('.gitignore', 'Gemfile', 'README.md', 'cucumber.yml', 'features', 'readme_img')
|
21
|
+
expect(Dir.entries("#{@project_name}/features")).to include('pages', 'specifications', 'steps_definitions', 'support')
|
22
|
+
expect(Dir.entries("#{@project_name}/features/pages")).to include('.gitkeep')
|
23
|
+
expect(Dir.entries("#{@project_name}/features/specifications")).to include('.gitkeep')
|
24
|
+
expect(Dir.entries("#{@project_name}/features/steps_definitions")).to include('.gitkeep')
|
25
|
+
expect(Dir.entries("#{@project_name}/features/support")).to include('config', 'env.rb', 'helper.rb', 'hooks.rb', 'matchers')
|
26
|
+
expect(Dir.entries("#{@project_name}/features/support/config")).to include('dev.yaml', 'hmg.yaml')
|
27
|
+
expect(Dir.entries("#{@project_name}/features/support/matchers")).to include('custom.rb')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'Try creates new project with a invalid argument' do
|
32
|
+
it 'Project will not be generated' do
|
33
|
+
system "magneton new '#{@project_name}' invalid argument"
|
34
|
+
|
35
|
+
expect(Dir.entries(".")).not_to include("#{@project_name}")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'Using I18n to translate files' do
|
40
|
+
it 'Generates a feature using I18n to portuguese language' do
|
41
|
+
system "magneton new '#{@project_name}'"
|
42
|
+
|
43
|
+
feature_name = 'magneton'
|
44
|
+
|
45
|
+
Dir.chdir(@project_name)
|
46
|
+
|
47
|
+
system "magneton generate feature '#{feature_name}' --lang=pt"
|
48
|
+
|
49
|
+
Dir.chdir('../')
|
50
|
+
|
51
|
+
expect(File.readlines("#{@project_name}/features/specifications/#{feature_name}.feature")).
|
52
|
+
to include("# language: pt\n", "Funcionalidade: #{feature_name.capitalize}\n", "\n", " Contexto:\n", " # Insira os passos\n", "\n", " Cenário: Primeiro Cenário\n", " # Insira os passos\n")
|
53
|
+
expect(File.readlines("#{@project_name}/features/steps_definitions/#{feature_name}_steps.rb")).
|
54
|
+
to include("######### DADO #########\n", "\n", "######### QUANDO #########\n", "\n", "######### ENTãO #########\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'Generates a feature using english language' do
|
58
|
+
system "magneton new '#{@project_name}'"
|
59
|
+
|
60
|
+
feature_name = 'magneton'
|
61
|
+
|
62
|
+
Dir.chdir(@project_name)
|
63
|
+
|
64
|
+
system "magneton generate feature '#{feature_name}'"
|
65
|
+
|
66
|
+
Dir.chdir('../')
|
67
|
+
|
68
|
+
expect(File.readlines("#{@project_name}/features/specifications/#{feature_name}.feature")).
|
69
|
+
to include("# language: en\n", "Feature: #{feature_name.capitalize}\n", "\n", " Background:\n", " # Insert steps\n", "\n", " Scenario: First Scenario\n", " # Insert steps\n")
|
70
|
+
expect(File.readlines("#{@project_name}/features/steps_definitions/#{feature_name}_steps.rb")).
|
71
|
+
to include("######### GIVEN #########\n", "\n", "######### WHEN #########\n", "\n", "######### THEN #########\n")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'This command should generates a Feature(all files)' do
|
76
|
+
it 'Generate a feature' do
|
77
|
+
system "magneton new '#{@project_name}'"
|
78
|
+
|
79
|
+
Dir.chdir(@project_name)
|
80
|
+
|
81
|
+
feature_name = 'magneton'
|
82
|
+
|
83
|
+
system "magneton generate feature '#{feature_name}'"
|
84
|
+
|
85
|
+
Dir.chdir('../')
|
86
|
+
|
87
|
+
expect(Dir.entries("#{@project_name}/features/specifications")).to include("#{feature_name}.feature")
|
88
|
+
expect(Dir.entries("#{@project_name}/features/steps_definitions")).to include("#{feature_name}_steps.rb")
|
89
|
+
expect(Dir.entries("#{@project_name}/features/pages")).to include("#{feature_name}_page.rb")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'Try Generates a feature with a invalid argument' do
|
94
|
+
it 'Feature will be not created' do
|
95
|
+
system "magneton new '#{@project_name}'"
|
96
|
+
|
97
|
+
feature_name = 'magneton'
|
98
|
+
|
99
|
+
Dir.chdir(@project_name)
|
100
|
+
|
101
|
+
system "magneton generate feature '#{feature_name}' invalid_argument"
|
102
|
+
|
103
|
+
Dir.chdir('../')
|
104
|
+
|
105
|
+
expect(Dir.entries("#{@project_name}/features/specifications")).not_to include("#{feature_name}.feature")
|
106
|
+
expect(Dir.entries("#{@project_name}/features/steps_definitions")).not_to include("#{feature_name}_steps.rb")
|
107
|
+
expect(Dir.entries("#{@project_name}/features/pages")).not_to include("#{feature_name}_page.rb")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'Generates a page' do
|
112
|
+
it 'Comamand cant generates .feature and steps_definition files ' do
|
113
|
+
system "magneton new #{@project_name}"
|
114
|
+
|
115
|
+
feature_name = 'magneton'
|
116
|
+
|
117
|
+
Dir.chdir(@project_name)
|
118
|
+
|
119
|
+
system "magneton generate page #{feature_name}"
|
120
|
+
|
121
|
+
Dir.chdir('../')
|
122
|
+
|
123
|
+
expect(Dir.entries("#{@project_name}/features/specifications")).not_to include("#{feature_name}.feature")
|
124
|
+
expect(Dir.entries("#{@project_name}/features/steps_definitions")).not_to include("#{feature_name}_steps.rb")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'Try Generates a feature with a invalid argument' do
|
129
|
+
it 'Page will be not created' do
|
130
|
+
system "magneton new #{@project_name}"
|
131
|
+
|
132
|
+
feature_name = 'magneton'
|
133
|
+
|
134
|
+
Dir.chdir(@project_name)
|
135
|
+
|
136
|
+
system "magneton generate page #{feature_name} invalid_argument"
|
137
|
+
|
138
|
+
Dir.chdir('../')
|
139
|
+
|
140
|
+
expect(Dir.entries("#{@project_name}/features/pages")).not_to include("#{feature_name}_page.rb")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context 'Generates a step definition' do
|
145
|
+
it 'Comamand cant generates .feature and page files ' do
|
146
|
+
system "magneton new #{@project_name}"
|
147
|
+
|
148
|
+
feature_name = 'magneton'
|
149
|
+
|
150
|
+
Dir.chdir(@project_name)
|
151
|
+
|
152
|
+
system "magneton generate step #{feature_name}"
|
153
|
+
|
154
|
+
Dir.chdir('../')
|
155
|
+
|
156
|
+
expect(Dir.entries("#{@project_name}/features/specifications")).not_to include("#{feature_name}.feature")
|
157
|
+
expect(Dir.entries("#{@project_name}/features/pages")).not_to include("#{feature_name}_page.rb")
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'Try Generates a step with a invalid argument' do
|
162
|
+
it 'Step will be not created' do
|
163
|
+
system "magneton new #{@project_name}"
|
164
|
+
|
165
|
+
feature_name = 'magneton'
|
166
|
+
|
167
|
+
Dir.chdir(@project_name)
|
168
|
+
|
169
|
+
system "magneton generate step #{feature_name} invalid_argument"
|
170
|
+
|
171
|
+
Dir.chdir('../')
|
172
|
+
|
173
|
+
expect(Dir.entries("#{@project_name}/features/steps_definitions")).not_to include("#{feature_name}_steps.rb")
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
require 'simplecov'
|
20
|
+
SimpleCov.start
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# rspec-expectations config goes here. You can use an alternate
|
24
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
25
|
+
# assertions if you prefer.
|
26
|
+
config.expect_with :rspec do |expectations|
|
27
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
28
|
+
# and `failure_message` of custom matchers include text for helper methods
|
29
|
+
# defined using `chain`, e.g.:
|
30
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
31
|
+
# # => "be bigger than 2 and smaller than 4"
|
32
|
+
# ...rather than:
|
33
|
+
# # => "be bigger than 2"
|
34
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
35
|
+
end
|
36
|
+
|
37
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
38
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
39
|
+
config.mock_with :rspec do |mocks|
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
41
|
+
# a real object. This is generally recommended, and will default to
|
42
|
+
# `true` in RSpec 4.
|
43
|
+
mocks.verify_partial_doubles = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
47
|
+
# have no way to turn it off -- the option exists only for backwards
|
48
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
49
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
50
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
51
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
52
|
+
|
53
|
+
# The settings below are suggested to provide a good initial experience
|
54
|
+
# with RSpec, but feel free to customize to your heart's content.
|
55
|
+
=begin
|
56
|
+
# This allows you to limit a spec run to individual examples or groups
|
57
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
58
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
59
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
60
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
61
|
+
config.filter_run_when_matching :focus
|
62
|
+
|
63
|
+
# Allows RSpec to persist some state between runs in order to support
|
64
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
65
|
+
# you configure your source control system to ignore this file.
|
66
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
67
|
+
|
68
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
69
|
+
# recommended. For more details, see:
|
70
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
71
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
72
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
73
|
+
config.disable_monkey_patching!
|
74
|
+
|
75
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
76
|
+
# be too noisy due to issues in dependencies.
|
77
|
+
config.warnings = true
|
78
|
+
|
79
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
80
|
+
# file, and it's useful to allow more verbose output when running an
|
81
|
+
# individual spec file.
|
82
|
+
if config.files_to_run.one?
|
83
|
+
# Use the documentation formatter for detailed output,
|
84
|
+
# unless a formatter has already been configured
|
85
|
+
# (e.g. via a command-line flag).
|
86
|
+
config.default_formatter = 'doc'
|
87
|
+
end
|
88
|
+
|
89
|
+
# Print the 10 slowest examples and example groups at the
|
90
|
+
# end of the spec run, to help surface which specs are running
|
91
|
+
# particularly slow.
|
92
|
+
config.profile_examples = 10
|
93
|
+
|
94
|
+
# Run specs in random order to surface order dependencies. If you find an
|
95
|
+
# order dependency and want to debug it, you can fix the order by providing
|
96
|
+
# the seed, which is printed after each run.
|
97
|
+
# --seed 1234
|
98
|
+
config.order = :random
|
99
|
+
|
100
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
101
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
102
|
+
# test failures related to randomization by passing the same `--seed` value
|
103
|
+
# as the one that triggered the failure.
|
104
|
+
Kernel.srand config.seed
|
105
|
+
=end
|
106
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magneton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2016-11-06 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
|
-
version: 0.19
|
47
|
+
version: '0.19'
|
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
|
-
version: 0.19
|
54
|
+
version: '0.19'
|
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
|
-
version: 0.6
|
61
|
+
version: '0.6'
|
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
|
-
version: 0.6
|
68
|
+
version: '0.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gherkin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,12 +89,15 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
92
94
|
- Gemfile
|
93
95
|
- LICENSE.txt
|
94
96
|
- README.md
|
95
97
|
- Rakefile
|
96
98
|
- bin/magneton
|
97
99
|
- bin/magneton-helpers.rb
|
100
|
+
- circle.yml
|
98
101
|
- lib/magneton/locales/en.yml
|
99
102
|
- lib/magneton/locales/pt.yml
|
100
103
|
- lib/magneton/magneton.rb
|
@@ -102,6 +105,7 @@ files:
|
|
102
105
|
- lib/skeleton/.gitignore
|
103
106
|
- lib/skeleton/Gemfile
|
104
107
|
- lib/skeleton/README.md
|
108
|
+
- lib/skeleton/Rakefile
|
105
109
|
- lib/skeleton/cucumber.yml
|
106
110
|
- lib/skeleton/features/pages/.gitkeep
|
107
111
|
- lib/skeleton/features/specifications/.gitkeep
|
@@ -114,10 +118,14 @@ files:
|
|
114
118
|
- lib/skeleton/features/support/matchers/custom.rb
|
115
119
|
- lib/skeleton/readme_img/step_1.png
|
116
120
|
- lib/skeleton/readme_img/step_2.png
|
121
|
+
- lib/skeleton/screenshots/.gitkeep
|
122
|
+
- lib/skeleton/screenshots/baseline/.gitkeep
|
117
123
|
- lib/templates/feature.tt
|
118
124
|
- lib/templates/page.tt
|
119
125
|
- lib/templates/steps.tt
|
120
126
|
- magneton.gemspec
|
127
|
+
- spec/magneton_test.rb
|
128
|
+
- spec/spec_helper.rb
|
121
129
|
homepage: https://github.com/concretesolutions/magneton
|
122
130
|
licenses:
|
123
131
|
- MIT
|
@@ -143,4 +151,6 @@ signing_key:
|
|
143
151
|
specification_version: 4
|
144
152
|
summary: Generates an Web Test Automation project with Cucumber, SitePrism, Capybara
|
145
153
|
and Selenium.
|
146
|
-
test_files:
|
154
|
+
test_files:
|
155
|
+
- spec/magneton_test.rb
|
156
|
+
- spec/spec_helper.rb
|