pageify 0.3.2 → 0.3.3

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: 0afe78427287d4e566a9f2f95d762a857886d125
4
- data.tar.gz: a814cbde53f08beb62446c1110520f5b5baffddb
3
+ metadata.gz: c36cbba1f6fec1b60f291876b782a9a586af4d8a
4
+ data.tar.gz: ae12646597c131cd992fd8ee911781e6e51814f5
5
5
  SHA512:
6
- metadata.gz: 7cfa96740acfaec3c574be8ac5000f49d1bd690341b03971438685f46153f8320bd5d28898a5f5a1812560958be4ea0f2e6921b9515bf5b249a8075de90027f9
7
- data.tar.gz: c5ccb14bdfbd8c31c8465a53f7de5f9aace6150c9d45e2fd89c09556c34f17f318411cccb8f89bb0a34d90ea51934637617e28bb965e00eb988e9740f506f72c
6
+ metadata.gz: ac9b4bd0fb44a2f7d0ead4e3ee581708e4cac47c23135ab997d68f3fb80b8dde131419eeafe4d4f3c39691372bdc714178f29289049b331f0f0dfeb4e7ca0ce3
7
+ data.tar.gz: 12abdad577e12f7711fdcccbfde4df1860e77a8087fcc638db01e21c7329f890321c2958d0d479aefc00e40bf5a4327c5084f387801637a7ba4fa110947c9997
data/README.md CHANGED
@@ -86,9 +86,23 @@ fill_in home_page.login.user_name.p, :with=> "hi"
86
86
  click_on home_page.login.submit.p
87
87
  ```
88
88
 
89
- ###
89
+ ##Splitting Long Page Definitions
90
+ 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.
90
91
 
92
+ The syntax for this is as follows:
91
93
 
94
+ ```yaml
95
+ # sections/_product.yml
96
+ product: '.product'
97
+ name: '.name'
98
+ price: '.price'
92
99
 
100
+ # product_list.yml
101
+ product_list: '.product_list'
102
+ :section/product
93
103
 
104
+ # search_results.yml
105
+ search_results: '.search_results'
106
+ :section/product
94
107
 
108
+ ```
data/lib/pageify.rb CHANGED
@@ -12,8 +12,12 @@ module Pageify
12
12
 
13
13
  def createElement(raw_row)
14
14
  element = PageObject.create(raw_row)
15
- define_method(element.name) do
16
- $selector = element.selector.strip_quotes.strip
15
+ define_method(element.name) do |*arguments|
16
+ unless arguments.eql? []
17
+ $selector = (element.selector % arguments).strip_quotes.strip
18
+ else
19
+ $selector = (element.selector % '').strip_quotes.strip
20
+ end
17
21
  element
18
22
  end
19
23
  element
@@ -1,4 +1,4 @@
1
- root: ".root"
1
+ root: ".root %s"
2
2
  simple: ".simple"
3
3
  complex: ".complex"
4
4
  nested: ".nested"
data/spec/sample_spec.rb CHANGED
@@ -12,7 +12,11 @@ describe Pageify do
12
12
  @page.root.p.should == ".root"
13
13
  end
14
14
 
15
- it "should have simple page" do
15
+ it "should heck for root params" do
16
+ @page.root("#id").simple.p.should == ".root #id .simple"
17
+ end
18
+
19
+ it "should have simple page" do
16
20
  @page.root.simple.p.should == ".root .simple"
17
21
  end
18
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak