Skip to content

aljazarifoundation/PlaywrightTypeScriptFunctional

Repository files navigation

Playwright TypeScript Functional Tests

This repository contains automated tests using Playwright with TypeScript, including test reporting with Allure.

πŸ“Œ Prerequisites

Ensure you have the following installed before running the tests:

πŸš€ Installation

Clone the repository and install dependencies:

git clone https://github.com/aljazarifoundation/PlaywrightTypeScriptFunctional.git
cd your-repo-name
npm install

πŸƒ Running Tests

1️⃣ Run Tests with Playwright

To execute the tests, use:

npx playwright test

2️⃣ Run Tests and Generate Allure Report

Execute tests with Allure reporting enabled:

npx playwright test --reporter=line,allure

3️⃣ View Allure Report

To generate and open the Allure report:

npx allure generate allure-results --clean
npx allure open

πŸ› οΈ Allure Report Configuration

To configure Allure reporting in Playwright:

  1. Install Allure dependencies:

    npm install --save-dev allure-playwright
  2. Add the Allure reporter in playwright.config.ts:

    import { defineConfig } from '@playwright/test';
    
    export default defineConfig({
      reporter: [['line'], ['allure-playwright']],
    });
  3. Ensure Allure results are stored in allure-results:

    mkdir -p allure-results

πŸ“‚File Structure

πŸ“‚ PlaywrightTypeScriptFunctional
β”œβ”€β”€ πŸ“‚ tests           # Test scripts
β”œβ”€β”€ πŸ“‚ tests-examples  # Test scripts example from playwright
β”œβ”€β”€ πŸ“‚ test-results    # Test results
β”œβ”€β”€ .gitignore         # Ignore unnecessary files
β”œβ”€β”€ package.json       # Project dependencies
β”œβ”€β”€ package-lock.json  # Project dependencies
β”œβ”€β”€ playwright.config.ts # Playwright configuration
β”œβ”€β”€ generate-env.ts   # Environment variable setup (still issue)
β”œβ”€β”€ environment.properties # manual config environment
└── README.md         # Documentation

πŸ”₯ Additional Commands

  • Run a single test file:

    npx playwright test tests/example.spec.ts
    npx playwright test saucedemo_login.spec.spec.ts --ui
  • Debug a test:

    npx playwright test --debug

πŸ“ Notes

  • Ensure allure-results is ignored in .gitignore to prevent unnecessary commits.
  • Adjust playwright.config.ts to enable or disable reporters as needed.

πŸ“Ή video

Playwright-TypeScript.mp4

πŸš€ Happy Testing!

About

this is the main repository testing for automation web using playwright typescript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published