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 +4 -4
- data/README.md +1 -1
- data/lib/setupWatirCucumber.rb +52 -16
- data/lib/setupWatirCucumber/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9ba5b26e9f353134dd91f37fb7cbb6cf7438268
|
4
|
+
data.tar.gz: 331550f1cdf7f981fa3338aba51b0a806a5dce7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 --
|
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
|
data/lib/setupWatirCucumber.rb
CHANGED
@@ -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
|
-
|
31
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
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
|