This project includes tests for validating the Loan Details form in an application. The tests verify user inputs, uch ass loan amount, duration, use, person details, email, and phone number validation. It uses Playwright for end-to-end testing.
-
Clone the repository:
git clone <repo-url> cd <project-directory>
-
Install dependencies:
npm install
-
Install Playwright browsers:
npx playwright install --with-deps
-
Ensure you have Node.js installed.
-
Run the tests:
npx playwright test
-
You can specify which test to run using the
--project
flag if you have multiple configurations. For example:npx playwright test --project=firefox
The tests are written in Playwright and are organized into a page object model to keep the code clean and maintainable. The core files in the structure are:
loan-details-page.js
: Page Object class that encapsulates all interactions with the loan details form.loan-details.spec.js
: Spec file containing the test cases that validate different user inputs on the loan details form.
The tests are designed to verify the form submission with valid and invalid inputs for different fields.
- Verifies that an invalid loan amount triggers the appropriate error message.
- Verifies that the user can select a valid loan duration from predefined options.
- Verifies that the user can select a valid loan use category (e.g., "Bills / Expenses").
- Verifies that the user can select a valid title ("Mr.", "Mrs.").
- Verifies that the user can enter a valid first and last name.
- Verifies that the user can enter a valid date of birth.
- Verifies that the user can enter a valid email and shows an error for an invalid one.
- Verifies that the user’s UK mobile phone number is valid, with a regex validation for format.
This project aims to provide a solid framework for testing the loan details form, ensuring that all fields behave correctly and validations work as expected.