Playwright & Jest
Jest-Playwright allows you to run tests with Jest on browsers controlled with Playwright.
To get started, please install the package:
Next, specify these settings in your Jest configuration file (jest.config.js
):
Configure Jest-Playwright
To configure Jest Playwright, please create a new file called jest-playwright.config.js
and add this to the file:
module.exports = {
connectBrowserApp: {
wsEndpoint: 'wss://cloud.testingbot.com/playwright?key=api_key&secret=api_secret&browserName=edge&browserVersion=latest'
}
}
This instructs Jest Playwright to connect to the TestingBot browser grid and use the latest Chrome browser.
Run your first test
To create a test, create a new file called sample.spec.js
and add this to the file:
describe('Google', () => {
beforeAll(async () => {
await page.goto('https://google.com')
})
it('should display google text on page', async () => {
await expect(page).toMatch('google')
})
})
Now you can run your first test with Playwright on the TestingBot cloud:
This will open Google in a Chrome browser and verify if the word 'google' is on the page.
You should see something like this in your terminal after running the command:
This test will also appear in your Member Dashboard.