setupWatirCucumber 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eb639037ec9ce5058b6ca7bc7581cd8ecb98f8e7
4
+ data.tar.gz: 855db5befe50e7565543e6bd66652bd9c940e6b0
5
+ SHA512:
6
+ metadata.gz: 4730d296649aa9e2bea4ffc3c0ca8287e2fe04d8e24dedff6e6c7249b694853c4c80689f469a1e9f1c04e50e9b6819c39cd7d770653351687fffa23efa338118
7
+ data.tar.gz: 45e4f951297faaf255e5bb5ee8e46892d202111a0ccf8c6e90326445cf469737e557ac06367711528ffd7c272bdf31c3b40742199052717faba0252c52a28ee2
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ Gemfile.lock
13
+ pkg/*
14
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.16.0
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at geehchiquesi@hotmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in setupWatirCucumber.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Gederson Chiquesi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,47 @@
1
+ # SetupWatirCucumber
2
+
3
+ A gem for setup BDD automation with [Cucumber](https://github.com/cucumber/cucumber) and [Watir](https://github.com/watir/watir) Framework
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'setupWatirCucumber'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install setupWatirCucumber
20
+
21
+ ## Usage
22
+
23
+ After instalation then execute:
24
+
25
+ ```
26
+ $ setupWatirCucumber create --path "./"
27
+ ```
28
+
29
+ This command will configure the cucumber, will configure the env and hooks and finally create a scenario to test the installation
30
+
31
+ Now execute:
32
+
33
+ ```
34
+ $ cucumber -p html_report
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/GedersonChiquesi/setupWatirCucumber. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
44
+
45
+ ## Code of Conduct
46
+
47
+ Everyone interacting in the SetupWatirCucumber project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/GedersonChiquesi/setupWatirCucumber/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "setupWatirCucumber"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "setupWatirCucumber"
4
+
5
+ SetupWatirCucumber::CLI.start ( ARGV )
@@ -0,0 +1,78 @@
1
+ require "setupWatirCucumber/version"
2
+ require "watir"
3
+ require "rspec"
4
+ require 'cucumber'
5
+ require 'thor'
6
+
7
+ module SetupWatirCucumber
8
+ class CucumberInit
9
+ def initialize(path)
10
+ init(path)
11
+ end
12
+
13
+ def init(path)
14
+ cucumber_init(path)
15
+ create_env(path)
16
+ create_hooks(path)
17
+ create_config_yml(path)
18
+ create_base_scenario(path)
19
+ create_base_step(path)
20
+ end
21
+
22
+ def cucumber_init(path)
23
+ puts "cucumber --int"
24
+ system "cd #{path} && cucumber --init"
25
+ puts "t"
26
+ end
27
+
28
+ def create_env(path)
29
+ puts "Configuring env.rb file"
30
+ dir_folder = "#{path}/features/support/"
31
+ Dir["lib/setupWatirCucumber/folder_cp/env.rb"].each do |file|
32
+ FileUtils.cp(file,dir_folder)
33
+ end
34
+ end
35
+
36
+ def create_hooks(path)
37
+ puts "Configuring hooks.rb file"
38
+ dir_folder = "#{path}/features/support/"
39
+ Dir["lib/setupWatirCucumber/folder_cp/hooks.rb"].each do |file|
40
+ FileUtils.cp(file,dir_folder)
41
+ end
42
+ end
43
+
44
+ def create_config_yml(path)
45
+ puts "configuring cucumber.yml file"
46
+ system "mkdir #{path}/config/"
47
+ dir_folder = "#{path}/config/"
48
+ Dir["lib/setupWatirCucumber/folder_cp/cucumber.yml"].each do |file|
49
+ FileUtils.cp(file,dir_folder)
50
+ end
51
+ end
52
+
53
+ def create_base_scenario(path)
54
+ puts "Configuring base.feature file"
55
+ dir_folder = "#{path}/features/"
56
+ Dir["lib/setupWatirCucumber/folder_cp/base.feature"].each do |file|
57
+ FileUtils.cp(file,dir_folder)
58
+ end
59
+ end
60
+
61
+ def create_base_step(path)
62
+ puts "configuring base_steps.rb file"
63
+ dir_folder = "#{path}/features/step_definitions"
64
+ Dir["lib/setupWatirCucumber/folder_cp/base_steps.rb"].each do |file|
65
+ FileUtils.cp(file,dir_folder)
66
+ end
67
+ end
68
+ end
69
+
70
+ class CLI < Thor
71
+ desc 'create --from "{location}"', "where the setup will be created"
72
+ option :from
73
+ def create()
74
+ raise "Not location set, please set location with --from" unless options[:from]
75
+ SetupWatirCucumber::CucumberInit.new options[:from]
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,10 @@
1
+ Feature: Medium
2
+
3
+ Scenario: Find user Gederson Chiquesi
4
+ Given that I am in the website http://medium.com
5
+ When I search for GedersonChiquesi
6
+ Then I should see the user "Gederson Chiquesi"
7
+
8
+
9
+
10
+
@@ -0,0 +1,14 @@
1
+ Given("that I am in the website http://medium.com") do
2
+ @browser.goto "http://medium.com"
3
+ expect(@browser.title).to eq("Medium – Read, write and share stories that matter")
4
+ end
5
+
6
+ When("I search for GedersonChiquesi") do
7
+ @browser.text_field(:class => "js-predictiveSearchInput").set "GedersonChiquesi"
8
+ end
9
+
10
+ Then("I should see the user {string}") do |string|
11
+ user = @browser.div.span(:class => "avatar-text").text
12
+ expect(user).to eq("Gederson Chiquesi")
13
+ puts user
14
+ end
@@ -0,0 +1,4 @@
1
+ # config/cucumber.yml
2
+ ##YAML Template
3
+ ---
4
+ html_report: --format pretty --format html --out=features_report.html
@@ -0,0 +1,13 @@
1
+ require 'setupWatirCucumber'
2
+
3
+ browser = Watir::Browser.new :chrome
4
+ browser.driver.manage.window.maximize
5
+
6
+ Before do
7
+ @browser = browser
8
+ end
9
+
10
+ at_exit do
11
+ browser.cookies.clear
12
+ browser.close
13
+ end
@@ -0,0 +1,15 @@
1
+ Before do |scenario|
2
+ @path_screenshots = "screenshots/#{scenario.feature.name}/#{scenario.name}"
3
+ FileUtils.mkpath @path_screenshots
4
+ end
5
+
6
+ AfterStep do |step|
7
+ screenshot = "#{@path_screenshots}/#{Time.now.strftime("%d%m%Y%H%M")}.png"
8
+ @browser.screenshot.save(screenshot)
9
+ embed screenshot , 'image/png'
10
+ end
11
+
12
+ After do |scenario|
13
+ @browser.cookies.clear rescue warn 'No session to clear'
14
+ @browser.refresh
15
+ end
@@ -0,0 +1,3 @@
1
+ module SetupWatirCucumber
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "setupWatirCucumber/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "setupWatirCucumber"
8
+ spec.version = SetupWatirCucumber::VERSION
9
+ spec.authors = ["Gederson Chiquesi"]
10
+ spec.email = ["geehchiquesi@hotmail.com"]
11
+
12
+ spec.summary = "A gem for setup BDD automation with cucumber and Watir Framework"
13
+ spec.description = "A gem for setup BDD automation with cucumber and Watir Framework, create a env with initialize browser :chrome"
14
+ spec.homepage = "https://github.com/GedersonChiquesi/setupWatirCucumber"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
+ f.match(%r{^(test|spec|features)/})
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.16"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_dependency 'rspec', '~> 3.7', '~> 3.0'
31
+ spec.add_dependency 'cucumber', '~> 3.1', '>= 3.1.0'
32
+ spec.add_dependency "watir", "~> 6.10"
33
+ spec.add_dependency 'chromedriver-helper', '~> 1.1', '>= 1.1.0'
34
+ spec.add_dependency "thor", "~> 0.20"
35
+
36
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: setupWatirCucumber
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gederson Chiquesi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-07 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.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
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: :development
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.7'
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '3.7'
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: cucumber
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.1'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 3.1.0
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '3.1'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 3.1.0
81
+ - !ruby/object:Gem::Dependency
82
+ name: watir
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '6.10'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '6.10'
95
+ - !ruby/object:Gem::Dependency
96
+ name: chromedriver-helper
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.1'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 1.1.0
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.1'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 1.1.0
115
+ - !ruby/object:Gem::Dependency
116
+ name: thor
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: '0.20'
122
+ type: :runtime
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: '0.20'
129
+ description: A gem for setup BDD automation with cucumber and Watir Framework, create
130
+ a env with initialize browser :chrome
131
+ email:
132
+ - geehchiquesi@hotmail.com
133
+ executables:
134
+ - setupWatirCucumber
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - ".gitignore"
139
+ - ".rspec"
140
+ - ".travis.yml"
141
+ - CODE_OF_CONDUCT.md
142
+ - Gemfile
143
+ - LICENSE.txt
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - exe/setupWatirCucumber
149
+ - lib/setupWatirCucumber.rb
150
+ - lib/setupWatirCucumber/folder_cp/base.feature
151
+ - lib/setupWatirCucumber/folder_cp/base_steps.rb
152
+ - lib/setupWatirCucumber/folder_cp/cucumber.yml
153
+ - lib/setupWatirCucumber/folder_cp/env.rb
154
+ - lib/setupWatirCucumber/folder_cp/hooks.rb
155
+ - lib/setupWatirCucumber/version.rb
156
+ - setupWatirCucumber.gemspec
157
+ homepage: https://github.com/GedersonChiquesi/setupWatirCucumber
158
+ licenses:
159
+ - MIT
160
+ metadata: {}
161
+ post_install_message:
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 2.5.2
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: A gem for setup BDD automation with cucumber and Watir Framework
181
+ test_files: []