site_prism_test_element 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8181537f97024d97deb7d48ac8ad74724725368e
4
- data.tar.gz: bf81fa0834617d61a91178e0d32c015d3c10dea9
3
+ metadata.gz: 06b548e3fc083ffc751a7d9899301132e52d76b3
4
+ data.tar.gz: 57c59408256f02abe0cfe0e984dbd32038d2caf2
5
5
  SHA512:
6
- metadata.gz: ecbf1ad879d320780626bc86d5d29e0c05e5615918292bcadc87cc5689ff2977676346ff3b51f4b644cb4f024191f3f94b5a2c2a7e46c38861649df096ebe009
7
- data.tar.gz: ee1b8a8ae2dc0b11d5951b7940ccf146758486b925db5b9ddc53d5e2bd4447cef55ffff13495c38904b204c12d83165bb2710dad9fe3f58c6df1730482d26652
6
+ metadata.gz: 3ad8b72b8a8943d30d622d8ec8f56d61393adf520db29d2c93d7cff1b6fb0aa773fa27fc53ff9f95f31226f83e55ec7f3975b95454770edd5d780286121d2db0
7
+ data.tar.gz: 58adb4251a9d6b89fac570c929ad312f403c2af0271b2a17c1fc4547fe3fa7db16ce93001f10485fb08eb057e4a4a464189fd908379ebb2d61d4866fca1ed467
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # SitePrismTestElement
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/site_prism_test_element`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ *Decouple your page objects from CSS*
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Extension of [SitePrism](https://github.com/natritmeyer/site_prism)
6
6
 
7
7
  ## Installation
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'site_prism_test_element'
12
+ gem 'site_prism_test_element', groups: [:test]
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -22,7 +22,68 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Instead of using CSS classes/ids for selecting DOM elements, mark them with `data-test-el` attribute. You will not have to worry about breaking your feature specs when you rename a CSS class or id in your markup.
26
+
27
+ ```html
28
+ <body>
29
+ <div class="search-box">
30
+ <form>
31
+ <input type="text" name="q" data-test-el="search_field">
32
+ <input type="submit" value="" data-test-el="submit_btn">
33
+ </form>
34
+ </div>
35
+
36
+ <ul class="nav nav-menu" data-test-el="menu">
37
+ <li>
38
+ <a data-test-el="search">Search</a>
39
+ </li>
40
+ <li>
41
+ <a data-test-el="map_search">Search</a>
42
+ </li>
43
+ </ul>
44
+
45
+ <div class="assets">
46
+ <div class="img">
47
+ <img src="/assets/1.png" data-test-el="image">
48
+ </div>
49
+ <div class="img">
50
+ <img src="/assets/2.png" data-test-el="image">
51
+ </div>
52
+ <div class="img">
53
+ <img src="/assets/3.png" data-test-el="image">
54
+ </div>
55
+ </div>
56
+ </body>
57
+ ```
58
+
59
+ ```ruby
60
+ class HomePage < SitePrism::Page
61
+ test_element :search_field
62
+ test_element :submit_btn
63
+ test_elements :images, :image
64
+
65
+ test_section :menu, MenuSection
66
+ end
67
+
68
+ class MenuSection < SitePrism::Section
69
+ test_element :search
70
+ test_element :map_search
71
+ end
72
+ ```
73
+
74
+ and in your spec you talk to the page as you normally do:
75
+
76
+ ```ruby
77
+ #...
78
+ scenario "search" do
79
+ home_page = HomePage.new
80
+
81
+ expect(home_page.images.count).to eq(3)
82
+
83
+ home_page.search_field.set "Harry Potter"
84
+ home_page.submit_btn.click
85
+ end
86
+ ```
26
87
 
27
88
  ## Development
28
89
 
@@ -32,7 +93,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
93
 
33
94
  ## Contributing
34
95
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/site_prism_test_element. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
96
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tomazy/site_prism_test_element. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
97
 
37
98
 
38
99
  ## License
@@ -1,3 +1,3 @@
1
1
  module SitePrismTestElement
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_prism_test_element
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomek