Skip to content

Commit b4848e4

Browse files
authored
Merge pull request #2109 from Ishavyas9/main
updated the pw accessibility
2 parents 4567ebc + 7b6a5f9 commit b4848e4

File tree

6 files changed

+46
-92
lines changed

6 files changed

+46
-92
lines changed
99 KB
Loading
26.3 KB
Loading
102 KB
Loading
104 KB
Loading

docs/playwright-accessibility-test.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,19 @@ set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
118118
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.
119119

120120
```javascript
121-
const capabilities = {
122-
'LT:Options': {
123-
..//
124-
"accessibility":true,
125-
"accessibility.wcagVersion":"wcag21a",
126-
"accessibility.bestPractice":true,
127-
"accessibility.needsReview":true
128-
}
129-
}
121+
const capabilities = {
122+
"accessibility": true,
123+
"accessibility.wcagVersion": "wcag21a",
124+
"accessibility.bestPractice": false,
125+
"accessibility.needsReview": true
126+
};
130127
```
131128

132129
### Step 4: Add the following add-on Script
133-
In your `lambdatest-setup.js` file add these three lines after your page creation command as shown below:
130+
LambdaTest uses an internal Chrome extension that powers accessibility scans and generates accessibility reports. In your `lambdatest-setup.js` file add these three lines after your page creation command as shown below:
134131

135132
```javascript
133+
// Load the extension for report generation of the accessibility tests
136134
await ltPage.goto("chrome://extensions/?id=johgkfjmgfeapgnbkmfkfkaholjbcnah");
137135
const secondToggleButton = ltPage.locator('#crToggle').nth(0);
138136
await secondToggleButton.click();
@@ -143,7 +141,11 @@ await secondToggleButton.click();
143141
Now execute your tests and visit the [Automation Dashboard](https://accounts.lambdatest.com/dashboard). Click on the Accessibility tab and check the report generated.
144142

145143
```bash
146-
node test
144+
npx playwright test --config=./playwright.config.js
147145
```
148146

147+
<img loading="lazy" src={require('../assets/images/accessibility-testing/playwright/playwright-accessibility-1.png').default} alt="automation-dashboard" className="doc_img"/> <br />
148+
149+
You can access the detailed accessibility report from the [Accessibility Automation Reports Dashboard](https://accessibility.lambdatest.com/automation)
150+
149151
<img loading="lazy" src={require('../assets/images/accessibility-testing/playwright/playwright-accessibility.png').default} alt="automation-dashboard" className="doc_img"/>

docs/run-nightwatch-tests-on-lambdatest-selenium-grid.md

Lines changed: 33 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ slug: nightwatch-with-selenium-running-nightwatch-automation-scripts-on-lambdate
2121

2222
import CodeBlock from '@theme/CodeBlock';
2323
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
24+
import Tabs from '@theme/Tabs';
25+
import TabItem from '@theme/TabItem';
2426

2527
<script type="application/ld+json"
2628
dangerouslySetInnerHTML={{ __html: JSON.stringify({
@@ -88,95 +90,39 @@ npm i
8890
Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest Selenium Grid. You can obtain these credentials from the [LambdaTest Automation Dashboard](https://automation.lambdatest.com/build) or through [LambdaTest Profile](https://accounts.lambdatest.com/login).
8991

9092
**Step 3:** Set LambdaTest `Username` and `Access Key` in environment variables.
91-
* For **Linux/macOS**:
92-
```bash
93-
export LT_USERNAME="YOUR_USERNAME" export LT_ACCESS_KEY="YOUR ACCESS KEY"
94-
```
95-
* For **Windows**:
96-
```bash
97-
set LT_USERNAME="YOUR_USERNAME" set LT_ACCESS_KEY="YOUR ACCESS KEY"
98-
```
93+
<Tabs className="docs__val">
94+
<TabItem value="bash" label="Linux / MacOS" default>
95+
<div className="lambdatest__codeblock">
96+
<CodeBlock className="language-bash">
97+
{`export LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
98+
export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
99+
</CodeBlock>
100+
</div>
101+
</TabItem>
102+
103+
<TabItem value="powershell" label="Windows" default>
104+
<div className="lambdatest__codeblock">
105+
<CodeBlock className="language-powershell">
106+
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
107+
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
108+
</CodeBlock>
109+
</div>
110+
</TabItem>
111+
</Tabs>
99112

100113
## Run Your First Test
101114
***
102115
### Sample Test with NightwatchJS
103116
Let’s check out a sample **Nightwatch** framework code running on LambdaTest Selenium Grid. This is a simple Nightwatch automation script that tests a sample to-do list app. The code marks two list items as done, adds a list item and then finally gives the total number of pending items as output.
104-
```js
105-
//googleTest.js
106-
107-
var https = require("https");
108-
var lambdaRestClient = require("@lambdatest/node-rest-client");
109-
var lambdaCredentials = {
110-
username: process.env.LT_USERNAME,
111-
accessKey: process.env.LT_ACCESS_KEY
112-
};
113-
var lambdaAutomationClient = lambdaRestClient.AutomationClient(
114-
lambdaCredentials
115-
);
116-
module.exports = {
117-
"@tags": ["test"],
118-
TodoTest: function(client) {
119-
client
120-
.url("https://lambdatest.github.io/sample-todo-app/")
121-
.waitForElementPresent("body", 1000)
122-
.setValue("input[id=sampletodotext]", "Complete LambdaTest tutorial.")
123-
.click("input[id=addbutton]")
124-
.pause(1000)
125-
.end();
126-
127-
},
128-
after: function(browser) {
129-
console.log("Closing down...");
130-
},
131-
afterEach: function(client, done) {
132-
if (
133-
process.env.LT_USERNAME &&
134-
process.env.LT_ACCESS_KEY &&
135-
client.capabilities &&
136-
client.capabilities["webdriver.remote.sessionid"]
137-
) {
138-
139-
lambdaAutomationClient.updateSessionById(
140-
client.capabilities["webdriver.remote.sessionid"],
141-
{ status_ind: client.currentTest.results.failed ? "failed" : "passed" },
142-
function(error, session) {
143-
console.log(error)
144-
if (!error) {
145-
client.pause(1000)
146-
done();
147-
}
148-
}
149-
);
150-
} else {
151-
console.log("Test Run Successfully!");
152-
client.pause(1000)
153-
done();
154-
}
155-
}
156-
};
117+
118+
```javascript title="googleTest.js" reference
119+
https://github.com/LambdaTest/nightwatch-selenium-sample/blob/master/tests/googleTest.js
157120
```
158121
### Configuration of Your Test Capabilities
159122
**Step 4:** Below is the `nightwatch.conf.js` file where we will be declaring the desired capabilities. Since we are using remote webdriver, we have to define which browser environment we want to run the test. We do that by passing browser environment details to LambdaTest Selenium Grid via desired capabilities class.
160123

161-
```js
162-
//nightwatch.conf.js
163-
164-
module.exports = (function(settings) {
165-
console.log(settings["test_settings"]["default"]["username"])
166-
if (process.env.LT_USERNAME) {
167-
settings["test_settings"]["default"]["username"] = process.env.LT_USERNAME;
168-
}
169-
if (process.env.LT_ACCESS_KEY) {
170-
settings["test_settings"]["default"]["access_key"] = process.env.LT_ACCESS_KEY;
171-
}
172-
if (process.env.SELENIUM_HOST) {
173-
settings.selenium.host = process.env.SELENIUM_HOST;
174-
}
175-
if (process.env.SELENIUM_PORT) {
176-
settings.selenium.host = process.env.SELENIUM_PORT;
177-
}
178-
return settings;
179-
})(require('./nightwatch.json'));
124+
```javascript title="nightwatch.conf.js" reference
125+
https://github.com/LambdaTest/nightwatch-selenium-sample/blob/master/nightwatch.conf.js
180126
```
181127
> You can generate capabilities for your test requirements with the help of our inbuilt **[Capabilities Generator tool](https://www.lambdatest.com/capabilities-generator/)**.
182128
@@ -186,7 +132,13 @@ module.exports = (function(settings) {
186132
```bash
187133
npm run single
188134
```
189-
Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on [LambdaTest automation dashboard](https://automation.lambdatest.com/build). LambdaTest Automation Dashboard will help you view all your text logs, screenshots and video recording for your entire automation tests.
135+
Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on [LambdaTest automation dashboard](https://automation.lambdatest.com/build).
136+
137+
<img loading="lazy" src={require('../assets/images/automation/nightwatch/nightwatch-2.png').default} alt="Image" className="doc_img"/> <br />
138+
139+
LambdaTest Automation Dashboard will help you view all your text logs, screenshots and video recording for your entire automation tests.
140+
141+
<img loading="lazy" src={require('../assets/images/automation/nightwatch/nightwatch-1.png').default} alt="Image" className="doc_img"/> <br />
190142

191143
## Running Your Parallel Tests Using Nightwatch Framework
192144
***

0 commit comments

Comments
 (0)