Skip to content

Commit c9d711b

Browse files
authored
Merge pull request #1579 from Ishavyas9/main
Add Playwright reporter integration for capturing test case insights
2 parents a031019 + f8b23a0 commit c9d711b

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

docs/analytics-test-case-insights.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,44 @@ driver.executeScript(`lambda-testCase-end=${Name of test case}`)
117117

118118
```
119119
120-
### Capture by NPM Package for WebdriverIO
120+
### Capture by Playwright reporter
121+
122+
#### Step 1 - Configure your reporter in YAML
123+
124+
You can capture the test case insights by using the `reporter` configuration in your `YAML` file for capturing and seeing the test cases in our test case widgets on dashboard.
125+
126+
Here is a link to documentation for setting up the reporter for `PlaywrightJS`: [Click here](/docs/playwright-html-report/#step-1-update-your-playwright-configuration)
127+
128+
#### Step 2 - Add the code to lambdatest-setup file
129+
130+
Once, you have setup the `reporter` then the following code snippet should be added to your `lambdatest-setup.js` config.
131+
132+
```js title=lambdatest-
133+
try {
134+
const response = JSON.parse(await ltPage.evaluate(
135+
(_, data) => {
136+
return window.eval(data)
137+
},
138+
`lambdatest_action: ${JSON.stringify({ action: 'getTestDetails' })}`
139+
))
140+
141+
if (response?.data?.test_id) {
142+
testInfo.annotations.push({
143+
type: 'lt_test_id',
144+
description: response.data.test_id,
145+
})
146+
console.log('LambdaTest Test ID:', response.data.test_id)
147+
}
148+
} catch (err) {
149+
console.warn('Could not fetch LambdaTest test details:', err.message)
150+
}
151+
```
152+
153+
#### Step 3 - Execute the tests using HyperExecute
154+
155+
You can now, execute the tests on our `HyperExecute` platform and you can see the results captured in the `Test Case Widgets` on the dashboards.
156+
157+
## Capture by NPM Package for WebdriverIO
121158
122159
You can capture the test case insights by using the NPM Package. You need to add the following `NPM Package` in your test script. Here is the link to the NPM package: [wdio-lambdatest-test-case-analytics-service](https://www.npmjs.com/package/wdio-lambdatest-test-case-analytics-service)
123160

0 commit comments

Comments
 (0)