You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60-15Lines changed: 60 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ You can:
29
29
- increase the element dimensions screenshots
30
30
- use different comparison methods
31
31
-**NEW:** We now support Puppeteer with WebdriverIO
32
+
-**NEW:** You can now verify how your website will support tabbing with your keyboard, see also [here](./README.md#tabbing-through-a-website)
32
33
- and much more, see the [options here](./docs/OPTIONS.md)
33
34
34
35
The module is now based on the power of the new [`webdriver-image-comparison`](https://github.com/wswebcreation/webdriver-image-comparison) module. This is a lightweight module to retrieve the needed data and screenshots for all browsers / devices.
@@ -82,6 +83,18 @@ exports.config = {
82
83
blockOutToolBar:true,
83
84
// NOTE: When you are testing a hybrid app please use this setting
84
85
isHybridApp:true,
86
+
// Options for the tabbing image
87
+
tabbableOptions:{
88
+
circle:{
89
+
size:18,
90
+
fontSize:18,
91
+
// ...
92
+
},
93
+
line:{
94
+
color:'#ff221a', // hex-code or for example words like `red|black|green`
95
+
width:3,
96
+
},
97
+
}
85
98
// ... more options
86
99
}],
87
100
],
@@ -91,11 +104,6 @@ exports.config = {
91
104
92
105
More plugin options can be found [here](./docs/OPTIONS.md#plugin-options).
93
106
94
-
### DEV-TOOLS support
95
-
You can also use the Chrome DevTools as automation protocol in combination with this module. You don't need to do anything,
96
-
just change `automationProtocol: 'devtools'` in your config.
97
-
More information about how to use the DEV-TOOLS can be found in [this](https://webdriver.io/blog/2019/09/16/devtools.html) blog post.
98
-
99
107
### Writing tests
100
108
*wdio-image-comparison-service* is framework agnostic, meaning that you can use it with all the frameworks WebdriverIO supports like `Jasmine|Mocha`.
101
109
You can use it like this:
@@ -108,24 +116,30 @@ describe('Example', () => {
108
116
109
117
it('should save some screenshots', () => {
110
118
// Save a screen
111
-
browser.saveScreen('examplePaged', { /* some options*/ });
119
+
browser.saveScreen('examplePaged', { /* some options*/ });
112
120
113
121
// Save an element
114
-
browser.saveElement($('#element-id'), 'firstButtonElement', { /* some options*/ });
122
+
browser.saveElement($('#element-id'), 'firstButtonElement', { /* some options */ });
123
+
124
+
// Save a full page screenshot
125
+
browser.saveFullPageScreen('fullPage', { /* some options */ });
115
126
116
-
// Save a full page screens
117
-
browser.saveFullPageScreen('fullPage', { /* some options*/ });
127
+
// Save a full page screenshot with all tab executions
128
+
browser.saveTabbablePage('save-tabbable', { /* some options, use the same options as for saveFullPageScreen */ });
118
129
});
119
130
120
131
it('should compare successful with a baseline', () => {
121
132
// Check a screen
122
-
expect(browser.checkScreen('examplePaged', { /* some options*/ })).toEqual(0);
133
+
expect(browser.checkScreen('examplePaged', { /* some options*/ })).toEqual(0);
123
134
124
135
// Check an element
125
-
expect(browser.checkElement($('#element-id'), 'firstButtonElement', { /* some options*/ })).toEqual(0);
136
+
expect(browser.checkElement($('#element-id'), 'firstButtonElement', { /* some options*/ })).toEqual(0);
126
137
127
-
// Check a full page screens
128
-
expect(browser.checkFullPageScreen('fullPage', { /* some options*/ })).toEqual(0);
138
+
// Check a full page screenshot
139
+
expect(browser.checkFullPageScreen('fullPage', { /* some options */ })).toEqual(0);
140
+
141
+
// Check a full page screenshot with all tab executions
142
+
expect(browser.checkTabbablePage('check-tabbable', { /* some options, use the same options as for checkFullPageScreen */ })).toEqual(0);
129
143
});
130
144
});
131
145
```
@@ -184,9 +198,40 @@ const checkResult = {
184
198
185
199
See the [Check output on failure](./docs/OUTPUT.md#check-output-on-failure) section in the [output](./docs/OUTPUT.md) docs for the images.
186
200
187
-
### Typescript support
201
+
### Tabbing through a website
202
+
We now support checking if a website is accessible through using the keyboards `TAB`-key. Testing this part of accessibility has always been a time consuming (manual) job and pretty hard to do through automation.
203
+
With the methods `saveTabbablePage` and `checkTabbablePage` you can now draw lines and dots on your website to verify the tabbing order.
204
+
205
+
Be aware of the fact that this is only useful for desktop browser and **NOT** for mobile devices. All desktop browsers are supporting this feature, see the browser matrix on the top of this page to check which desktop browsers and versions are supported.
206
+
207
+
> **NOTE:**<br>
208
+
> The work is inspired by [Viv Richards](https://github.com/vivrichards600) his blog post about ["AUTOMATING PAGE TABABILITY (IS THAT A WORD?) WITH VISUAL TESTING"](https://vivrichards.co.uk/accessibility/automating-page-tab-flows-using-visual-testing-and-javascript).<br>
209
+
> The way tabbable elements are selected are based on the module [tabbable](https://github.com/davidtheclark/tabbable). If there are any issues regarding the tabbing please check the [README.md](https://github.com/davidtheclark/tabbable/blob/master/README.md) and especially the [More details](https://github.com/davidtheclark/tabbable/blob/master/README.md#more-details)-section.
210
+
211
+
#### How does it work
212
+
Both methods will create a `canvas` element on your website and draw lines and dots to show you where your TAB would go if an end-user would use it. After that it will create a full page screenshot to give you a good overview of the flow.
188
213
189
-
Library supports typescript types. To your `tsconfig.json` add the following entry to `types`:
214
+
> **Use the `saveTabbablePage` only when you need to create a screenshot and DON'T want to compare it with a base line image.**
215
+
216
+
When you want to compare the tabbing flow with a baseline, then you can use the `checkTabbablePage`-method. You **DON'T** need to use the two methods together. If there is already a baseline image created, which can automatically be done by providing `autoSaveBaseline: true` when you instantiate the service,
217
+
the `checkTabbablePage` will first create the *actual* image and then compare it against the baseline.
218
+
219
+
##### Options
220
+
Both methods use the same options as the [`saveFullPageScreen`](https://github.com/wswebcreation/webdriver-image-comparison/blob/master/docs/OPTIONS.md#savefullpagescreen-or-savetabbablepage) or the
<span tabindex="4">This wouldn’t normally receive focus (4) largest value. Next tab will give focus to the rest of tabnavigable elements in code source order.</span>
18
+
<a href="#" >Link 1</a>
19
+
<a href="#">Link 2</a>
20
+
<a href="#">Link 3</a>
21
+
<a href="#">Link 4</a>
22
+
</pre>
23
+
24
+
<br><br>
25
+
26
+
<h2>Live elements</h2>
27
+
<p>
28
+
<inputtabindex="3"> (3) Will receive focus third<br><br>
29
+
<inputtabindex="0" style="margin-left: 50px"> (0) In normal source order<br><br>
30
+
<inputtabindex="-1" style="margin-left: 0"> (-1) Will not receive focus<br><br>
31
+
<input> (n/a) In normal source order<br><br>
32
+
<inputtabindex="2" style="margin-left: 20px"> (2) Will receive focus second<br><br>
33
+
<inputtabindex="1" style="margin-left: 0"> (1) Will receive focus first<br><br>
0 commit comments