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 +4 -4
- data/README.md +66 -5
- data/lib/site_prism_test_element/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06b548e3fc083ffc751a7d9899301132e52d76b3
|
4
|
+
data.tar.gz: 57c59408256f02abe0cfe0e984dbd32038d2caf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad8b72b8a8943d30d622d8ec8f56d61393adf520db29d2c93d7cff1b6fb0aa773fa27fc53ff9f95f31226f83e55ec7f3975b95454770edd5d780286121d2db0
|
7
|
+
data.tar.gz: 58adb4251a9d6b89fac570c929ad312f403c2af0271b2a17c1fc4547fe3fa7db16ce93001f10485fb08eb057e4a4a464189fd908379ebb2d61d4866fca1ed467
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# SitePrismTestElement
|
2
2
|
|
3
|
-
|
3
|
+
*Decouple your page objects from CSS*
|
4
4
|
|
5
|
-
|
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
|
-
|
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/
|
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
|