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.
β
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```