1
1
---
2
- id : accessibility
3
2
title : Accessibility Testing
4
3
---
5
4
6
- As of version 1.2, Sauce Bindings supports the new Sauce Labs
5
+ As of version 1.2, Sauce Bindings supports the new Sauce Labs
7
6
[ Deque axe™ Integration] ( https://docs.saucelabs.com/basics/integrations/deque/index.html )
8
7
9
- * The Session classes now have a method to obtain accessibility results, which does two basic things:
10
- * Populates the new Accessibility tab in the Sauce Labs UI for a given job
11
- with the accessibility violations found during the test run.
12
- * Returns the specific violations found in the code. The format of these results varies by language, and it is left to the user
13
- to determine how best to make use of them in their code if so desired.
14
- * The Java code is implemented using Deque's [ Axe Core Maven HTML Jar] ( https://github.com/dequelabs/axe-core-maven-html )
15
- * This implementation provides access to all the advanced features.
16
- * As a wrapper, Sauce bindings provides 3 method signatures for getting accessibility results, as outlined below.
17
- * The Ruby and Python code is implemented with the new [ sa11y] ( https://github.com/saucelabs/sa11y ) project
18
- * Sa11y is a minimalist implementation of Deque's axe™ functionality.
19
- * The accessibility results method allows you to specify a different js library, the ability to turn off frame support,
20
- and the ability to turn on cross-origin frame support. Examples are provided below.
21
-
22
8
import Tabs from '@theme/Tabs ';
23
9
import TabItem from '@theme/TabItem ';
24
10
25
11
<Tabs
26
12
defaultValue="java"
27
13
values={[
28
- { label: 'Java', value: 'java', },
29
- { label: 'Python', value: 'python', },
30
- { label: 'Ruby', value: 'ruby', },
31
- { label: 'C#', value: 'csharp', },
14
+ { label: 'Java', value: 'java', }
32
15
]
33
16
}>
34
17
@@ -37,61 +20,44 @@ values={[
37
20
<Tabs
38
21
defaultValue="junit5"
39
22
values={[
40
- { label: 'JUnit 5', value: 'junit5', },
41
- { label: 'JUnit 4', value: 'junit4', },
42
- { label: 'TestNG', value: 'testng', },
43
- { label: 'Direct', value: 'direct', },
23
+ { label: 'JUnit 5', value: 'junit5', }
44
24
]
45
25
}>
46
26
47
27
<TabItem value =" junit5 " >
48
28
49
29
``` java reference
50
- https: // github.com/saucelabs/sauce_bindings/tree/website-1.2.0/java/junit5/src/test/java/com/saucelabs/saucebindings/junit5/examples/AccessibilityTest.java
51
- ```
52
-
53
- </TabItem >
54
- <TabItem value =" junit4 " >
55
-
56
- ``` java reference
57
- https: // github.com/saucelabs/sauce_bindings/tree/website-1.2.0/java/junit4/src/test/java/com/saucelabs/saucebindings/junit4/examples/AccessibilityTest.java
58
- ```
59
-
60
- </TabItem >
61
- <TabItem value =" testng " >
62
-
63
- ``` java reference
64
- https: // github.com/saucelabs/sauce_bindings/tree/website-1.2.0/java/testng/src/test/java/com/saucelabs/saucebindings/testng/examples/AccessibilityTest.java
65
- ```
66
-
67
- </TabItem >
68
- <TabItem value =" direct " >
30
+ import com.deque.html.axecore.results.Results ;
31
+ import com.saucelabs.saucebindings.SauceSession ;
32
+ import com.saucelabs.saucebindings.junit5.SauceBindingsExtension ;
33
+ import org.junit.jupiter.api.BeforeEach ;
34
+ import org.junit.jupiter.api.Test ;
35
+ import org.junit.jupiter.api.extension.RegisterExtension ;
36
+ import org.openqa.selenium.WebDriver ;
37
+
38
+ public class AccessibilityExample {
39
+ WebDriver driver;
40
+ SauceSession session;
41
+
42
+ @RegisterExtension static SauceBindingsExtension sauceExtension = new SauceBindingsExtension ();
43
+
44
+ @BeforeEach
45
+ public void storeVariables () {
46
+ session = sauceExtension. getSession();
47
+ driver = sauceExtension. getDriver();
48
+ }
49
+
50
+ @Test
51
+ public void accessibilityExample () {
52
+ driver. get(" https://www.saucedemo.com/" );
53
+ Results accessibilityResults = session. getAccessibilityResults();
54
+ }
55
+ }
69
56
70
- ``` java reference
71
- https: // github.com/saucelabs/sauce_bindings/tree/website-1.2.0/java/main/src/test/java/com/saucelabs/saucebindings/examples/AccessibilityTest.java
72
57
```
73
58
74
59
</TabItem >
75
60
</Tabs >
76
61
77
- </TabItem >
78
- <TabItem value =" python " >
79
-
80
- ``` python reference
81
- https:// github.com/ saucelabs/ sauce_bindings/ tree/ website- 1.2 .0/ python/ tests/ examples/ test_accessibility.py
82
- ```
83
-
84
- </TabItem >
85
- <TabItem value =" ruby " >
86
-
87
- ``` ruby reference
88
- https: // github.com/ saucelabs/ sauce_bindings/ tree/ website- 1.2 .0 / ruby/ spec/ examples/ accessibility_spec.rb
89
- ```
90
-
91
- </TabItem >
92
- <TabItem value =" csharp " >
93
-
94
- ** C# bindings are coming soon...**
95
-
96
62
</TabItem >
97
63
</Tabs >
0 commit comments