{"id":22362854,"url":"https://github.com/lambdatest/smartui-jest-playwright-sample","last_synced_at":"2025-03-26T15:17:25.699Z","repository":{"id":242068895,"uuid":"637889864","full_name":"LambdaTest/smartui-jest-playwright-sample","owner":"LambdaTest","description":"This is a sample repository of Lambdatest - SmartUI Visual Regression testing tool for executing your visual comparison tests on cloud. ","archived":false,"fork":false,"pushed_at":"2023-05-08T17:44:17.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T16:19:35.859Z","etag":null,"topics":["autoamtion","cloud","testing-tools","visualregression"],"latest_commit_sha":null,"homepage":"https://www.lambdatest.com/visual-regression-testing","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LambdaTest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-08T16:16:46.000Z","updated_at":"2024-05-31T11:44:45.000Z","dependencies_parsed_at":"2024-05-31T13:41:50.491Z","dependency_job_id":"e9cc7015-3e6c-4c35-ae58-f45be8ff0dec","html_url":"https://github.com/LambdaTest/smartui-jest-playwright-sample","commit_stats":null,"previous_names":["lambdatest/smartui-jest-playwright-sample"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2Fsmartui-jest-playwright-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2Fsmartui-jest-playwright-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2Fsmartui-jest-playwright-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2Fsmartui-jest-playwright-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LambdaTest","download_url":"https://codeload.github.com/LambdaTest/smartui-jest-playwright-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245678900,"owners_count":20654738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoamtion","cloud","testing-tools","visualregression"],"created_at":"2024-12-04T17:12:07.122Z","updated_at":"2025-03-26T15:17:25.671Z","avatar_url":"https://github.com/LambdaTest.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LambdaTest SmartUI Playwright Jest Sample\r\n\r\nThis repository demonstrates how to use Jest and Playwright to run automated tests on LambdaTest's Selenium Grid, using the LambdaTest SmartUI - Visual Regression Testing.\r\n\r\n## Prerequisites\r\n\r\nBefore getting started, make sure you have the following installed:\r\n\r\n- [Node.js](https://nodejs.org/en/download/) (v12 or higher)\r\n- [npm](https://www.npmjs.com/get-npm) (v6 or higher)\r\n\r\n## Setup\r\n\r\n1. Clone the repository:\r\n\r\n```bash\r\ngit clone https://github.com/LambdaTest/smartui-jest-playwright-sample.git\r\ncd smartui-jest-playwright-sample\r\n```\r\n\r\n2. Install the dependencies:\r\n\r\n```bash\r\nnpm install\r\n```\r\n\r\n3. Configure your LambdaTest credentials:\r\n\r\nSet the `LT_USERNAME` and `LT_ACCESS_KEY` environment variables with your LambdaTest username and access key, or directly replace `\u003cyour username\u003e` and `\u003cyour accessKey\u003e` in the `credentials` object in the test file.\r\n\r\n```javascript\r\nconst credentials = {\r\n    user: process.env.LT_USERNAME || '\u003cyour username\u003e',\r\n    key: process.env.LT_ACCESS_KEY || '\u003cyour accessKey\u003e',\r\n};\r\n```\r\n\r\n## Running the Test\r\n\r\nTo run the test, execute the following command:\r\n\r\n```bash\r\nnpx jest\r\n```\r\n\r\nThis will connect to the LambdaTest Selenium Grid using Playwright and run the test using Jest. The test checks the title of the LambdaTest homepage and takes a screenshot.\r\n\r\n## Test Structure\r\n\r\nThe test file contains the following code snippet:\r\n\r\n```javascript\r\nconst playwright = require('playwright');\r\nconst credentials = {...};\r\nconst capabilities = {...};\r\n\r\ndescribe('LambdaTest SmartUI Playwright Jest Sample', () =\u003e {\r\n    test('Check LambdaTest Homepage Title', async () =\u003e {\r\n        ...\r\n    });\r\n});\r\n```\r\n\r\n- `playwright`: The required Playwright library.\r\n- `credentials`: The object containing your LambdaTest username and access key.\r\n- `capabilities`: The object containing the browser and platform configurations and LambdaTest specific options.\r\n- `describe` and `test`: Jest functions to define the test suite and individual tests.\r\n\r\n## SmartUI WebHook\r\n\r\nReplace with your `Screenshot Name` according to your choice to capture on the SmartUI Dashboard for viewing the results [here](https://smartui.lambdatest.com)\r\n\r\n```javascript\r\n// Add a relevant screenshot name here\r\n        await page.evaluate((_) =\u003e { },\r\n            `lambdatest_action: ${JSON.stringify({ action: \"smartui.takeScreenshot\", arguments: { fullPage: true, screenshotName: \"\u003cYour Screenshot Name\u003e\" } })}`);\r\n```\r\n\r\n## Troubleshooting\r\n\r\nIf you encounter any issues, try running the test with the `--detectOpenHandles` flag to identify any open handles or pending asynchronous operations that may prevent Jest from exiting properly:\r\n\r\n```bash\r\nnpx jest --detectOpenHandles\r\n```\r\n\r\n## Contributing\r\n\r\nIf you have any suggestions, improvements, or bug fixes, feel free to submit a pull request or create an issue.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdatest%2Fsmartui-jest-playwright-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdatest%2Fsmartui-jest-playwright-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdatest%2Fsmartui-jest-playwright-sample/lists"}