pageify 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +53 -5
- data/lib/pageify.rb +2 -2
- data/lib/pageify/capybara.rb +20 -0
- data/lib/pageify/{element.rb → page_object.rb} +0 -0
- data/spec/pages/{sample.page → sample_page.yml} +0 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18eeae82100f700e3f08d519bc11a42ade282585
|
4
|
+
data.tar.gz: 386caa08d3518b489493605ab2b26b7753ea5ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae23a44f394b8d37fb7f4f0aa63c5fd533acc5938fa356bd34c73a7ca8de0e19c94f045e413458870e70f325bb0cf22478dd73ec7e492018d77ce6e72be2ca53
|
7
|
+
data.tar.gz: 5a7e3b701b86f9c6a09218d9f1a31ca8770d963fa6981d9b5544d2f08735ae1832be4e509a5cab576cc4973e28eb1801db31c1aeb9d0e59b43f3105b211ea229
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#Pageify
|
2
2
|
|
3
|
+
[![Code Climate](https://codeclimate.com/github/paramadeep/pageify.png)](https://codeclimate.com/github/paramadeep/pageify) [![Dependency Status](https://gemnasium.com/paramadeep/pageify.svg)](https://gemnasium.com/paramadeep/pageify) [![Build Status](https://travis-ci.org/paramadeep/pageify.svg?branch=master)](https://travis-ci.org/paramadeep/pageify)
|
4
|
+
|
3
5
|
Lets you define page objects for your UI tests, written in Ruby.
|
4
6
|
|
5
7
|
##Example
|
@@ -17,13 +19,26 @@ home_page: ".home"
|
|
17
19
|
```
|
18
20
|
Test steps looks like this
|
19
21
|
```ruby
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
home_page.login.user_name[].set "hi"
|
23
|
+
home_page.login.password[].set "bla"
|
24
|
+
home_page.login.submit[].click
|
25
|
+
|
26
|
+
home_page.profile_name[].should match_text "hi"
|
27
|
+
hoem_page.settings[].should be_visible
|
28
|
+
```
|
23
29
|
|
24
|
-
|
25
|
-
|
30
|
+
We will be able element whose locators are dynamic
|
31
|
+
```yaml
|
32
|
+
products_page: ".products"
|
33
|
+
product: ".product[name='%s']"
|
34
|
+
details_row: ".row:nth-of-type(%s)"
|
35
|
+
cost: ".cost"
|
36
|
+
```
|
37
|
+
```ruby
|
38
|
+
products_page.product("candy").details_row(1).cost[].should have_text "Rs.10"
|
39
|
+
products_page.product("tyres").details_row(2).cost[].should have_text "Rs.20"
|
26
40
|
```
|
41
|
+
|
27
42
|
|
28
43
|
## Key benefits
|
29
44
|
|
@@ -39,8 +54,41 @@ gem 'pageify'
|
|
39
54
|
###Cucumber
|
40
55
|
In env.rb
|
41
56
|
```ruby
|
57
|
+
require 'pageify'
|
58
|
+
require 'pageify/capybara'
|
42
59
|
include Pageify
|
60
|
+
|
43
61
|
pageify("features/pages")
|
44
62
|
```
|
45
63
|
Place all the page defenitions under "features/pages"
|
46
64
|
|
65
|
+
##Methods
|
66
|
+
|
67
|
+
###Get Element '[]'
|
68
|
+
```ruby
|
69
|
+
home_page.login.user_name[] #=> user_name text box
|
70
|
+
home_page.login.user_name[].set "hi" # set text box value
|
71
|
+
home_page.login.user_name[].should have_value "hi" # assert value
|
72
|
+
home_page.login.submit[].click
|
73
|
+
```
|
74
|
+
|
75
|
+
|
76
|
+
###Get Selector 'p'
|
77
|
+
At times we would need selector of the object
|
78
|
+
```ruby
|
79
|
+
home_page.login.user_name.p #=> ".home div.login input.user"
|
80
|
+
|
81
|
+
#check element doesn't exist
|
82
|
+
page.should_not have_selector home_page.login.user_name.p
|
83
|
+
|
84
|
+
#using capybara actions
|
85
|
+
fill_in home_page.login.user_name.p, :with=> "hi"
|
86
|
+
click_on home_page.login.submit.p
|
87
|
+
```
|
88
|
+
|
89
|
+
###
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
data/lib/pageify.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Pageify
|
2
2
|
require "pageify/string"
|
3
|
-
require "pageify/
|
3
|
+
require "pageify/page_object"
|
4
4
|
|
5
5
|
def pageify(base_dir)
|
6
6
|
base_dir.chomp! '/'
|
7
7
|
all_pages = []
|
8
|
-
Dir["#{base_dir}/**/*.
|
8
|
+
Dir["#{base_dir}/**/*.yml"].each do |file|
|
9
9
|
to_page_objects file
|
10
10
|
end
|
11
11
|
end
|
File without changes
|
File without changes
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -39,16 +39,17 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Simplify page object definition for UI tests
|
42
|
-
email:
|
42
|
+
email:
|
43
43
|
executables: []
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- README.md
|
48
48
|
- lib/pageify.rb
|
49
|
-
- lib/pageify/
|
49
|
+
- lib/pageify/capybara.rb
|
50
|
+
- lib/pageify/page_object.rb
|
50
51
|
- lib/pageify/string.rb
|
51
|
-
- spec/pages/
|
52
|
+
- spec/pages/sample_page.yml
|
52
53
|
- spec/sample_spec.rb
|
53
54
|
- spec/spec_helper.rb
|
54
55
|
homepage: https://github.com/paramadeep/pageify
|
@@ -76,6 +77,6 @@ signing_key:
|
|
76
77
|
specification_version: 4
|
77
78
|
summary: Simplify page object definition for UI tests
|
78
79
|
test_files:
|
79
|
-
- spec/pages/
|
80
|
+
- spec/pages/sample_page.yml
|
80
81
|
- spec/spec_helper.rb
|
81
82
|
- spec/sample_spec.rb
|