This project demonstrates how to connect to an Aerokube Moon instance using Playwright and Typescript for end-to-end testing. It includes basic sample example where you can create and extend script and can connect to your local instance.
This project was inspired by the lack of good and easily explained examples when I started using Moon with Playwright. :)
- Clone the repository.
- Navigate to the project directory:
cd your-repository
- Install the dependencies:
npm i
-
Update the
playwright.config.js
file with your Aerokube Moon instance URL:// Set Moon Host here const moonHost = 'moon.dataout.in.example.com';
And configure projects for major browsers, currently the chromium is set with the complete URL. The Playwright version is extracted from the package.json file and appended in the URL as playwright browser image works with the version dependency.
// playwright.config.js const { defineConfig } = require('@playwright/test'); module.exports = defineConfig({ projects: [ { name: 'chromium', use: { browserName: 'chromium', connectOptions: { wsEndpoint: `wss://${moonHost}/playwright/chromium/playwright-${playwrightVersion()}?headless=false&arg=--ignore-certificate-errors`, }, }, }, ], });
-
Update the
environment.config.js
file with your aplication URL,Currenly its pointing to saucedemo website for example.:export const environmentConfig = { baseUrl: 'https://www.saucedemo.com/', };
-
Demo Test Example is present in
tests
directory and Run your tests:npx playwright test
To show Playwright traffic add an environment variable:
$ DEBUG="pw:*" npm test
Your Name - pawangaria@gmail.com