percy-capybara-bedrock 0.1.5 → 0.1.6
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/.gitignore +1 -1
- data/CHANGELOG.md +9 -2
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +116 -15
- data/lib/percy/capybara/bedrock/anywhere.rb +0 -2
- data/lib/percy/capybara/bedrock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 171becd25414e62f3050d9affc0abf808219246b16e125299c77aee589b327b5
|
4
|
+
data.tar.gz: 6d9d44298bd52276905a66f1bd80612b82b6bc0bb2a593e6c80fce952919e002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 759ed1cf16247c23997a8f7755c74dcad764a5a0b9289ab34e669d7b3f5135cb5c2ef130e14a709792968c277afd5aa15989aeb7690bc01d467ff763adc22f86
|
7
|
+
data.tar.gz: 6a13a37b49236e7c3fd886fd396d13c1ad96ddadd7833d775b33100d598bea305793c937de650fa3f72b43590598e39b94decc3eeadc3f6903a3d55e28585747
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [v0.1.5](https://github.com/ItinerisLtd/percy-capybara-bedrock/tree/v0.1.5) (2019-02-08)
|
4
|
+
[Full Changelog](https://github.com/ItinerisLtd/percy-capybara-bedrock/compare/v0.1.4...v0.1.5)
|
4
5
|
|
5
|
-
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Update `README.md` [\#8](https://github.com/ItinerisLtd/percy-capybara-bedrock/pull/8) ([TangRufus](https://github.com/TangRufus))
|
9
|
+
- Bump percy-capybara-bedrock to 0.1.4 [\#7](https://github.com/ItinerisLtd/percy-capybara-bedrock/pull/7) ([TangRufus](https://github.com/TangRufus))
|
10
|
+
|
11
|
+
## [v0.1.4](https://github.com/ItinerisLtd/percy-capybara-bedrock/tree/v0.1.4) (2019-02-08)
|
12
|
+
[Full Changelog](https://github.com/ItinerisLtd/percy-capybara-bedrock/compare/v0.1.3...v0.1.4)
|
6
13
|
|
7
14
|
**Merged pull requests:**
|
8
15
|
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at [hello@itineris.co.uk](hello@itineris.co.uk). All
|
58
|
+
reported by contacting the project team at [hello@itineris.co.uk](mailto:hello@itineris.co.uk). All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# percy-capybara-bedrock
|
2
2
|
|
3
3
|
[](https://travis-ci.com/ItinerisLtd/percy-capybara-bedrock)
|
4
4
|
[](https://rubygems.org/gems/percy-capybara-bedrock)
|
@@ -11,32 +11,134 @@
|
|
11
11
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
12
12
|
|
13
13
|
|
14
|
+
- [Installation](#installation)
|
14
15
|
- [Releasing](#releasing)
|
15
16
|
|
16
17
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
17
18
|
|
18
|
-
##
|
19
|
+
## Goal
|
19
20
|
|
20
|
-
|
21
|
+
The official [Percy Anywhere](https://docs.percy.io/docs/percy-anywhere) uploads all static files (resources) under [`assets_dir`](https://github.com/percy/percy-capybara/blob/5865d54b81eac27ffc74c839eef7425a361d6f89/lib/percy/capybara/loaders/filesystem_loader.rb). This breaks when taking snapshots on a Bedrock project because of the resource limit (15,000 files).
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
`percy-capybara-bedrock` fixes the issue by defining [a custom loader](./lib/percy/bedrock/loader.rb) which:
|
24
|
+
- looks for static files under certain directories only
|
25
|
+
- excludes certain directories, e.g: `.git`, `vendor` and `node_modules`
|
26
|
+
- excludes certain file extensions, e.g: `.php` and `.sql`
|
25
27
|
|
26
|
-
|
28
|
+
## Minimum Requirements
|
29
|
+
|
30
|
+
- [Percy](https://percy.io/) account
|
31
|
+
- Ruby 2.6.1
|
32
|
+
- [PhantomJS](https://github.com/teampoltergeist/poltergeist#installing-phantomjs)
|
33
|
+
- [Bedrock v1.12.0](https://github.com/roots/bedrock)
|
34
|
+
- (Optional) [Sage v9.0.0](https://github.com/roots/sage/)
|
35
|
+
|
36
|
+
## Installation
|
27
37
|
|
28
38
|
```sh-session
|
29
|
-
$ bundle
|
39
|
+
$ bundle add percy-capybara-bedrock
|
30
40
|
```
|
31
41
|
|
32
|
-
|
42
|
+
Under the hood, `percy-capybara-bedrock` uses [Poltergeist](https://github.com/teampoltergeist/poltergeist) (a driver for [Capybara](https://github.com/teamcapybara/capybara)) which requires PhantomJS. Follow the instructions at: https://github.com/teampoltergeist/poltergeist#installing-phantomjs
|
43
|
+
|
44
|
+
## Usage
|
33
45
|
|
46
|
+
Create a `percy.rb` file under bedrock project root:
|
47
|
+
```ruby
|
48
|
+
require "percy/capybara/bedrock/anywhere"
|
49
|
+
|
50
|
+
# URL pointing to the local or remote host
|
51
|
+
server = "http://localhost:8080"
|
52
|
+
|
53
|
+
# Absolute path to a web root directory
|
54
|
+
web_root = File.expand_path("../web/", __FILE__)
|
55
|
+
|
56
|
+
# Path where your webserver hosts the WordPress site
|
57
|
+
assets_base_url = "/"
|
58
|
+
|
59
|
+
Percy::Capybara::Bedrock::Anywhere.run(server, web_root, assets_base_url) do|page|
|
60
|
+
# Basic
|
61
|
+
page.visit("/")
|
62
|
+
Percy::Capybara.snapshot(page, name:"/")
|
63
|
+
|
64
|
+
# Allow Javascript execution to finish
|
65
|
+
page.visit("/about-us/")
|
66
|
+
sleep(1)
|
67
|
+
Percy::Capybara.snapshot(page, name:"/about-us/")
|
68
|
+
|
69
|
+
# Capybara DSL
|
70
|
+
# More at: https://github.com/teamcapybara/capybara#the-dsl
|
71
|
+
page.visit("/contact-us")
|
72
|
+
fill_in("Name", with: "Tang Rufus")
|
73
|
+
fill_in("Message", with: "Testing contact form submission")
|
74
|
+
click_button('Send')
|
75
|
+
sleep(1) # Wait for thank you page to show up
|
76
|
+
Percy::Capybara.snapshot(page, name:"/contact-us/thank-you/")
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
Given that your WordPress site is running at http://localhost:8080, take percy snapshots:
|
34
81
|
```sh-session
|
35
|
-
$
|
82
|
+
$ PERCY_TOKEN=my-secret-token PERCY_BRANCH=local PERCY_DEBUG=1 bundle exec ruby percy.rb
|
36
83
|
```
|
37
84
|
|
85
|
+
## FAQ
|
86
|
+
|
87
|
+
### Does it support Sage?
|
88
|
+
|
89
|
+
Yes, run `$ yarn build:production` before snapshot.
|
90
|
+
|
91
|
+
### Is it a must to use Sage?
|
92
|
+
|
93
|
+
No, Sage is optional.
|
94
|
+
|
95
|
+
### It looks awesome. Where can I find some more goodies like this?
|
96
|
+
|
97
|
+
- Articles on [Itineris' blog](https://www.itineris.co.uk/blog/)
|
98
|
+
- More projects on [Itineris' GitHub profile](https://github.com/itinerisltd)
|
99
|
+
- More plugins on [Itineris' wp.org profile](https://profiles.wordpress.org/itinerisltd/#content-plugins)
|
100
|
+
- Follow [@itineris_ltd](https://twitter.com/itineris_ltd) and [@TangRufus](https://twitter.com/tangrufus) on Twitter
|
101
|
+
- Hire [Itineris](https://www.itineris.co.uk/services/) to build your next awesome site
|
102
|
+
|
103
|
+
### This isn't on wp.org. Where can I give a ⭐️⭐️⭐️⭐️⭐️ review?
|
104
|
+
|
105
|
+
Thanks! Glad you like it. It's important to let my boss knows somebody is using this project. Instead of giving reviews on wp.org, consider:
|
106
|
+
|
107
|
+
- tweet something good with mentioning [@itineris_ltd](https://twitter.com/itineris_ltd) and [@TangRufus](https://twitter.com/tangrufus)
|
108
|
+
- star this [Github repo](https://github.com/ItinerisLtd/percy-capybara-bedrock)
|
109
|
+
- watch this [Github repo](https://github.com/ItinerisLtd/percy-capybara-bedrock)
|
110
|
+
- write blog posts
|
111
|
+
- submit pull requests
|
112
|
+
- [hire Itineris](https://www.itineris.co.uk/services/)
|
113
|
+
|
114
|
+
## Feedback
|
115
|
+
|
116
|
+
**Please provide feedback!** We want to make this library useful in as many projects as possible.
|
117
|
+
Please submit an [issue](https://github.com/ItinerisLtd/percy-capybara-bedrock/issues/new) and point out what you do and don't like, or fork the project and make suggestions.
|
118
|
+
**No issue is too small.**
|
119
|
+
|
120
|
+
## Security
|
121
|
+
|
122
|
+
If you discover any security related issues, please email [hello@itineris.co.uk](mailto:hello@itineris.co.uk) instead of using the issue tracker.
|
123
|
+
|
124
|
+
## Change log
|
125
|
+
|
126
|
+
Please see [CHANGELOG](./CHANGELOG.md) for more information on what has changed recently.
|
127
|
+
|
128
|
+
## Credits
|
129
|
+
|
130
|
+
[percy-capybara-bedrock](https://github.com/ItinerisLtd/percy-capybara-bedrock) is a [Itineris Limited](https://www.itineris.co.uk/) project created by [Tang Rufus](https://typist.tech).
|
131
|
+
|
132
|
+
Full list of contributors can be found [here](https://github.com/ItinerisLtd/percy-capybara-bedrock/graphs/contributors).
|
133
|
+
|
134
|
+
## License
|
135
|
+
|
136
|
+
[percy-capybara-bedrock](https://github.com/ItinerisLtd/percy-capybara-bedrock) is released under the [MIT License](https://opensource.org/licenses/MIT).
|
137
|
+
|
38
138
|
## Releasing
|
39
139
|
|
140
|
+
*For maintainers only*
|
141
|
+
|
40
142
|
```sh-session
|
41
143
|
$ gem install github_changelog_generator
|
42
144
|
$ gem install gem-release
|
@@ -44,12 +146,11 @@ $ gem install gem-release
|
|
44
146
|
$ git checkout -b version-bump
|
45
147
|
|
46
148
|
$ gem bump --sign --tag --release --version patch --pretend
|
47
|
-
|
48
|
-
|
149
|
+
git push --tags && \
|
150
|
+
github_changelog_generator && \
|
49
151
|
npx doctoc README.md && \
|
50
152
|
git add CHANGELOG.md README.md && \
|
51
|
-
git commit -m "github_changelog_generator && npx doctoc README.md"
|
52
|
-
|
53
|
-
$ git push -u origin Head && \
|
153
|
+
git commit -m "github_changelog_generator && npx doctoc README.md" && \
|
154
|
+
git push origin version-bump && \
|
54
155
|
hub pull-request
|
55
156
|
```
|
@@ -8,8 +8,6 @@ module Percy
|
|
8
8
|
module Bedrock
|
9
9
|
# Simple block runner for self-contained Capybara tests.
|
10
10
|
#
|
11
|
-
# Requires:
|
12
|
-
# - poltergeist gem (which requires phantomjs)
|
13
11
|
# Usage:
|
14
12
|
# Percy::Capybara::Bedrock::Anywhere.run(SERVER, WEB_ROOT, ASSETS_BASE_URL) do |page|
|
15
13
|
# page.visit('/')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percy-capybara-bedrock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tang Rufus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-02-
|
12
|
+
date: 2019-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: percy-capybara
|