setupWatirCucumber 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb639037ec9ce5058b6ca7bc7581cd8ecb98f8e7
4
- data.tar.gz: 855db5befe50e7565543e6bd66652bd9c940e6b0
3
+ metadata.gz: f9ba5b26e9f353134dd91f37fb7cbb6cf7438268
4
+ data.tar.gz: 331550f1cdf7f981fa3338aba51b0a806a5dce7c
5
5
  SHA512:
6
- metadata.gz: 4730d296649aa9e2bea4ffc3c0ca8287e2fe04d8e24dedff6e6c7249b694853c4c80689f469a1e9f1c04e50e9b6819c39cd7d770653351687fffa23efa338118
7
- data.tar.gz: 45e4f951297faaf255e5bb5ee8e46892d202111a0ccf8c6e90326445cf469737e557ac06367711528ffd7c272bdf31c3b40742199052717faba0252c52a28ee2
6
+ metadata.gz: ca2018cb90aa433b5b6876f1134813a2d2321a4edffb0aa0c3e9e05937a185fd9760b4bccaed86db038b9a3d7864c489dcd8cf25279bab67fdf1ecbb2c1eaa41
7
+ data.tar.gz: 848d09050b54461a3d82d15964ca368223de6bc5154c6350f148a84f44a715a85bbc352b89754ed64b7f81acecc02021655883e7023a9d36e1cf1e599a6d0e74
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  After instalation then execute:
24
24
 
25
25
  ```
26
- $ setupWatirCucumber create --path "./"
26
+ $ setupWatirCucumber create --from "./"
27
27
  ```
28
28
 
29
29
  This command will configure the cucumber, will configure the env and hooks and finally create a scenario to test the installation
@@ -22,47 +22,83 @@ module SetupWatirCucumber
22
22
  def cucumber_init(path)
23
23
  puts "cucumber --int"
24
24
  system "cd #{path} && cucumber --init"
25
- puts "t"
26
25
  end
27
26
 
28
27
  def create_env(path)
29
28
  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)
29
+ File.open("#{path}/features/support/env.rb","w+") do |f|
30
+ f.write "require 'setupWatirCucumber'\n\nbrowser = Watir::Browser.new :chrome\nbrowser.driver.manage.window.maximize\n\nBefore do\n @browser = browser\nend\n\nat_exit do\n browser.cookies.clear\n browser.close\nend"
33
31
  end
32
+
34
33
  end
35
34
 
36
35
  def create_hooks(path)
37
36
  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)
37
+ File.open("#{path}/features/support/hooks.rb", "w+") do |f|
38
+ f.write '
39
+ Before do |scenario|
40
+ @path_screenshots = "screenshots/#{scenario.feature.name}/#{scenario.name}"
41
+ FileUtils.mkpath @path_screenshots
42
+ end
43
+
44
+ AfterStep do |step|
45
+ screenshot = "#{@path_screenshots}/#{Time.now.strftime("%d%m%Y%H%M")}.png"
46
+ @browser.screenshot.save(screenshot)
47
+ embed screenshot , "image/png"
48
+ end
49
+
50
+ After do |scenario|
51
+ @browser.cookies.clear rescue warn "No session to clear"
52
+ @browser.refresh
53
+ end'
41
54
  end
42
55
  end
43
56
 
44
57
  def create_config_yml(path)
45
58
  puts "configuring cucumber.yml file"
46
59
  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)
60
+ File.open("#{path}/config/cucumber.yml", "w+") do |f|
61
+ f.write "
62
+ # config/cucumber.yml
63
+ ##YAML Template
64
+ ---
65
+ html_report: --format pretty --format html --out=features_report.html"
50
66
  end
51
67
  end
52
68
 
53
69
  def create_base_scenario(path)
54
70
  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)
71
+ File.open("#{path}features/base.feature", "w+") do |f|
72
+ f.write '
73
+ Feature: Medium
74
+
75
+ Scenario: Find user Gederson Chiquesi
76
+ Given that I am in the website http://medium.com
77
+ When I search for GedersonChiquesi
78
+ Then I should see the user "Gederson Chiquesi"
79
+ '
58
80
  end
59
81
  end
60
82
 
61
83
  def create_base_step(path)
62
84
  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)
85
+ File.open("#{path}/features/step_definitions/base_steps.rb","w+") do |f|
86
+ f.write '
87
+ Given("that I am in the website http://medium.com") do
88
+ @browser.goto "http://medium.com"
89
+ expect(@browser.title).to eq("Medium – Read, write and share stories that matter")
90
+ end
91
+
92
+ When("I search for GedersonChiquesi") do
93
+ @browser.text_field(:class => "js-predictiveSearchInput").set "GedersonChiquesi"
94
+ end
95
+
96
+ Then("I should see the user {string}") do |string|
97
+ user = @browser.div.span(:class => "avatar-text").text
98
+ expect(user).to eq("Gederson Chiquesi")
99
+ puts user
100
+ end
101
+ '
66
102
  end
67
103
  end
68
104
  end
@@ -1,3 +1,3 @@
1
1
  module SetupWatirCucumber
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setupWatirCucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gederson Chiquesi