test (e2e): Add new e2e testRigor tests (#2200)

E2e cover of the main functionalities
CI added to build.yml

Co-authored-by: Amanda Silva <amanda.silva@testrigor.com>
This commit is contained in:
Amanda
2025-02-25 13:14:26 -06:00
committed by GitHub
co-authored by Amanda Silva
parent 995010d92c
commit cfab62774c
28 changed files with 320 additions and 0 deletions
+6
View File
@@ -46,6 +46,12 @@ jobs:
- name: Run build
run: npm run build:prod
- name: Install testRigor Command Line
run: npm install -g --verbose testrigor-cli
- name: Run testRigor tests
run: . ./e2e/testRigor/run_testrigor_tests.sh
- name: Deploy to github pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
+67
View File
@@ -0,0 +1,67 @@
# Test Automation with testRigor for MIFOS
This document provides step-by-step instructions for setting up test automation for MIFOS using testRigor. It covers creating an account, setting up a test suite, and running tests using the testRigor CLI.
## Table of Contents
- [Creating an Account on testRigor](#creating-an-account-on-testrigor)
- [Running Tests with the CLI](#running-tests-with-the-cli)
- [Additional Resources](#additional-resources)
## Creating an Account on testRigor
1. **Visit the testRigor website:**
- Go to [testRigor](https://www.testrigor.com/).
2. **Sign up for a new account:**
- Click on the "Sign Up" button on the top right corner.
- Select the "Public Open Source" version.
- Fill in the required details and follow the instructions to complete the registration.
3. **Verify your email and log in:**
- Check your email inbox for a verification email from testRigor.
- Click on the verification link to activate your account.
- Once your account is activated, log in.
4. **Create a test sute:**
- After logging into your account, create a test suite.
## Running Tests with the CLI
1. **Install testRigor CLI:**
- Ensure you have Node.js installed on your machine (version 18 or higher).
- Install the testRigor CLI globally using npm:
```bash
npm install -g testrigor
```
2. **Obtain Required Parameters:**
- **Test Suite ID:** You can obtain the Test Suite ID in the URL of your test suite. If the URL is `https://app.testrigor.com/test-suites/12345`, then `12345` is your Test Suite ID.
- **Auth Token:** You can obtain your token from the "CI/CD integration" section on testRigor. Look for "auth-token" and copy the value next to it, which will be in the format `########-####-####-####-############`.
3. **Set Parameters in `run_testrigor_tests.sh`:**
- Before running the tests, create a .env file on the testRigor directory and set the following variables to the parameters you obtained:
- `MIFOS_TEST_SUITE_ID`: Set this variable to your Test Suite ID.
- `MIFOS_AUTH_TOKEN`: Set this variable to your auth token.
- `LOCALHOST_URL`: Set this variable to the URL where MIFOS
is running locally.
4. **Run Tests:**
```bash
./run_testrigor_tests.sh
```
5. **View Test Results:**
- You can view the results on testRigor by opening the link shown in the terminal.
## Additional Resources
- [testRigor Documentation](https://docs.testrigor.com/)
- [testRigor Command Line Documentation](https://testrigor.com/command-line/)
+1
View File
@@ -0,0 +1 @@
click "Close" below "Warning" if exists
+8
View File
@@ -0,0 +1,8 @@
click "Account Type"
click "INCOME"
generate unique name, then enter into "Account Name" and save as "glAccountName"
click "Account Usage"
click "DETAIL"
generate unique name, then enter into "GL Code" and save as "glCode"
click "Submit"
check that page doesn't contain "Submit"
+15
View File
@@ -0,0 +1,15 @@
click "Create User"
generate unique name, then enter into "First Name" and save as "firstName"
generate unique name, then enter into "Last Name" and save as "lastName"
generate unique name, then enter into "Username" and save as "username"
generate unique email, then enter into "Email" and save as "email"
click "Send password to email address"
save value "Mifos!123" as "password"
enter stored value "password" into "Password"
enter stored value "password" into "Repeat Password"
click "Office"
click "Head Office"
click "Roles"
click "Super User"
click "Submit"
click "Submit"
+11
View File
@@ -0,0 +1,11 @@
click "Create Client"
generate unique name, then enter into "First Name" and save as "firstName"
generate unique name, then enter into "Last Name" and save as "lastName"
generate from template "*******", then enter into "External ID" and save as "externalID"
click "Office"
click "Head Office"
pick-birthdate // birthDate
generate unique email, then enter into "Email Address" and save as "email"
generate from template "+##-###-###-####", then enter into "Mobile No" and save as "mobileNo"
click "Next"
click "Next"
@@ -0,0 +1,12 @@
click "Create Office"
generate unique name, then enter into "Office" and save as "officeName"
generate unique name, then enter into "External ID" and save as "externalID"
click "Parent Office"
click "Head Office"
pick-today-date
click "Submit"
// validate organization created
enter saved value "officeName" into "Filter"
check that page contains saved value "officeName" roughly below "Office Name"
check that page contains saved value "externalID" roughly below "External ID"
check that page contains string with parameters "${todayDayOfMonth} ${todayMonth} ${todayYear}" roughly below "Opened On"
@@ -0,0 +1,5 @@
enter saved value "username" into field "Username"
enter saved value "password" into field "Password"
click exactly "Login"
close-popup
check that page contains string with parameters "Welcome, ${username}!"
+2
View File
@@ -0,0 +1,2 @@
click third "menu" on the right of "Search"
click "Sign Out"
@@ -0,0 +1,3 @@
click "Accounting"
click "Chart of Accounts"
click "Add Account"
@@ -0,0 +1,2 @@
click "Admin"
click "Users" below "Admin"
@@ -0,0 +1,2 @@
click "Institution"
click "Clients" below "Institution"
@@ -0,0 +1,3 @@
click "Admin"
click "Organization" below "Admin"
click "Manage Offices"
+8
View File
@@ -0,0 +1,8 @@
click field "Date Of Birth"
click string with parameters "${todayMonthShort} ${todayYear}"
// calculate today year - 20 and save as birthYear
save expression "${todayYear} - 20" as "birthYear"
click exactly saved value "birthYear"
click saved value "todayMonthShort"
pick-today-date
save string with parameters "${todayDayOfMonth} ${todayMonth} ${birthYear}" as "birthDate"
+2
View File
@@ -0,0 +1,2 @@
click field "Opened On" if exists
click exactly saved value "todayDayOfMonth" roughly below saved value "todayMonthShort"
@@ -0,0 +1,4 @@
check that page contains field "Username"
check that page contains field "Password"
check that page contains button "Login"
check that page contains button "Forgot Password?"
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
COMMIT_NAME="$(git rev-parse --verify HEAD)"
# Define default values for missing variables
MIFOS_TEST_SUITE_ID="BqnXhRcaZ59ADvxHo"
MIFOS_AUTH_TOKEN="c3903536-0371-4ba3-afeb-69cf9b408ca6"
LOCALHOST_URL="http://localhost:4200"
# Paths for the test cases and rules files
TEST_CASES_PATH="e2e/testRigor/testcases/**/*.txt"
RULES_PATH="e2e/testRigor/rules/**/*.txt"
curl -I $LOCALHOST_URL:4200
# Command to run the tests using the testRigor CLI
testrigor test-suite run "$MIFOS_TEST_SUITE_ID" --token "$MIFOS_AUTH_TOKEN" --localhost --url "$LOCALHOST_URL" --test-cases-path "$TEST_CASES_PATH" --rules-path "$RULES_PATH" --branch "$BRANCH_NAME" --commit "$COMMIT_NAME"
@@ -0,0 +1,8 @@
log-in-and-validate
navigate-to-accounting-creation
create-account
click "Chart of Accounts"
//validate account created
check that page contains "Filter"
enter saved value "glAccountName" into "Filter"
check that page contains saved value "glAccountName" below saved value "glAccountName"
@@ -0,0 +1,16 @@
log-in-and-validate
navigate-to-admin-users-management
create-admin-user
check that page contains saved value "username" on the right of "Login Name"
check that page contains saved value "firstName" on the right of "First Name"
check that page contains saved value "lastName" on the right of "Last Name"
check that page contains saved value "email" on the right of "Email"
navigate-to-admin-users-management
//validate admin profile in table
enter saved value "firstName" into "Filter"
check that page contains saved value "firstName" below saved value "firstName"
check that page contains saved value "lastName" below saved value "firstName"
check that page contains saved value "email" below saved value "firstName"
//validate login new admin profile
logout
log-in-and-validate
+21
View File
@@ -0,0 +1,21 @@
log-in-and-validate
navigate-to-clients
create-client
//validate in preview
check that page contains saved value "firstName" on the right of "Name"
check that page contains saved value "lastName" on the right of "Name"
check that page contains saved value "externalID" on the right of "External ID"
check that page contains saved value "birthDate" on the right of "Date of Birth"
check that page contains string with parameters "${todayDayOfMonthTwoDigits} ${todayMonth} ${todayYear}" on the right of "Submitted On Date"
click "Submit"
//validate in profile
check that page contains saved value "firstName" on the right of "Client Name :"
check that page contains saved value "lastName" on the right of "Client Name :"
check that page contains saved value "externalID" on the right of "External Id:"
//validade in clients list
click "Clients"
enter saved value "firstName" into "Search"
enter enter
check that page contains saved value "firstName" below saved value "firstName"
check that page contains saved value "lastName" below saved value "firstName"
check that page contains saved value "externalID" onthe right of saved value "lastName"
@@ -0,0 +1,32 @@
log-in-and-validate
navigate-to-accounting-creation
create-account
//navigate to journal
click "Accounting"
click "Create Journal Entries"
//create a new Journal Entrie
enter string with parameters "${todayMonthNumber}/${todayDayOfMonth}/${todayYear}" into "Transaction Date"
click "Office"
click "Office"
click "Head Office"
click "Currency"
click "US Dollar"
click "Affected GL Entry (Debit)"
type saved value "glAccountName"
click string with parameters "(${glCode}) ${glAccountName}"
click "Affected GL Entry (Credit)"
type saved value "glAccountName"
click string with parameters "(${glCode}) ${glAccountName}" roughly below "Affected GL Entry (Credit)"
click "Payment Type"
click "Money Transfer"
enter "300" into "Debit Amount"
enter "300" into "Credit Amount"
generate from template "%*********", then enter into "Reference Number" and save as "referenceNumber"
click "Submit"
//validate Transactions
check that page contains "Revert Transaction"
grab value from the right of "Transactions" and save as "transactionID"
click "Journal Entries"
enter saved value "transactionID" into "Transaction ID"
check that page contains saved value "glAccountName" below saved value "transactionID"
check that page contains saved value "transactionID" on the left of saved value "glAccountName"
@@ -0,0 +1,7 @@
log-in-and-validate
navigate-to-offices
create-organization
enter saved value "officeName" into "Filter"
check that page contains saved value "officeName" below saved value "officeName"
check that page contains saved value "externalID" below saved value "officeName"
check that page contains string with parameters "${todayDayOfMonthTwoDigits} ${todayMonth} ${todayYear}" on the right of saved value "externalID"
@@ -0,0 +1,13 @@
log-in-and-validate
navigate-to-admin-users-management
create-admin-user
//delete admin profile
check that page doesn't contain "Create User"
click "Users"
enter saved value "firstName" into "Filter"
click second saved value "firstName"
click "Delete"
click "Confirm"
//validate admin profile does NOT exist
enter saved value "firstName" into "Filter"
check that page doesn't contain saved value "firstName" below saved value "firstName"
+13
View File
@@ -0,0 +1,13 @@
log-in-and-validate
navigate-to-clients
create-client
click "Submit"
//delete client
click "Client actions"
click "Actions"
click "Delete"
click "Confirm"
navigate-to-clients
//validate client does NOT exist
enter saved value "firstName" into "Search"
check that page doesn't contain saved value "firstName" below saved value "firstName"
@@ -0,0 +1,17 @@
log-in-and-validate
navigate-to-offices
create-organization
//edit an organization
enter saved value "officeName" into "Filter"
click 2nd saved value "officeName"
click "Edit"
double click field "Office"
enter delete
generate unique name, then enter into field "Office" and save as "newOfficeName"
click "Submit"
check that page contains "General"
check that page contains saved value "newOfficeName"
//validate edited organization
click "Manage Offices"
enter saved value "newOfficeName" into "Filter"
check that page contains saved value "newOfficeName" below saved value "newOfficeName"
@@ -0,0 +1,8 @@
// Setting wrong credentials
save value "wrong" as "username"
save value "wrong" as "password"
enter saved value "username" into field "Username"
enter saved value "password" into field "Password"
click exactly "Login"
// validate invalid login message
check that page contains "Invalid User Details. Please try again!"
+1
View File
@@ -0,0 +1 @@
log-in-and-validate
+14
View File
@@ -0,0 +1,14 @@
validate-login-page
log-in-and-validate
check that page doesn't contain field "Username"
check that page doesn't contain field "Password"
check that page doesn't contain button "Login"
check that page doesn't contain button "Forgot Password?"
check that page contains button "Institution"
check that page contains button "Accounting"
check that page contains button "Reports"
check that page contains button "Admin"
check that page contains button "Self Service"
check that page contains button "Configuration Wizard"
logout
validate-login-page