Skip to content

Commit 912cbad

Browse files
authored
Merge pull request #2616 from RushilK7/stage
Update accessibility docs with on-demand scan hooks and auto-scan cap…
2 parents 0ce36a5 + 87b20eb commit 912cbad

2 files changed

Lines changed: 58 additions & 5 deletions

File tree

docs/accessibility-automation-test.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,38 @@ set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
114114
115115
### Step 3: Configure the Necessary Capabilities
116116
117-
To enable the accessibility testing within your automated test suite, set the `accessibility: true` in your configuration file. You can also define other settings capabilities as described below.
117+
To enable the accessibility testing within your automated test suite, set `accessibility: true` in your configuration file.
118+
119+
There are two primary ways to run accessibility tests:
120+
121+
#### 1. On-Demand Scans (via Hooks)
122+
For precise control over which pages are scanned, you can trigger scans manually at specific points in your test execution. This is the recommended approach to reduce test execution time and focus only on relevant pages.
123+
124+
To use this, simply enable accessibility in your capabilities:
125+
```java
126+
capability.setCapability("accessibility", true); // Enable accessibility testing
127+
```
128+
129+
Then, trigger the scan directly within your test script when the desired page is fully loaded:
130+
```java
131+
// Execute the LambdaTest accessibility scan hook
132+
driver.executeScript("lambda-accessibility-scan");
133+
```
134+
*Note: If you do not execute the hook in your script when using this method, no accessibility reports will be generated.*
135+
136+
#### 2. Continuous Auto-Scanning
137+
If you want the accessibility scanner to run automatically on every single page navigation throughout the entire test session without writing manual hooks, you can pass the `accessibility.autoscan` capability:
118138
119139
```java
120140
capability.setCapability("accessibility", true); // Enable accessibility testing
121-
capability.setCapability("accessibility.wcagVersion", "wcag21a"); // Specify WCAG version (e.g., WCAG 2.1 Level A)
141+
capability.setCapability("accessibility.autoscan", true); // Automatically scan all pages
142+
```
143+
144+
#### Advanced Capabilities
145+
You can also define other settings capabilities to refine your scan rules as described below:
146+
147+
```java
148+
capability.setCapability("accessibility.wcagVersion", "wcag21aa"); // Specify WCAG version (e.g., WCAG 2.1 Level AA)
122149
capability.setCapability("accessibility.bestPractice", false); // Exclude best practice issues from results
123150
capability.setCapability("accessibility.needsReview", true); // Include issues that need review
124151
```

docs/selenium-hyprerexecute-accessibility-tests.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,41 @@ set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
135135
</Tabs>
136136

137137
### Step 3: Add the Capabilities to enable the Accessibility
138-
To generate the accessibility reports, add a capability `accessibility: true` in your test files. You can also define some advanced capabilities like `accessibility.wcagVersion`, `accessibility.bestPractice`, and `accessibility.needsReview` as shown below:
139138

139+
To generate accessibility reports, you need to set the `accessibility: true` capability in your test files.
140+
141+
There are two primary ways to run accessibility tests on HyperExecute:
142+
143+
#### 1. On-Demand Scans (via Hooks)
144+
For precise control over which pages are scanned, you can trigger scans manually at specific points in your test execution. This is the recommended approach to reduce test execution time on the HyperExecute grid and focus only on relevant pages.
145+
146+
To use this, simply enable accessibility in your capabilities:
140147
```java title="test.java"
141148
capabilities.setCapability("accessibility", true); // Enable accessibility testing
142-
capabilities.setCapability("accessibility.wcagVersion", "wcag21a"); // Specify WCAG version (e.g., WCAG 2.1 Level A)
149+
```
150+
151+
Then, trigger the scan directly within your test script when the desired page is fully loaded:
152+
```java title="test.java"
153+
// Execute the LambdaTest accessibility scan hook
154+
driver.executeScript("lambda-accessibility-scan");
155+
```
156+
*Note: If you do not execute the hook in your script when using this method, no accessibility reports will be generated.*
157+
158+
#### 2. Continuous Auto-Scanning
159+
If you want the accessibility scanner to run automatically on every single page navigation throughout the entire test session without writing manual hooks, you must pass the `accessibility.autoscan` capability:
160+
161+
```java title="test.java"
162+
capabilities.setCapability("accessibility", true); // Enable accessibility testing
163+
capabilities.setCapability("accessibility.autoscan", true); // Automatically scan all pages
164+
```
165+
166+
#### Advanced Capabilities
167+
You can also define other settings capabilities to refine your scan rules:
168+
```java title="test.java"
169+
capabilities.setCapability("accessibility.wcagVersion", "wcag21aa"); // Specify WCAG version (e.g., WCAG 2.1 Level AA)
143170
capabilities.setCapability("accessibility.bestPractice", false); // Exclude best practice issues from results
144171
capabilities.setCapability("accessibility.needsReview", true); // Include issues that need review
145172
```
146-
147173
### Step 4: Configure your YAML file
148174
Configure your YAML file as per your use cases using **key value** pairs. In this sample YAML file, we have mentioned:
149175

0 commit comments

Comments
 (0)