This Cypress test suite automates the process of submitting your weekly payroll timesheet for all weekdays on payroll sites powered by Oncore. The suite includes a test case for adding timesheet entries for each weekday and submitting the timesheet.
Note: You may need to periodically update the rateDropdown
select value in cypress/support/commands.js
, at intervals of a few months.
Before running the test, ensure you have the following prerequisites installed:
- Node.js (version 12 or higher) - A JavaScript runtime built on Chrome's V8 JavaScript engine.
- Cypress - A JavaScript end-to-end testing framework.
- Clone the repository:
git clone https://github.com/Sharma-IT/oncore-payroll-automation.git
- Change into the project directory:
cd oncore-payroll-automation
- Install the project dependencies:
npm install cypress
To securely manage login credentials and configuration, this project uses environment variables stored in a cypress.env.json
file at the root of the project. The file has the following format:
{
"username": "your-email@email.com",
"password": "your-password",
"oncorePayrollSite": "https://agency.oncoreservices.com/Pages/Login.aspx"
}
Make sure to replace your-email@email.com
and your-password
with your actual login credentials, and https://agency.oncoreservices.com/Pages/Login.aspx
with the URL of your Oncore-powered payroll site. These environment variables are automatically loaded by Cypress when you run the test, ensuring secure and flexible configuration.
To run the Cypress test in interactive mode, use the following command:
npx cypress open
Otherwise, if you want to use the CLI to run the test, use this command:
npx cypress run --spec cypress/e2e/timesheet-automation.cy.js
The test suite includes a single test case, Submit the timesheet of the current week
, which submits the weekly timesheet for all weekdays. The test case is defined in cypress/e2e/timesheet-automation.cy.js
.
Custom Cypress commands are defined in cypress/support/commands.js
:
cy.login()
: Logs in with the provided credentials.cy.addTimeSheetEntryFor(dayOfWeek)
: Adds a timesheet entry for a specific day of the week.cy.submitTimesheet()
: Submits the timesheet and verifies the success message.
Element selectors used in the test suite are defined in cypress/support/selectors.js
. These selectors improve test readability and maintainability by centralising element identification.
Pull requests are welcomed. For major changes, please open an issue first to discuss what you would like to change.
Shubham Sharma - My LinkedIn - shubhamsharma.emails@gmail.com.
This project is licensed under the GPL 3.0 License - see the LICENSE file for details.