Skip to content

chintan-qa/Playwright_demo_JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 

Repository files navigation

πŸ” ParaBank UI Test Automation – Playwright Framework

This project is a demo automation framework built using Playwright for testing the ParaBank demo banking application.

It is designed with industry-standard best practices for structure, maintainability, and continuous integration.

πŸš€ Features

βœ… Automated UI testing using Playwright
βœ… Page Object Model (POM) architecture
βœ… Centralized constants for selectors and messages
βœ… Modular data factory for test data management
βœ… GitHub Actions integrated for CI/CD
βœ… Clear and scalable project structure
βœ… Custom assertions and smart URL handling


πŸ“ Project Folder Structure

.github/workflows/

-playwright.yml – GitHub CI/CD workflow file

constants/

-messages.js – Common constants (messages, selectors, URLs)

datafactory/

-userFactory.js – Data factory for generating dynamic test data

pageobjects/

-signin_object.js – Page Object Model class for Sign In page

tests/

-SignIn.spec.js – Sample test spec

playwright.config.js – Playwright configuration (baseURL, timeouts, etc.)

package.json – NPM dependencies and scripts

README.md – Project documentation

πŸ›  Tech Stack

  • Playwright (JavaScript)
  • Node.js
  • GitHub Actions (for CI)
  • ParaBank demo site

🧱 Design Pattern: Page Object Model (POM)

All page-specific locators and actions are defined inside pageobjects/ for maintainability.

Example: signin_object.js
javascript

 constructor(page) { this.page = page; this.usernameInput = page.locator('input[name="username"]'); this.passwordInput = page.locator('input[name="password"]'); this.loginButton = page.locator('input[type="submit"]'); this.errorMessage = page.locator('p.error'); } async visitURL() { await this.page.goto('/'); await this.page.waitForLoadState('domcontentloaded'); await expect(this.page).toHaveTitle('ParaBank'); } async login(username, password) { await this.usernameInput.fill(username); await this.passwordInput.fill(password); await this.loginButton.click(); } async verifyLoginError(expectedMsg) { await expect(this.errorMessage).toHaveText(expectedMsg); } } module.exports = SignInPage;``` πŸ”„ Constants Example constants/messages.js: module.exports = { LOGIN_FAILURE: 'Please enter a username and password.', }; Usage in test: const CONSTANTS = require('../constants/messages'); await signInPage.verifyLoginError(CONSTANTS.LOGIN_FAILURE); πŸ§ͺ Running Tests Locally 1. Clone the repository git clone https://github.com/your-username/playwright-project.git cd playwright-project 2. Install dependencies npm install 3. Run tests npx playwright test 4. View HTML report npx playwright show-report πŸ“Œ Best Practices Followed βœ… Page Object Model (POM) βœ… No hard-coded values β€” uses constants βœ… Independent and reusable test methods βœ… Proper waits and assertions βœ… Clean and minimal code structure βœ… GitHub Actions for CI/CD ```πŸ‘€ Author Chintan Bhatt QA Automation Engineer``` 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published