This repository contains automated tests using Playwright with TypeScript, including test reporting with Allure.
Ensure you have the following installed before running the tests:
- Node.js (v16+ recommended)
- npm or yarn
- Allure Command-Line
Clone the repository and install dependencies:
git clone https://github.com/aljazarifoundation/PlaywrightTypeScriptFunctional.git
cd your-repo-name
npm install
To execute the tests, use:
npx playwright test
Execute tests with Allure reporting enabled:
npx playwright test --reporter=line,allure
To generate and open the Allure report:
npx allure generate allure-results --clean
npx allure open
To configure Allure reporting in Playwright:
-
Install Allure dependencies:
npm install --save-dev allure-playwright
-
Add the Allure reporter in
playwright.config.ts
:import { defineConfig } from '@playwright/test'; export default defineConfig({ reporter: [['line'], ['allure-playwright']], });
-
Ensure Allure results are stored in
allure-results
:mkdir -p allure-results
π 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
-
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
- Ensure
allure-results
is ignored in.gitignore
to prevent unnecessary commits. - Adjust
playwright.config.ts
to enable or disable reporters as needed.
Playwright-TypeScript.mp4
π Happy Testing!