In this document:
-
Install your dependencies:
npm run bootstrap
-
Install e2e testing dependencies:
npm run install:qa
-
Configure
.env
file:- Create a `.env` file in the root folder - Copy the contents from `.env.example` to it - Fill the essential values
-
Run tests:
npm run test:qa
npm run test:performance
-
Create new test:
cd e2e_tests && npm run create_test {category_name} {test_name}
-
File Structure
src ├── __tests__/ │ ├── [category_name]/ | ├── [test_name].test.js ├── _config/ ├── _utils/ ├── objects/ ├── bootstrap.js
-
Playwright documents: We use playwright to run our tests so it's very useful to take a look at this documentation.
You can setup a browser with mobile or desktop viewport before runing each test starts and tear down the browser after runing each test like this:
```JS
const { setUp, tearDown, desktop_viewport, mobile_viewport } = require('@root/bootstrap');
beforeEach(async () => {
const out = await setUp(mobile_viewport); // for mobile viewport
const out = await setUp(desktop_viewport); // for desktop viewport
});
afterEach(async () => {
await tearDown(browser);
});
test('It shouls pass', () => {
// your test logic
});
```
You can create a page and navigate to `Home_Page` like this:
```JS
const { browser, context } = await setUp(mobile_viewport);
await context.addInitScript(replaceWebsocket);
const page = new Common(await context.newPage());
await page.navigate(); // navigate to HOME_URL (process.env.HOME_URL)
```
Now, you can use all helper functions in `@root/objects/common.js` to perform actions to the created page. Also, read [this](https://playwright.dev/docs/api/class-page) documentation to see more provided methods.