percy-capybara-bedrock 0.1.5 → 0.1.6

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
  SHA256:
3
- metadata.gz: 2a2d3f28bbf075a2add9585068628f4b2dc230f7d058aeb6982e5d79693c31a7
4
- data.tar.gz: 4edb46b7556f1f36433890af906a46054d52b9eb1497f421ef3362f150f22200
3
+ metadata.gz: 171becd25414e62f3050d9affc0abf808219246b16e125299c77aee589b327b5
4
+ data.tar.gz: 6d9d44298bd52276905a66f1bd80612b82b6bc0bb2a593e6c80fce952919e002
5
5
  SHA512:
6
- metadata.gz: 556e4d57cfee538bed1078c4d176d25135fede7af56a73cd0580929ee67089da7a6a96650bf8da87398ca63a584bfbdb0167da990ed61a35973505b23405a213
7
- data.tar.gz: faf6b666d0dc2097105ad08c0d975db0668a23b88900dd95a12860116d8997bea851964346d3d4d99fc2dc3cb9d348d2f0f89bc868dd31bc490c154ed242597d
6
+ metadata.gz: 759ed1cf16247c23997a8f7755c74dcad764a5a0b9289ab34e669d7b3f5135cb5c2ef130e14a709792968c277afd5aa15989aeb7690bc01d467ff763adc22f86
7
+ data.tar.gz: 6a13a37b49236e7c3fd886fd396d13c1ad96ddadd7833d775b33100d598bea305793c937de650fa3f72b43590598e39b94decc3eeadc3f6903a3d55e28585747
data/.gitignore CHANGED
@@ -12,4 +12,4 @@
12
12
 
13
13
  # TODO: Review
14
14
  Gemfile.lock
15
- gem.locked
15
+ gems.locked
data/CHANGELOG.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased](https://github.com/ItinerisLtd/percy-capybara-bedrock/tree/HEAD)
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
- [Full Changelog](https://github.com/ItinerisLtd/percy-capybara-bedrock/compare/v0.1.3...HEAD)
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
- # Percy::Capybara::Bedrock
1
+ # percy-capybara-bedrock
2
2
 
3
3
  [![Build Status](https://travis-ci.com/ItinerisLtd/percy-capybara-bedrock.svg?branch=master)](https://travis-ci.com/ItinerisLtd/percy-capybara-bedrock)
4
4
  [![Gem Version](https://img.shields.io/gem/v/percy-capybara-bedrock.svg?style=flat)](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
- ## Installation
19
+ ## Goal
19
20
 
20
- Add this line to your application's `Gemfile` or `gem.rb`:
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
- ```ruby
23
- gem 'percy-capybara-bedrock'
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
- And then execute:
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
- Or install it yourself as:
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
- $ gem install percy-capybara-bedrock
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
- $ github_changelog_generator && \
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('/')
@@ -1,7 +1,7 @@
1
1
  module Percy
2
2
  module Capybara
3
3
  module Bedrock
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
6
6
  end
7
7
  end
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.5
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-08 00:00:00.000000000 Z
12
+ date: 2019-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: percy-capybara