rspec-css 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +30 -0
- data/.gitignore +16 -0
- data/.rubocop.yml +29 -0
- data/.ruby-version +1 -0
- data/CHANGELOG +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +89 -0
- data/LICENCE +21 -0
- data/README.md +78 -0
- data/Rakefile +8 -0
- data/lib/rspec/css/version.rb +7 -0
- data/lib/rspec/css.rb +58 -0
- data/rspec-css.gemspec +51 -0
- metadata +189 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a9119467ae49b4c0fef7e1ccd39cad732772359bfb9c120e2d29d9ddb4df9c19
|
4
|
+
data.tar.gz: cf1bf2711813728d009ff35c8514f4479122401cbf2adbffa0d032f7320674e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71b4e568d9a0ccf1acb5f77bc4a52c81cba97654e4c55cf86dab62501a5b5b31dcb2115860db1fedff06c470129d3bbc9ba5ddb520d6ff0b14d462b21ff064b2
|
7
|
+
data.tar.gz: 83c66da7df213efe88c25d9a914e842bb86350a4a7c86dc18ef0da798af8cfd6453794e1468d72fa173049ff6ed141eb896800701ff0a45725e90d5f30921ce6
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
version: 2
|
3
|
+
jobs:
|
4
|
+
build:
|
5
|
+
working_directory: ~/rspec-css
|
6
|
+
docker:
|
7
|
+
- image: ruby:2.6.2
|
8
|
+
steps:
|
9
|
+
- run:
|
10
|
+
command: |
|
11
|
+
apt-get update -qq && apt-get install -y build-essential
|
12
|
+
rm -rf /var/lib/apt/lists/*
|
13
|
+
- checkout
|
14
|
+
- restore_cache:
|
15
|
+
keys:
|
16
|
+
- dependency-cache-{{ checksum "Gemfile.lock" }}
|
17
|
+
- run:
|
18
|
+
command: |
|
19
|
+
gem update --system
|
20
|
+
bundle install --path vendor/bundle
|
21
|
+
- save_cache:
|
22
|
+
key: dependency-cache-{{ checksum "Gemfile.lock" }}
|
23
|
+
paths:
|
24
|
+
- vendor/bundle
|
25
|
+
- run:
|
26
|
+
name: Run Test
|
27
|
+
command: bundle exec rake spec
|
28
|
+
- run:
|
29
|
+
name: Run Lint
|
30
|
+
command: bundle exec rubocop -c .rubocop.yml
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'vendor/**/*'
|
4
|
+
- 'bin/**/*'
|
5
|
+
- !ruby/regexp /old_and_unused\.rb$/
|
6
|
+
TargetRubyVersion: 2.6
|
7
|
+
Style/Documentation:
|
8
|
+
Enabled: false
|
9
|
+
Layout/LineLength:
|
10
|
+
AutoCorrect: true
|
11
|
+
Max: 100
|
12
|
+
Metrics/BlockLength:
|
13
|
+
AutoCorrect: true
|
14
|
+
Max: 120
|
15
|
+
Metrics/MethodLength:
|
16
|
+
AutoCorrect: true
|
17
|
+
Max: 20
|
18
|
+
Metrics/ModuleLength:
|
19
|
+
Max: 180
|
20
|
+
Metrics/AbcSize:
|
21
|
+
Max: 35
|
22
|
+
Style/MultilineBlockChain:
|
23
|
+
Enabled: false
|
24
|
+
Metrics/ClassLength:
|
25
|
+
Max: 120
|
26
|
+
Metrics/PerceivedComplexity:
|
27
|
+
Max: 9
|
28
|
+
Metrics/CyclomaticComplexity:
|
29
|
+
Max: 9
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.2
|
data/CHANGELOG
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
== 0.10.0
|
2
|
+
|
3
|
+
* RSpec::Matchers::MatcherError used is removed from RSpec
|
4
|
+
(https://github.com/rspec/rspec-expectations/commit/e031971317884815f2397c70ee9b02e467d0ef3c)
|
5
|
+
* Support for Rake::MockResponse which does not have method code
|
6
|
+
|
7
|
+
== 0.0.1
|
8
|
+
|
9
|
+
* Matchers for HTTP response codes
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at smapira@routeflags.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspec-css (0.0.1)
|
5
|
+
capybara
|
6
|
+
puma
|
7
|
+
rack
|
8
|
+
rspec
|
9
|
+
selenium-webdriver
|
10
|
+
webdrivers
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
addressable (2.7.0)
|
16
|
+
public_suffix (>= 2.0.2, < 5.0)
|
17
|
+
ast (2.4.0)
|
18
|
+
capybara (3.32.2)
|
19
|
+
addressable
|
20
|
+
mini_mime (>= 0.1.3)
|
21
|
+
nokogiri (~> 1.8)
|
22
|
+
rack (>= 1.6.0)
|
23
|
+
rack-test (>= 0.6.3)
|
24
|
+
regexp_parser (~> 1.5)
|
25
|
+
xpath (~> 3.2)
|
26
|
+
childprocess (3.0.0)
|
27
|
+
diff-lcs (1.3)
|
28
|
+
mini_mime (1.0.2)
|
29
|
+
mini_portile2 (2.4.0)
|
30
|
+
nio4r (2.5.2)
|
31
|
+
nokogiri (1.10.9)
|
32
|
+
mini_portile2 (~> 2.4.0)
|
33
|
+
parallel (1.19.1)
|
34
|
+
parser (2.7.1.2)
|
35
|
+
ast (~> 2.4.0)
|
36
|
+
public_suffix (4.0.5)
|
37
|
+
puma (4.3.3)
|
38
|
+
nio4r (~> 2.0)
|
39
|
+
rack (2.2.2)
|
40
|
+
rack-test (1.1.0)
|
41
|
+
rack (>= 1.0, < 3)
|
42
|
+
rainbow (3.0.0)
|
43
|
+
rake (13.0.1)
|
44
|
+
regexp_parser (1.7.0)
|
45
|
+
rexml (3.2.4)
|
46
|
+
rspec (3.9.0)
|
47
|
+
rspec-core (~> 3.9.0)
|
48
|
+
rspec-expectations (~> 3.9.0)
|
49
|
+
rspec-mocks (~> 3.9.0)
|
50
|
+
rspec-core (3.9.2)
|
51
|
+
rspec-support (~> 3.9.3)
|
52
|
+
rspec-expectations (3.9.2)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.9.0)
|
55
|
+
rspec-mocks (3.9.1)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.9.0)
|
58
|
+
rspec-support (3.9.3)
|
59
|
+
rubocop (0.83.0)
|
60
|
+
parallel (~> 1.10)
|
61
|
+
parser (>= 2.7.0.1)
|
62
|
+
rainbow (>= 2.2.2, < 4.0)
|
63
|
+
rexml
|
64
|
+
ruby-progressbar (~> 1.7)
|
65
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
66
|
+
ruby-progressbar (1.10.1)
|
67
|
+
rubyzip (2.3.0)
|
68
|
+
selenium-webdriver (3.142.7)
|
69
|
+
childprocess (>= 0.5, < 4.0)
|
70
|
+
rubyzip (>= 1.2.2)
|
71
|
+
unicode-display_width (1.7.0)
|
72
|
+
webdrivers (4.3.0)
|
73
|
+
nokogiri (~> 1.6)
|
74
|
+
rubyzip (>= 1.3.0)
|
75
|
+
selenium-webdriver (>= 3.0, < 4.0)
|
76
|
+
xpath (3.2.0)
|
77
|
+
nokogiri (~> 1.8)
|
78
|
+
|
79
|
+
PLATFORMS
|
80
|
+
ruby
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
bundler
|
84
|
+
rake
|
85
|
+
rspec-css!
|
86
|
+
rubocop
|
87
|
+
|
88
|
+
BUNDLED WITH
|
89
|
+
2.1.4
|
data/LICENCE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 smapira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# rspec-css
|
2
|
+
|
3
|
+
[![CircleCI](https://circleci.com/bb/smapira/rspec-css.svg?style=svg)](https://circleci.com/bb/smapira/rspec-css)
|
4
|
+
|
5
|
+
Record your test suite's computed CSS during future test runs for deterministic and accurate tests.
|
6
|
+
|
7
|
+
## Features
|
8
|
+
|
9
|
+
Automatically records and replays your computed CSS each DOMs and 536 distinct property names interactions with minimal setup/configuration code.
|
10
|
+
|
11
|
+
## Motivation
|
12
|
+
|
13
|
+
Proud to present our newest line of gem, the test suite series. As you know, the CSS has been needing a large variety of case to bloated. This gem include simplest records and replays for comparing computed CSS each DOMs.
|
14
|
+
If you would kindly accept the deliverable, this gem willing to display differences the previous CSS and changed new one.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'rspec-css'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install rspec-css
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
### Run tests
|
35
|
+
|
36
|
+
Request target view using Capybara, then compare previous record the response CSS.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Capybara.default_driver = :selenium_chrome_headless
|
40
|
+
Capybara.app = Rack::File.new('spec/fixtures/files/')
|
41
|
+
visit 'sample.html'
|
42
|
+
files_path = 'spec/fixtures/files/sample.yml'
|
43
|
+
RSpec::CSS.print_silk(files_path, page) unless File.exist? files_path
|
44
|
+
css_file = File.open files_path, 'r'
|
45
|
+
expect(page).to eq_screen_css(css_file.read)
|
46
|
+
```
|
47
|
+
|
48
|
+
### Results
|
49
|
+
|
50
|
+
(compared using ==)
|
51
|
+
|
52
|
+
Diff:
|
53
|
+
@@ -17,7 +17,7 @@
|
54
|
+
animation-timing-function: ease
|
55
|
+
appearance: ''
|
56
|
+
azimuth: ''
|
57
|
+
- backface-visibility: hidden
|
58
|
+
+ backface-visibility: visible
|
59
|
+
background: rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box
|
60
|
+
background-attachment: scroll
|
61
|
+
background-blend-mode: normal
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/smapira/rspec-css. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
66
|
+
|
67
|
+
## License
|
68
|
+
|
69
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
70
|
+
|
71
|
+
## Code of Conduct
|
72
|
+
|
73
|
+
Everyone interacting in the rspec-css project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://bitbucket.org/smapira/rspec-css/blob/master/CODE_OF_CONDUCT.md).
|
74
|
+
|
75
|
+
## Inspired by, thanks.
|
76
|
+
|
77
|
+
- [vcr](https://github.com/vcr/vcr)
|
78
|
+
- [ValidationExamplesMatcher](https://github.com/speee/validation_examples_matcher)
|
data/Rakefile
ADDED
data/lib/rspec/css.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspec/core'
|
4
|
+
require 'rspec/expectations'
|
5
|
+
require 'rspec/css/version'
|
6
|
+
require 'capybara/rspec'
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
module RSpec
|
10
|
+
module CSS
|
11
|
+
# rubocop:disable Layout/LineLength
|
12
|
+
# referenced by 'List of CSS properties, both proposed and standard'
|
13
|
+
# 536 distinct property names
|
14
|
+
# @see https://www.w3.org/Style/CSS/all-properties.en.html
|
15
|
+
CSS_PROPERTIES = %w[--* align-content align-items align-self alignment-baseline all animation
|
16
|
+
animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function appearance azimuth backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size baseline-shift block-overflow block-size block-step block-step-align block-step-insert block-step-round block-step-size bookmark-label bookmark-level bookmark-state border border-block border-block-color border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-block-style border-block-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-boundary border-collapse border-color border-end-end-radius border-end-start-radius border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-inline border-inline-color border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-inline-style border-inline-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-start-end-radius border-start-start-radius border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing box-snap break-after break-before break-inside caption-side caret caret-color caret-shape chains clear clip clip-path clip-rule color color-adjust color-interpolation-filters color-scheme column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns contain content continue counter-increment counter-reset counter-set cue cue-after cue-before cursor direction display dominant-baseline elevation empty-cells fill fill-break fill-color fill-image fill-opacity fill-origin fill-position fill-repeat fill-rule fill-size filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float float-defer float-offset float-reference flood-color flood-opacity flow flow-from flow-into font font-family font-feature-settings font-kerning font-language-override font-optical-sizing font-palette font-size font-size-adjust font-stretch font-style font-synthesis font-synthesis-small-caps font-synthesis-style font-synthesis-weight font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-emoji font-variant-ligatures font-variant-numeric font-variant-position font-variation-settings font-weight footnote-display footnote-policy forced-color-adjust gap glyph-orientation-vertical grid grid-area grid-auto-columns grid-auto-flow grid-auto-rows grid-column grid-column-end grid-column-start grid-row grid-row-end grid-row-start grid-template grid-template-areas grid-template-columns grid-template-rows hanging-punctuation height hyphenate-character hyphenate-limit-chars hyphenate-limit-last hyphenate-limit-lines hyphenate-limit-zone hyphens image-orientation image-rendering image-resolution initial-letters initial-letters-align initial-letters-wrap inline-size inline-sizing inset inset-block inset-block-end inset-block-start inset-inline inset-inline-end inset-inline-start isolation justify-content justify-items justify-self left letter-spacing lighting-color line-break line-clamp line-grid line-height line-height-step line-padding line-snap list-style list-style-image list-style-position list-style-type margin margin-block margin-block-end margin-block-start margin-bottom margin-break margin-inline margin-inline-end margin-inline-start margin-left margin-right margin-top margin-trim marker marker-end marker-knockout-left marker-knockout-right marker-mid marker-pattern marker-segment marker-side marker-start mask mask-border mask-border-mode mask-border-outset mask-border-repeat mask-border-slice mask-border-source mask-border-width mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size mask-type max-block-size max-height max-inline-size max-lines max-width min-block-size min-height min-inline-size min-width mix-blend-mode nav-down nav-left nav-right nav-up object-fit object-position offset offset-after offset-anchor offset-before offset-distance offset-end offset-path offset-position offset-rotate offset-start opacity order orphans outline outline-color outline-offset outline-style outline-width overflow overflow-anchor overflow-block overflow-inline overflow-wrap overflow-x overflow-y overscroll-behavior overscroll-behavior-block overscroll-behavior-inline overscroll-behavior-x overscroll-behavior-y padding padding-block padding-block-end padding-block-start padding-bottom padding-inline padding-inline-end padding-inline-start padding-left padding-right padding-top page page-break-after page-break-before page-break-inside pause pause-after pause-before perspective perspective-origin pitch pitch-range place-content place-items place-self play-during position quotes region-fragment resize rest rest-after rest-before richness right rotate row-gap ruby-align ruby-merge ruby-overhang ruby-position running scale scroll-behavior scroll-margin scroll-margin-block scroll-margin-block-end scroll-margin-block-start scroll-margin-bottom scroll-margin-inline scroll-margin-inline-end scroll-margin-inline-start scroll-margin-left scroll-margin-right scroll-margin-top scroll-padding scroll-padding-block scroll-padding-block-end scroll-padding-block-start scroll-padding-bottom scroll-padding-inline scroll-padding-inline-end scroll-padding-inline-start scroll-padding-left scroll-padding-right scroll-padding-top scroll-snap-align scroll-snap-stop scroll-snap-type scrollbar-color scrollbar-gutter scrollbar-width shape-image-threshold shape-inside shape-margin shape-outside spatial-navigation-action spatial-navigation-contain spatial-navigation-function speak speak-as speak-header speak-numeral speak-punctuation speech-rate stress string-set stroke stroke-align stroke-alignment stroke-break stroke-color stroke-dash-corner stroke-dash-justify stroke-dashadjust stroke-dasharray stroke-dashcorner stroke-dashoffset stroke-image stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-origin stroke-position stroke-repeat stroke-size stroke-width tab-size table-layout text-align text-align-all text-align-last text-combine-upright text-decoration text-decoration-color text-decoration-line text-decoration-skip text-decoration-skip-box text-decoration-skip-ink text-decoration-skip-inset text-decoration-skip-self text-decoration-skip-spaces text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-skip text-emphasis-style text-group-align text-indent text-justify text-orientation text-overflow text-shadow text-space-collapse text-space-trim text-spacing text-transform text-underline-offset text-underline-position text-wrap top transform transform-box transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function translate unicode-bidi user-select vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-range voice-rate voice-stress voice-volume volume white-space widows width will-change word-boundary-detection word-boundary-expansion word-break word-spacing word-wrap wrap-after wrap-before wrap-flow wrap-inside wrap-through writing-mode z-index].freeze
|
17
|
+
# rubocop:enable Layout/LineLength
|
18
|
+
|
19
|
+
def self.register(matchers = RSpec::Matchers)
|
20
|
+
matchers.define :eq_screen_css do |expected|
|
21
|
+
match do |actual|
|
22
|
+
screen = {}
|
23
|
+
actual.all(:xpath, '//*').each_with_index do |x, i|
|
24
|
+
screen["#{i}_#{x.tag_name}"] = x.style(CSS_PROPERTIES)
|
25
|
+
end
|
26
|
+
@actual = screen.to_yaml
|
27
|
+
expected == @actual
|
28
|
+
end
|
29
|
+
|
30
|
+
failure_message do |_|
|
31
|
+
"\nexpected: #{expected}\n got: #{@actual}\n\n(compared using ==)\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
failure_message_when_negated do |_|
|
35
|
+
"\nexpected: value != #{expected}\n got: #{@actual}\n\n(compared using ==)\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
description do
|
39
|
+
"eq_screen_css #{expected}"
|
40
|
+
end
|
41
|
+
|
42
|
+
diffable
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.print_silk(store_path, page_session)
|
47
|
+
screen = {}
|
48
|
+
page_session.all(:xpath, '//*').each_with_index do |x, i|
|
49
|
+
screen["#{i}_#{x.tag_name}"] = x.style(CSS_PROPERTIES)
|
50
|
+
end
|
51
|
+
File.open store_path, 'w' do |file|
|
52
|
+
file.write(screen.to_yaml)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
register
|
57
|
+
end
|
58
|
+
end
|
data/rspec-css.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rspec/css/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'rspec-css'
|
9
|
+
spec.version = RSpec::CSS::VERSION
|
10
|
+
spec.platform = Gem::Platform::RUBY
|
11
|
+
spec.authors = ['smapira']
|
12
|
+
spec.email = ['smapira@routeflags.com']
|
13
|
+
|
14
|
+
spec.summary = "Record your test suite's computed
|
15
|
+
CSS during future test runs for deterministic and accurate tests."
|
16
|
+
spec.description = "Record your test suite's computed
|
17
|
+
CSS during future test runs for deterministic and accurate tests."
|
18
|
+
spec.homepage = 'https://bitbucket.org/smapira/rspec-css'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
22
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
23
|
+
if spec.respond_to?(:metadata)
|
24
|
+
|
25
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
26
|
+
spec.metadata['source_code_uri'] = 'https://bitbucket.org/smapira/punch_time'
|
27
|
+
spec.metadata['changelog_uri'] = 'https://bitbucket.org/smapira/punch_time/blob/master/CHANGELOG.md'
|
28
|
+
else
|
29
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
30
|
+
'public gem pushes.'
|
31
|
+
end
|
32
|
+
|
33
|
+
# Specify which files should be added to the gem when it is released.
|
34
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
35
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
36
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
37
|
+
end
|
38
|
+
spec.bindir = 'exe'
|
39
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
40
|
+
spec.require_paths = ['lib']
|
41
|
+
|
42
|
+
spec.add_runtime_dependency 'capybara'
|
43
|
+
spec.add_runtime_dependency 'puma'
|
44
|
+
spec.add_runtime_dependency 'rack'
|
45
|
+
spec.add_runtime_dependency 'rspec'
|
46
|
+
spec.add_runtime_dependency 'selenium-webdriver'
|
47
|
+
spec.add_runtime_dependency 'webdrivers'
|
48
|
+
spec.add_development_dependency 'bundler'
|
49
|
+
spec.add_development_dependency 'rake'
|
50
|
+
spec.add_development_dependency 'rubocop'
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-css
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- smapira
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capybara
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: puma
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: selenium-webdriver
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webdrivers
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: |-
|
140
|
+
Record your test suite's computed
|
141
|
+
CSS during future test runs for deterministic and accurate tests.
|
142
|
+
email:
|
143
|
+
- smapira@routeflags.com
|
144
|
+
executables: []
|
145
|
+
extensions: []
|
146
|
+
extra_rdoc_files: []
|
147
|
+
files:
|
148
|
+
- ".circleci/config.yml"
|
149
|
+
- ".gitignore"
|
150
|
+
- ".rubocop.yml"
|
151
|
+
- ".ruby-version"
|
152
|
+
- CHANGELOG
|
153
|
+
- CODE_OF_CONDUCT.md
|
154
|
+
- Gemfile
|
155
|
+
- Gemfile.lock
|
156
|
+
- LICENCE
|
157
|
+
- README.md
|
158
|
+
- Rakefile
|
159
|
+
- lib/rspec/css.rb
|
160
|
+
- lib/rspec/css/version.rb
|
161
|
+
- rspec-css.gemspec
|
162
|
+
homepage: https://bitbucket.org/smapira/rspec-css
|
163
|
+
licenses:
|
164
|
+
- MIT
|
165
|
+
metadata:
|
166
|
+
homepage_uri: https://bitbucket.org/smapira/rspec-css
|
167
|
+
source_code_uri: https://bitbucket.org/smapira/punch_time
|
168
|
+
changelog_uri: https://bitbucket.org/smapira/punch_time/blob/master/CHANGELOG.md
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubygems_version: 3.0.3
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: Record your test suite's computed CSS during future test runs for deterministic
|
188
|
+
and accurate tests.
|
189
|
+
test_files: []
|