tchandy-watircuke 0.4.2 → 0.4.3

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.
@@ -1,114 +1,109 @@
1
- module Watircuke
2
- module Steps
3
- module EN
4
- #
5
- # Browsing
6
- #
7
- Given /^I am on (.+)$/ do |page_name|
8
- @browser.goto(path_to(page_name))
9
- end
10
-
11
- When /^I (visit|go to) the (.+)$/ do |_, text|
12
- @browser.goto(@environment + text)
13
- end
14
-
15
- When /^I (click|follow) "([^\"]*)"$/ do |_, id|
16
- link = @browser.link(:text, id).click rescue @browser.link(:id, id).click
17
- end
18
-
19
- Then /^I should be on (.+)$/ do |page_name|
20
- URI.parse(@browser.url).path.should == path_to(page_name)
21
- end
22
-
23
- #
24
- # Should see
25
- #
26
- #
27
- Then /^I should see "([^\"]*)"$/ do |text|
28
- @browser.contains_text(text).should be_true
29
- end
30
-
31
- Then /^I should not see "([^\"]*)"$/ do |text|
32
- @browser.contains_text(text).should be_false
33
- end
34
-
35
- # Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
36
- # res = @browser.body
37
- # (count.to_i - 1).times { res.sub!(/#{text}/, "")}
38
- # res.should contain(text)
39
- # res.sub(/#{text}/, "").should_not contain(text)
40
- # end
41
-
42
- Given /I verify the page contains a div class "(.*)"/ do |byclass|
43
- @browser.div(:class, byclass).exists?.should be_true
44
- end
45
-
46
- Given /I verify the page contains a div id "(.*)"/ do |id|
47
- @browser.div(:id, id).exists?.should be_true
48
- end
49
-
50
- Given /I verify the page contains a link class "(.*)"/ do |byclass|
51
- @browser.link(:class, byclass).exists?.should be_true
52
- end
53
-
54
- Given /I verify the page contains the image "(.*)"/ do |image|
55
- @browser.image(:src, image).exists?.should be_true
56
- end
57
-
58
- Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
59
- @browser.checkbox(label).should be_checked
60
- end
61
-
62
- #
63
- # Forms
64
- #
65
- #
66
- When /^I press "([^\"]*)"$/ do |b|
67
- @browser.button(:value, b).click
68
- end
69
-
70
- When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
71
- @browser.text_field(:name, field).set(value) rescue @browser.text_field(:id, field).set(value)
72
- end
73
-
74
- When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, id|
75
- @browser.select_list(:id, id).select(value)
76
- end
77
-
78
- When /^I choose "([^\"]*)"$/ do |id|
79
- @browser.radio(:id, id).click
80
- end
81
-
82
- When /^I check "([^\"]*)"$/ do |id|
83
- @browser.checkbox(:id, id).click
84
- end
85
-
86
- When /^I uncheck "([^\"]*)"$/ do |id|
87
- @browser.checkbox(field).clear
88
- end
89
-
90
- #
91
- # Javascript
92
- #
93
- Given /From the "(.*)" link I fire the "(.*)" event/ do |text, event|
94
- @browser.link(:text , text).fire_event(event)
95
- end
96
-
97
- Given /I click the "(.*)" span/ do |text|
98
- @browser.span(:text, text).click
99
- end
100
-
101
- Given /I wait (\d+) seconds*/ do |time|
102
- sleep time.to_i
103
- end
104
-
105
- Given /^I wait until "([^\"]*)"$/ do |div|
106
- 7.times do |i|
107
- break if @browser.div(:id, div).exists?
108
- i == 7 ? raise(Watir::Exception::UnknownObjectException) : sleep(1)
109
- end
110
- end
111
-
112
- end
1
+
2
+ #
3
+ # Browsing
4
+ #
5
+ Given /^I am on (.+)$/ do |page_name|
6
+ @browser.goto(path_to(page_name))
7
+ end
8
+
9
+ When /^I (visit|go to) the (.+)$/ do |_, text|
10
+ @browser.goto(@environment + text)
11
+ end
12
+
13
+ When /^I (click|follow) "([^\"]*)"$/ do |_, id|
14
+ link = @browser.link(:text, id).click rescue @browser.link(:id, id).click
15
+ end
16
+
17
+ Then /^I should be on (.+)$/ do |page_name|
18
+ URI.parse(@browser.url).path.should == path_to(page_name)
19
+ end
20
+
21
+ #
22
+ # Should see
23
+ #
24
+ #
25
+ Then /^I should see "([^\"]*)"$/ do |text|
26
+ @browser.contains_text(text).should be_true
27
+ end
28
+
29
+ Then /^I should not see "([^\"]*)"$/ do |text|
30
+ @browser.contains_text(text).should be_false
31
+ end
32
+
33
+ # Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
34
+ # res = @browser.body
35
+ # (count.to_i - 1).times { res.sub!(/#{text}/, "")}
36
+ # res.should contain(text)
37
+ # res.sub(/#{text}/, "").should_not contain(text)
38
+ # end
39
+
40
+ Given /I verify the page contains a div class "(.*)"/ do |byclass|
41
+ @browser.div(:class, byclass).exists?.should be_true
42
+ end
43
+
44
+ Given /I verify the page contains a div id "(.*)"/ do |id|
45
+ @browser.div(:id, id).exists?.should be_true
46
+ end
47
+
48
+ Given /I verify the page contains a link class "(.*)"/ do |byclass|
49
+ @browser.link(:class, byclass).exists?.should be_true
50
+ end
51
+
52
+ Given /I verify the page contains the image "(.*)"/ do |image|
53
+ @browser.image(:src, image).exists?.should be_true
54
+ end
55
+
56
+ Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
57
+ @browser.checkbox(label).should be_checked
58
+ end
59
+
60
+ #
61
+ # Forms
62
+ #
63
+ #
64
+ When /^I press "([^\"]*)"$/ do |b|
65
+ @browser.button(:value, b).click
66
+ end
67
+
68
+ When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
69
+ @browser.text_field(:name, field).set(value) rescue @browser.text_field(:id, field).set(value)
70
+ end
71
+
72
+ When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, id|
73
+ @browser.select_list(:id, id).select(value)
74
+ end
75
+
76
+ When /^I choose "([^\"]*)"$/ do |id|
77
+ @browser.radio(:id, id).click
78
+ end
79
+
80
+ When /^I check "([^\"]*)"$/ do |id|
81
+ @browser.checkbox(:id, id).click
82
+ end
83
+
84
+ When /^I uncheck "([^\"]*)"$/ do |id|
85
+ @browser.checkbox(field).clear
86
+ end
87
+
88
+ #
89
+ # Javascript
90
+ #
91
+ Given /From the "(.*)" link I fire the "(.*)" event/ do |text, event|
92
+ @browser.link(:text , text).fire_event(event)
93
+ end
94
+
95
+ Given /I click the "(.*)" span/ do |text|
96
+ @browser.span(:text, text).click
97
+ end
98
+
99
+ Given /I wait (\d+) seconds*/ do |time|
100
+ sleep time.to_i
101
+ end
102
+
103
+ Given /^I wait until "([^\"]*)"$/ do |div|
104
+ 7.times do |i|
105
+ break if @browser.div(:id, div).exists?
106
+ i == 7 ? raise(Watir::Exception::UnknownObjectException) : sleep(1)
113
107
  end
114
108
  end
109
+
@@ -1,114 +1,106 @@
1
- # -*- coding: utf-8 -*-
2
- module Watircuke
3
- module Steps
4
- module PT
5
- #
6
- # Navegando
7
- #
8
- Given /^Eu estou em (.+)$/ do |page_name|
9
- @browser.goto(path_to(page_name))
10
- end
11
-
12
- When /^Eu (visito|vou) para (.+)$/ do |_, text|
13
- @browser.goto(@environment + text)
14
- end
15
-
16
- When /^Eu (clico|sigo) "([^\"]*)"$/ do |_, id|
17
- link = @browser.link(:text, id).click rescue @browser.link(:id, id).click
18
- end
19
-
20
- Then /^Eu devo estar em (.+)$/ do |page_name|
21
- URI.parse(@browser.url).path.should == path_to(page_name)
22
- end
23
-
24
- #
25
- # Devo ver
26
- #
27
- #
28
- Then /^Eu devo ver "([^\"]*)"$/ do |text|
29
- @browser.contains_text(text).should be_true
30
- end
31
-
32
- Then /^Eu não devo ver "([^\"]*)"$/ do |text|
33
- @browser.contains_text(text).should be_false
34
- end
35
-
36
- # Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
37
- # res = @browser.body
38
- # (count.to_i - 1).times { res.sub!(/#{text}/, "")}
39
- # res.should contain(text)
40
- # res.sub(/#{text}/, "").should_not contain(text)
41
- # end
42
-
43
- Given /Eu verifico que a página contêm uma div com a class "(.*)"/ do |byclass|
44
- @browser.div(:class, byclass).exists?.should be_true
45
- end
46
-
47
- Given /Eu verifico que a página contêm uma div com a id "(.*)"/ do |id|
48
- @browser.div(:id, id).exists?.should be_true
49
- end
50
-
51
- Given /Eu verifico que a página contêm um link com a class "(.*)"/ do |byclass|
52
- @browser.link(:class, byclass).exists?.should be_true
53
- end
54
-
55
- Given /Eu verifico que a página contêm a imagem "(.*)"/ do |image|
56
- @browser.image(:src, image).exists?.should be_true
57
- end
58
-
59
- Then /^o checkbox "([^\"]*)" deve estar marcado$/ do |label|
60
- @browser.checkbox(label).should be_checked
61
- end
62
-
63
- #
64
- # Formulários
65
- #
66
- #
67
- When /^Eu pressiono "([^\"]*)"$/ do |b|
68
- @browser.button(:value, b).click
69
- end
70
-
71
- When /^Eu preeencho "([^\"]*)" com "([^\"]*)"$/ do |field, value|
72
- @browser.text_field(:name, field).set(value) rescue @browser.text_field(:id, field).set(value)
73
- end
74
-
75
- When /^Eu seleciono "([^\"]*)" em "([^\"]*)"$/ do |value, id|
76
- @browser.select_list(:id, id).select(value)
77
- end
78
-
79
- When /^Eu seleciono "([^\"]*)"$/ do |id|
80
- @browser.radio(:id, id).click
81
- end
82
-
83
- When /^Eu marco "([^\"]*)"$/ do |id|
84
- @browser.checkbox(:id, id).click
85
- end
86
-
87
- When /^Eu desmarco "([^\"]*)"$/ do |id|
88
- @browser.checkbox(field).clear
89
- end
90
-
91
- #
92
- # Javascript
93
- #
94
- Given /Do link "(.*)" Eu chamo o evento "(.*)"/ do |text, event|
95
- @browser.link(:text , text).fire_event(event)
96
- end
97
-
98
- Given /Eu clico no span "(.*)"/ do |text|
99
- @browser.span(:text, text).click
100
- end
101
-
102
- Given /Eu espero por (\d+) segundos*/ do |time|
103
- sleep time.to_i
104
- end
105
-
106
- Given /^Eu espero até "([^\"]*)"$/ do |div|
107
- 7.times do |i|
108
- break if @browser.div(:id, div).exists?
109
- i == 7 ? raise(Watir::Exception::UnknownObjectException) : sleep(1)
110
- end
111
- end
112
- end
1
+
2
+ Given /^Eu estou em (.+)$/ do |page_name|
3
+ @browser.goto(path_to(page_name))
4
+ end
5
+
6
+ When /^Eu (visito|vou) para (.+)$/ do |_, text|
7
+ @browser.goto(@environment + text)
8
+ end
9
+
10
+ When /^Eu (clico|sigo) "([^\"]*)"$/ do |_, id|
11
+ link = @browser.link(:text, id).click rescue @browser.link(:id, id).click
12
+ end
13
+
14
+ Then /^Eu devo estar em (.+)$/ do |page_name|
15
+ URI.parse(@browser.url).path.should == path_to(page_name)
16
+ end
17
+
18
+ #
19
+ # Devo ver
20
+ #
21
+ #
22
+ Then /^Eu devo ver "([^\"]*)"$/ do |text|
23
+ @browser.contains_text(text).should be_true
24
+ end
25
+
26
+ Then /^Eu não devo ver "([^\"]*)"$/ do |text|
27
+ @browser.contains_text(text).should be_false
28
+ end
29
+
30
+ # Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
31
+ # res = @browser.body
32
+ # (count.to_i - 1).times { res.sub!(/#{text}/, "")}
33
+ # res.should contain(text)
34
+ # res.sub(/#{text}/, "").should_not contain(text)
35
+ # end
36
+
37
+ Given /Eu verifico que a página contêm uma div com a class "(.*)"/ do |byclass|
38
+ @browser.div(:class, byclass).exists?.should be_true
39
+ end
40
+
41
+ Given /Eu verifico que a página contêm uma div com a id "(.*)"/ do |id|
42
+ @browser.div(:id, id).exists?.should be_true
43
+ end
44
+
45
+ Given /Eu verifico que a página contêm um link com a class "(.*)"/ do |byclass|
46
+ @browser.link(:class, byclass).exists?.should be_true
47
+ end
48
+
49
+ Given /Eu verifico que a página contêm a imagem "(.*)"/ do |image|
50
+ @browser.image(:src, image).exists?.should be_true
51
+ end
52
+
53
+ Then /^o checkbox "([^\"]*)" deve estar marcado$/ do |label|
54
+ @browser.checkbox(label).should be_checked
55
+ end
56
+
57
+ #
58
+ # Formulários
59
+ #
60
+ #
61
+ When /^Eu pressiono "([^\"]*)"$/ do |b|
62
+ @browser.button(:value, b).click
63
+ end
64
+
65
+ When /^Eu preeencho "([^\"]*)" com "([^\"]*)"$/ do |field, value|
66
+ @browser.text_field(:name, field).set(value) rescue @browser.text_field(:id, field).set(value)
67
+ end
68
+
69
+ When /^Eu seleciono "([^\"]*)" em "([^\"]*)"$/ do |value, id|
70
+ @browser.select_list(:id, id).select(value)
71
+ end
72
+
73
+ When /^Eu seleciono "([^\"]*)"$/ do |id|
74
+ @browser.radio(:id, id).click
75
+ end
76
+
77
+ When /^Eu marco "([^\"]*)"$/ do |id|
78
+ @browser.checkbox(:id, id).click
79
+ end
80
+
81
+ When /^Eu desmarco "([^\"]*)"$/ do |id|
82
+ @browser.checkbox(field).clear
83
+ end
84
+
85
+ #
86
+ # Javascript
87
+ #
88
+ Given /Do link "(.*)" Eu chamo o evento "(.*)"/ do |text, event|
89
+ @browser.link(:text , text).fire_event(event)
90
+ end
91
+
92
+ Given /Eu clico no span "(.*)"/ do |text|
93
+ @browser.span(:text, text).click
94
+ end
95
+
96
+ Given /Eu espero por (\d+) segundos*/ do |time|
97
+ sleep time.to_i
98
+ end
99
+
100
+ Given /^Eu espero até "([^\"]*)"$/ do |div|
101
+ 7.times do |i|
102
+ break if @browser.div(:id, div).exists?
103
+ i == 7 ? raise(Watir::Exception::UnknownObjectException) : sleep(1)
113
104
  end
114
105
  end
106
+
@@ -1,13 +1,4 @@
1
- # Watircuke
2
- #
3
- # Commonly used webrat steps
4
- # http://github.com/brynary/webrat
5
- #
6
1
 
7
- #
8
- # Browsing
9
- #
10
- #
11
2
  Given /^I am on (.+)$/ do |page_name|
12
3
  visit path_to(page_name)
13
4
  end
data/lib/watircuke.rb CHANGED
@@ -38,8 +38,3 @@ end
38
38
  Before do
39
39
  @browser = Browser.new
40
40
  end
41
-
42
- #Steps
43
- require "steps/watircuke_en.rb"
44
- require "steps/watircuke_pt.rb"
45
- require "steps/webratcuke_en.rb"
data/watircuke.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{watircuke}
5
- s.version = "0.4.2"
5
+ s.version = "0.4.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rich Downie", "Marcos Piccinini", "Thiago Pradi"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tchandy-watircuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich Downie