pageify 0.5.1 → 0.5.2

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: b2edcf30ded6fabb39ab88aa106e0e598404b7d3
4
- data.tar.gz: 1c22cfe32425d65feaa81260d5455308eca30292
3
+ metadata.gz: e5ffb5fcbf530a6dac55cec0a1f4f077879e7d87
4
+ data.tar.gz: c40aee446129c951d11f10c26c1e8836d8cc8e94
5
5
  SHA512:
6
- metadata.gz: 714ea849afdb150c48f544f9a07217be0b643691843b0d485cb8772bbb715e1350a36284d17b3394bbbd5fdfbf36ed81edebc361ab695bc45d239671968cc64a
7
- data.tar.gz: e6dd1a7e4facf3c361f3a62ff63fbd03ae736bc839b8a08d60eca8f2009947e90ecf054c4e70f637fdf7e521eafb703548159f156ade53f8dc783e6417226c98
6
+ metadata.gz: dcb8bb18f2a6a22129c2fdc18aadb63a3f7207818797227329d37213b39dcbe43242607d115a23a6163e6cdc601f56c11876a18127831742b3d39e1b5e6e9763
7
+ data.tar.gz: e8a9480bbacf053b34f939fb5f5c39ccd6a20afcac528a9c36e7eb6e3577b62a037599d8d02afcbd05eb13e90e61d8102b805be84439c52f38915fb21e499106
data/README.md CHANGED
@@ -72,12 +72,14 @@ gem 'pageify'
72
72
  require 'capybara/session'
73
73
  require 'selenium-webdriver'
74
74
 
75
+ include Capybara::DSL
76
+
75
77
  #define your capybara driver ... and
76
78
 
77
79
  pageify("features/pages")
78
80
  set_session(page)
79
81
  ```
80
- Place all the page defenitions under "features/pages"
82
+ Place all the page definitions under "features/pages"
81
83
 
82
84
  ## Splitting long page definitions
83
85
  Sometimes, your page definition may get quite long. In other cases, you may also have the exact same HTML component (say a product listing) that can be repeated in multiple places (e.g. list, search, etc). In these cases, you can use sections to split your page into multiple files that can be reused.
@@ -1,85 +1,87 @@
1
- module Assertions
2
- extend RSpec::Matchers::DSL
1
+ module Pageify
2
+ class PageObject
3
+ extend RSpec::Matchers::DSL
3
4
 
4
- matcher :match_text do |expected_text|
5
- match_for_should { |node| node.has_text?(/^#{expected_text.escape_specials}$/) }
6
- failure_message_for_should { |node| "expected #{expected_text} but was '#{node.text}'"}
7
- match_for_should_not { |node| node.has_no_text?(/^#{text.escape_specials}$/) }
8
- end
5
+ matcher :match_text do |expected_text|
6
+ match_for_should { |node| node.has_text?(/^#{expected_text.escape_specials}$/) }
7
+ failure_message_for_should { |node| "expected #{expected_text} but was '#{node.text}'"}
8
+ match_for_should_not { |node| node.has_no_text?(/^#{text.escape_specials}$/) }
9
+ end
9
10
 
10
- matcher :match do |expected|
11
- match_for_should do |node|
12
- case node.tag_name
13
- when "select"
14
- node.should have_selected expected
15
- when "input"
16
- node.value.should eq expected
17
- when "textArea"
18
- node.value.should eq expected
19
- else
20
- node.has_text?(/^#{expected.escape_specials}$/)
11
+ matcher :match do |expected|
12
+ match_for_should do |node|
13
+ case node.tag_name
14
+ when "select"
15
+ node.should have_selected expected
16
+ when "input"
17
+ node.value.should eq expected
18
+ when "textArea"
19
+ node.value.should eq expected
20
+ else
21
+ node.has_text?(/^#{expected.escape_specials}$/)
22
+ end
21
23
  end
22
- end
23
- failure_message_for_should do |node|
24
- actual = ""
25
- case node.tag_name
26
- when "select"
27
- actual = node.text
28
- when "input"
29
- actual = node.value
30
- when "textArea"
31
- actual = node.value
32
- else
33
- actual = node.text
24
+ failure_message_for_should do |node|
25
+ actual = ""
26
+ case node.tag_name
27
+ when "select"
28
+ actual = node.text
29
+ when "input"
30
+ actual = node.value
31
+ when "textArea"
32
+ actual = node.value
33
+ else
34
+ actual = node.text
35
+ end
36
+ "expected #{expected} but was '#{actual}'"
34
37
  end
35
- "expected #{expected} but was '#{actual}'"
36
38
  end
37
- end
38
39
 
39
- matcher :have_selected do |text|
40
- match_for_should do |node|
41
- node.find("option[selected='']").has_text?(/^#{text}/)
40
+ matcher :have_selected do |text|
41
+ match_for_should do |node|
42
+ node.find("option[selected='']").has_text?(/^#{text}/)
43
+ end
42
44
  end
43
- end
44
45
 
45
- matcher :have_selected_percentage do |text|
46
- match_for_should do |node|
47
- value = node.value
48
- node.find("option[value='#{value}']").has_text?(/^#{text}/)
46
+ matcher :have_selected_percentage do |text|
47
+ match_for_should do |node|
48
+ value = node.value
49
+ node.find("option[value='#{value}']").has_text?(/^#{text}/)
50
+ end
49
51
  end
50
- end
51
52
 
52
- matcher :be_disabled do
53
- match_for_should do |node|
54
- (node['disabled'] == "true" or node['class'].include? "disabled").should eq true
53
+ matcher :be_disabled do
54
+ match_for_should do |node|
55
+ (node['disabled'] == "true" or node['class'].include? "disabled").should eq true
56
+ end
57
+ failure_message_for_should { |node| "expected #{node.to_s} to be disabled but was enabled"}
55
58
  end
56
- failure_message_for_should { |node| "expected #{node.to_s} to be disabled but was enabled"}
57
- end
58
59
 
59
- matcher :be_checked do
60
- match_for_should do |node|
61
- (node['checked'] == "true" or node['class'].include? "checked").should eq true
60
+ matcher :be_checked do
61
+ match_for_should do |node|
62
+ (node['checked'] == "true" or node['class'].include? "checked").should eq true
63
+ end
64
+ failure_message_for_should { |node| "expected #{node.to_s} to be checked but not checked"}
62
65
  end
63
- failure_message_for_should { |node| "expected #{node.to_s} to be checked but not checked"}
64
- end
65
66
 
66
- matcher :not_be_checked do
67
- match_for_should do |node|
68
- (node['checked'] == "false" or !node['class'].include? "checked").should eq true
67
+ matcher :not_be_checked do
68
+ match_for_should do |node|
69
+ (node['checked'] == "false" or !node['class'].include? "checked").should eq true
70
+ end
71
+ failure_message_for_should { |node| "expected #{node.to_s} not to be checked but was checked"}
69
72
  end
70
- failure_message_for_should { |node| "expected #{node.to_s} not to be checked but was checked"}
71
- end
72
73
 
73
- matcher :be_enabled do
74
- match_for_should { |node| node['disabled'].should be_nil }
75
- failure_message_for_should { |node| "expected #{node.to_s} to be enabled but was disabled"}
76
- end
74
+ matcher :be_enabled do
75
+ match_for_should { |node| node['disabled'].should be_nil }
76
+ failure_message_for_should { |node| "expected #{node.to_s} to be enabled but was disabled"}
77
+ end
77
78
 
78
- matcher :have_validation_error do
79
- match_for_should {|node| node['class'].include? "error" }
80
- end
79
+ matcher :have_validation_error do
80
+ match_for_should {|node| node['class'].include? "error" }
81
+ end
81
82
 
82
- matcher :exist do
83
- match_for_should_not {|node| page.has_no_css? node.selector}
83
+ matcher :exist do
84
+ match_for_should_not {|node| page.has_no_css? node.selector}
85
+ end
84
86
  end
85
87
  end
@@ -15,7 +15,7 @@ module Pageify
15
15
  get_session.find(selector,*args)
16
16
  end
17
17
 
18
- node_methods = Capybara::Node::Element.instance_methods - Object.methods - instance_methods
18
+ node_methods = Capybara::Node::Element.instance_methods - Object.methods - instance_methods - [:click_on]
19
19
  (node_methods).each do |node_method|
20
20
  define_method (node_method) do |*arguments|
21
21
  self.find.send(node_method,*arguments)
@@ -1,6 +1,6 @@
1
1
  require "capybara/rspec"
2
2
  module Pageify
3
- module BulkActions
3
+ class PageObject
4
4
 
5
5
  def should_match_fields fields
6
6
  if fields.is_a?(Hash)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-31 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec