percy-selenium 1.1.2.pre.beta.0 → 1.1.2
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 +133 -0
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6479ecd72851c243d9e31660d690bb4f0a85447715418612c0af5b7c33e3a7e
|
|
4
|
+
data.tar.gz: 172072160f5612dbf40d82c6f1703627bbf04aa7ef245b29b9aca7668875b667
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5111c9ba7c89adf7e11cb58278333c3a650ffa3d3276291654d0c4fee6c6a66f9b883a84bbb9597f739bdd77155496825a0f04fd0f2bf3ff771c6bf2c200394
|
|
7
|
+
data.tar.gz: 37d6c0a4a53942f8574dd73dbb0cc5d7043819e21983306fe6800cca355e0f0db8c2976f53935cdbef019cf2fa72b7c2794837149d1c78af342d77df9327400f
|
data/README.md
CHANGED
|
@@ -62,3 +62,136 @@ $ percy exec -- [ruby test command]
|
|
|
62
62
|
- `driver` (**required**) - A selenium-webdriver driver instance
|
|
63
63
|
- `name` (**required**) - The snapshot name; must be unique to each snapshot
|
|
64
64
|
- `options` - [See per-snapshot configuration options](https://www.browserstack.com/docs/percy/take-percy-snapshots/overview#per-snapshot-configuration)
|
|
65
|
+
|
|
66
|
+
## Running Percy on Automate
|
|
67
|
+
`Percy.percy_screenshot(driver, name, options)` [ needs @percy/cli 1.27.0-beta.0+ ]
|
|
68
|
+
|
|
69
|
+
This is an example test using the `percy_screenshot` method.
|
|
70
|
+
|
|
71
|
+
``` ruby
|
|
72
|
+
require 'percy'
|
|
73
|
+
|
|
74
|
+
capabilities = {
|
|
75
|
+
'browserName' => 'chrome',
|
|
76
|
+
'bstack:options' => {
|
|
77
|
+
'userName' => '<your-username>',
|
|
78
|
+
'accessKey' => '<your-access-key>'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
driver = Selenium::WebDriver.for(
|
|
83
|
+
:remote,
|
|
84
|
+
url: 'https://hub-cloud.browserstack.com/wd/hub',
|
|
85
|
+
capabilities: capabilities
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
driver.navigate.to "https://example.com"
|
|
89
|
+
|
|
90
|
+
# Take a Percy screenshot
|
|
91
|
+
Percy.percy_screenshot(driver, 'Screenshot 1')
|
|
92
|
+
|
|
93
|
+
driver.navigate.to "https://google.com"
|
|
94
|
+
Percy.percy_screenshot(driver, 'Screenshot 2')
|
|
95
|
+
|
|
96
|
+
driver.quit
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- `driver` (**required**) - A Selenium driver instance
|
|
100
|
+
- `name` (**required**) - The screenshot name; must be unique to each screenshot
|
|
101
|
+
- `options` (**optional**) - There are various options supported by `percy_screenshot` to serve further functionality.
|
|
102
|
+
- `sync` - Boolean value by default it falls back to `false`, Gives the processed result around screenshot [From CLI v1.28.0-beta.0+]
|
|
103
|
+
- `fullPage` - Boolean value by default it falls back to `false`, Takes full page screenshot [From CLI v1.27.6+]
|
|
104
|
+
- `freezeAnimatedImage` - Boolean value by default it falls back to `false`, you can pass `true` and Percy will freeze image based animations.
|
|
105
|
+
- `freezeImageBySelectors` - List of selectors. Images will be frozen which are passed using selectors. For this to work `freezeAnimatedImage` must be set to true.
|
|
106
|
+
- `freezeImageByXpaths` - List of xpaths. Images will be frozen which are passed using xpaths. For this to work `freezeAnimatedImage` must be set to true.
|
|
107
|
+
- `percyCSS` - Custom CSS to be added to DOM before the screenshot being taken. Note: This gets removed once the screenshot is taken.
|
|
108
|
+
- `ignoreRegionXpaths` - List of xpaths. Elements in the DOM can be ignored using xpath.
|
|
109
|
+
- `ignoreRegionSelectors` - List of selectors. Elements in the DOM can be ignored using selectors.
|
|
110
|
+
- `ignoreRegionSeleniumElements` - List of Selenium WebElement. Elements can be ignored using selenium elements.
|
|
111
|
+
- `customIgnoreRegions` - List of custom objects. Elements can be ignored using custom boundaries. Just passing a simple hash for it like below.
|
|
112
|
+
- example: `{top: 10, right: 10, bottom: 120, left: 10}`
|
|
113
|
+
- In the above example it will draw a rectangle of ignore region as per given coordinates.
|
|
114
|
+
- `top` (int): Top coordinate of the ignore region.
|
|
115
|
+
- `bottom` (int): Bottom coordinate of the ignore region.
|
|
116
|
+
- `left` (int): Left coordinate of the ignore region.
|
|
117
|
+
- `right` (int): Right coordinate of the ignore region.
|
|
118
|
+
- `considerRegionXpaths` - List of xpaths. Elements in the DOM can be considered for diffing and will be ignored by Intelli Ignore using xpaths.
|
|
119
|
+
- `considerRegionSelectors` - List of selectors. Elements in the DOM can be considered for diffing and will be ignored by Intelli Ignore using selectors.
|
|
120
|
+
- `considerRegionSeleniumElements` - List of Selenium WebElement. Elements can be considered for diffing and will be ignored by Intelli Ignore using selenium elements.
|
|
121
|
+
- `customConsiderRegions` - List of custom objects. Elements can be considered for diffing and will be ignored by Intelli Ignore using custom boundaries.
|
|
122
|
+
- example: `{top: 10, right: 10, bottom: 120, left: 10}`
|
|
123
|
+
- In the above example a rectangle of consider region will be drawn.
|
|
124
|
+
- Parameters:
|
|
125
|
+
- `top` (int): Top coordinate of the consider region.
|
|
126
|
+
- `bottom` (int): Bottom coordinate of the consider region.
|
|
127
|
+
- `left` (int): Left coordinate of the consider region.
|
|
128
|
+
- `right` (int): Right coordinate of the consider region.
|
|
129
|
+
- `regions` - Parameter that allows users to apply snapshot options to specific areas of the page. This parameter is an array where each object defines a custom region with configurations.
|
|
130
|
+
- Parameters:
|
|
131
|
+
- `elementSelector` (optional, only one of the following must be provided, if this is not provided then full page will be considered as region)
|
|
132
|
+
- `boundingBox` (hash): Defines the coordinates and size of the region.
|
|
133
|
+
- `x` (number): X-coordinate of the region.
|
|
134
|
+
- `y` (number): Y-coordinate of the region.
|
|
135
|
+
- `width` (number): Width of the region.
|
|
136
|
+
- `height` (number): Height of the region.
|
|
137
|
+
- `elementXpath` (string): The XPath selector for the element.
|
|
138
|
+
- `elementCSS` (string): The CSS selector for the element.
|
|
139
|
+
- `algorithm` (mandatory)
|
|
140
|
+
- Specifies the snapshot comparison algorithm.
|
|
141
|
+
- Allowed values: `standard`, `layout`, `ignore`, `intelliignore`.
|
|
142
|
+
- `configuration` (required for `standard` and `intelliignore` algorithms, ignored otherwise)
|
|
143
|
+
- `diffSensitivity` (number): Sensitivity level for detecting differences.
|
|
144
|
+
- `imageIgnoreThreshold` (number): Threshold for ignoring minor image differences.
|
|
145
|
+
- `carouselsEnabled` (boolean): Whether to enable carousel detection.
|
|
146
|
+
- `bannersEnabled` (boolean): Whether to enable banner detection.
|
|
147
|
+
- `adsEnabled` (boolean): Whether to enable ad detection.
|
|
148
|
+
- `assertion` (optional)
|
|
149
|
+
- Defines assertions to apply to the region.
|
|
150
|
+
- `diffIgnoreThreshold` (number): The threshold for ignoring minor differences.
|
|
151
|
+
|
|
152
|
+
### Example Usage for regions
|
|
153
|
+
|
|
154
|
+
``` ruby
|
|
155
|
+
region1 = {
|
|
156
|
+
elementSelector: {
|
|
157
|
+
elementCSS: '.ad-banner'
|
|
158
|
+
},
|
|
159
|
+
algorithm: 'intelliignore',
|
|
160
|
+
configuration: {
|
|
161
|
+
diffSensitivity: 2,
|
|
162
|
+
imageIgnoreThreshold: 0.2,
|
|
163
|
+
carouselsEnabled: true,
|
|
164
|
+
bannersEnabled: true,
|
|
165
|
+
adsEnabled: true
|
|
166
|
+
},
|
|
167
|
+
assertion: {
|
|
168
|
+
diffIgnoreThreshold: 0.4
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# Using Percy.create_region helper
|
|
173
|
+
region2 = Percy.create_region(
|
|
174
|
+
algorithm: 'intelliignore',
|
|
175
|
+
diff_sensitivity: 3,
|
|
176
|
+
ads_enabled: true,
|
|
177
|
+
diff_ignore_threshold: 0.4
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
Percy.percy_screenshot(driver, 'Screenshot 1', regions: [region1, region2])
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Creating Percy on Automate build
|
|
184
|
+
Note: Automate Percy Token starts with `auto` keyword. The command can be triggered using `exec` keyword.
|
|
185
|
+
|
|
186
|
+
```sh-session
|
|
187
|
+
$ export PERCY_TOKEN=[your-project-token]
|
|
188
|
+
$ percy exec -- [ruby test command]
|
|
189
|
+
[percy] Percy has started!
|
|
190
|
+
[percy] [Ruby example] : Starting automate screenshot ...
|
|
191
|
+
[percy] Screenshot taken "Ruby example"
|
|
192
|
+
[percy] Stopping percy...
|
|
193
|
+
[percy] Finalized build #1: https://percy.io/[your-project]
|
|
194
|
+
[percy] Done!
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Refer to docs here: [Percy on Automate](https://www.browserstack.com/docs/percy/integrate/functional-and-visual)
|
data/lib/version.rb
CHANGED