This repository contains two tests for verifying the phone number input field in an application form on the Monevo website. Each entry is incremental.
The tests validate both a valid UK mobile number and an invalid UK mobile number.
The tests do not proceed beyond the Marital Status stage of the application process.
- Clone the repository
- Open the solution in Visual Studio
- Open Test Explorer from the Test menu or use shortcut
Ctrl+E, T
- Click the play button to run all of the tests. Alternatively, you can run each test individually by clicking the play button next to the test name.
-
Enter the following on the CMD line; this will run in headed mode as this is currently defined in the Setup of the test suite:
dotnet test
-
To run tests with a specific browser, use:
$env:BROWSER="firefox"
dotnet test
-
To run tests on different browsers:
$env:BROWSER="webkit"
dotnet test
Note: Ensure you have the .NET SDK installed and the necessary dependencies restored before running the tests.
You can also run from the CMD line as well.
For further reading and instructions, visit Playwright Running and Debugging Tests
Code has been added to run a trace every time a test is executed. This is extremely useful for debugging issues and allows you to view images of each page visited.
A file named runCodegen.ps1
is included to run the codegen command.
Playwright can generate tests as you perform actions in the browser, making it a great way to quickly start testing. Playwright will analyze your page and determine the best locator, prioritizing role, text, and test ID locators. If multiple elements match the locator, it will refine the locator to uniquely identify the target element.
For further reading on Codegen, visit: Playwright Codegen Documentation