Skip to content

Commit

Permalink
feat: login test added
Browse files Browse the repository at this point in the history
  • Loading branch information
beemi committed Jan 6, 2024
1 parent 13eade1 commit 3d18e16
Show file tree
Hide file tree
Showing 14 changed files with 680 additions and 1,390 deletions.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
# Playwright UI Automation Framework
# 🎉 Playwright UI Automation Framework 🎉

This repository contains the UI automation framework for the [simple web application](https://ecommerce-playground.lambdatest.io/index.php?route=common/home)
The framework is built using [Playwright](https://playwright.dev/),
test are written in [Typescript](https://www.typescriptlang.org/),
and the test runner is [Jest](https://jestjs.io/),
and the test reporter is [Allure](https://docs.qameta.io/allure/),
and the test data is generated using [Faker](https://www.npmjs.com/package/faker),

![alt text](docs/playwright-logo.png)

## Installation
## Project Structure 🏷️

```angular2html
├───.github
│ └───workflows
├───docs # contains the documentation
├───config # contains the configuration files for each environment
│ ├───dev.env
│ ├───prod.env
│ └───qa.env
├───pages # contains the page objects for each page
| ├───home-page.ts
| ├───login-page.ts
| ├───product-page.ts
| ├───shopping-cart-page.ts
| └───checkout-page.ts
├───tests # contains the test files
| ├───checkout.test.ts
| ├───login.test.ts
| ├───product.test.ts
| ├───shopping-cart.test.ts
| └───test-data.ts
├───global-setup.ts # contains the global setup
├───playwright.config.ts # contains the playwright configuration
├───allure-results # contains the allure results
```

## Installation 🔨

```bash
npm init playwright@latest
Expand All @@ -17,5 +50,23 @@ npx playwright --version

```bash
npm test
```

### Reporting 📊

To generate the allure report, run the following command:

```bash
npm run generate:allure:report
```

To open the allure report, run the following command:

```bash

npm run open:allure:report
```

## Contact 📧

If you have any questions, please feel free to reach out to us at [beemi.raja@gmail.com](mailto:beemi.raja@gmail.com)
3 changes: 3 additions & 0 deletions config/dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BASE_URL=https://ecommerce-playground.lambdatest.io
USER_EMAIL_NAME=Rosalind.Douglas69@yahoo.com
USER_PASSWORD=bfowdJlkgkm5RQ6
3 changes: 3 additions & 0 deletions config/prod.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BASE_URL=https://ecommerce-playground.lambdatest.io/
USER_EMAIL_NAME=test@lambdatest.io
USER_PASSWORD=12345678
3 changes: 3 additions & 0 deletions config/stage.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BASE_URL=https://ecommerce-playground.lambdatest.io/
USER_EMAIL_NAME=test@lambdatest.io
USER_PASSWORD=12345678
10 changes: 3 additions & 7 deletions global-setup.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
let TEST_ENVIRONMENT = process.env.TEST_ENVIRONMENT

if (!TEST_ENVIRONMENT) {
TEST_ENVIRONMENT = process.env.TEST_ENVIRONMENT = 'qa'
throw new Error('TEST_ENVIRONMENT is not defined, please set it in your .env file')
}

async function globalSetup() {
const config = {
baseUrl: 'https://www.google.com',
testEnvironment: TEST_ENVIRONMENT,
testEnvironmentUrl: 'https://www.google.com',
testEnvironmentUsername: 'test',
}
console.log(`Running tests in ${TEST_ENVIRONMENT} environment`)
require('dotenv').config({ path: `./config/${TEST_ENVIRONMENT}.env` })
}

module.exports = globalSetup
Loading

0 comments on commit 3d18e16

Please sign in to comment.