Skip to content

Thel3leacH/rag-notes-app-automated-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Playwright Automated Testing Suite

πŸ“‹ Overview

This repository contains automated end-to-end (E2E) tests and API tests for a Notes Application using Playwright. The tests cover user registration (signup) validation and API-based login functionality.


πŸ§ͺ Test Cases

1. UI Tests - Registration (Signup)

TC-01: Signup - Email Already in Use

  • File: tests/register/verify_signup.spec.js
  • Description: Validates that the system prevents users from signing up with an email address that is already registered.
  • Test Steps:
    1. Navigate to signup page
    2. Fill Full Name: "boss test"
    3. Fill Email Address: "boss@test.com"
    4. Fill Password: "123456789"
    5. Fill Confirm Password: "123456789"
    6. Click "Sign Up" button
    7. Capture screenshot
  • Expected Result: Display error message "Email already in use"

TC-02: Signup - Password Mismatch

  • File: tests/register/verify_signup.spec.js
  • Description: Validates that the system prevents users from signing up when password and confirm password fields don't match.
  • Test Steps:
    1. Navigate to signup page
    2. Fill Full Name: "jrd test"
    3. Fill Email Address: "jrd@test.com"
    4. Fill Password: "123456789"
    5. Fill Confirm Password: "4567891230" (different password)
    6. Click "Sign Up" button
    7. Capture screenshot
  • Expected Result: Display error message "Passwords do not match."

2. API Tests - Login

TC-03: Login via API

  • File: tests/api/login_api.spec.js
  • Description: Validates that users can successfully authenticate using the API endpoint and receive a valid access token.
  • Test Steps:
    1. Send POST request to authentication endpoint
    2. Provide credentials (email: "apitest2@example.com", password: "123456789")
    3. Verify response status is OK (200)
    4. Validate access token is returned and not null
  • Expected Result: Response status 200 with valid access token in response

πŸ—‚οΈ Project Structure

playwright_boss/
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── login_api.spec.js           # API authentication tests
β”‚   β”œβ”€β”€ register/
β”‚   β”‚   └── verify_signup.spec.js       # Signup UI validation tests
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   └── auth.setup.js               # Authentication setup for UI tests
β”‚   └── login.spec.js                   # Login UI tests (requires auth)
β”œβ”€β”€ playwright-report/                  # Test reports
β”œβ”€β”€ test-results/                       # Test execution results
β”œβ”€β”€ playwright.config.js                # Playwright configuration
β”œβ”€β”€ package.json                        # Dependencies and scripts
└── Readme.MD                          # This file

πŸš€ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Installation

  1. Clone or navigate to the project directory:

    cd c:\Users\Admin\Desktop\playwright_boss
  2. Install dependencies:

    npm install
  3. Install Playwright browsers (if not already done):

    npx playwright install

▢️ Running Tests

Run All Tests

npx playwright test

Run Specific Test File

npx playwright test tests/register/verify_signup.spec.js
npx playwright test tests/api/login_api.spec.js

Run Specific Test Case

npx playwright test -g "TC-01"
npx playwright test -g "TC-02"
npx playwright test -g "TC-03"

Run Tests in Headed Mode (See Browser)

npx playwright test --headed

Run Tests for Specific Browser

npx playwright test --project=chromium
npx playwright test --project=firefox
npx playwright test --project=webkit

Run Authentication Setup First (for UI tests requiring login)

npx playwright test tests/auth/auth.setup.js --project=chromium

πŸ“Š Test Reports

After running tests, generate and view the HTML report:

npx playwright show-report

This will open an interactive report showing:

  • βœ… Passed tests
  • ❌ Failed tests
  • πŸ“Έ Screenshots
  • πŸŽ₯ Videos (if configured)
  • ⏱️ Test execution time

πŸ”§ Configuration

Playwright configuration is defined in playwright.config.js:

  • Browsers: Chromium, Firefox, WebKit
  • Base URL: Configured for the application
  • Screenshots: Automatically captured on failure
  • Timeout: Default 30 seconds per test

🌐 Test Environment


πŸ“ Test Scenarios Summary

Test Case Type Feature Status
TC-01 UI Duplicate Email Validation βœ… Passing
TC-02 UI Password Matching Validation βœ… Passing
TC-03 API User Authentication βœ… Passing

πŸ” Authentication Notes

  • UI tests that require authentication use the stored session state from tests/playwright/.auth/user.json
  • Run auth.setup.js once before running authenticated UI tests
  • API tests use direct HTTP requests with credentials

πŸ“Έ Screenshots

Screenshots are automatically captured:

  • On test failure (stored in test-results/)
  • On-demand within test code (examples: screenshot-example1.png, screenshot-example2.png)

πŸ› Troubleshooting

Issue: "Error reading storage state"

Solution: Run the authentication setup first:

npx playwright test tests/auth/auth.setup.js --project=chromium

Issue: Execution policy error (PowerShell)

Solution: Use cmd.exe instead:

cmd /c npx playwright test

Issue: Tests timing out

Solution: Increase timeout in playwright.config.js or individual tests


πŸ“š Learn More


πŸ“„ License

This project is for testing purposes.


πŸ‘€ Author

Jiradech Khong-ngoen

Created for automated testing of the RAG Notes Application

Last Updated: November 13, 2025

About

Automate testing with playwright

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors