Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ data/*
openimis-dist_dkr.code-workspace
node_modules/
cypress/screenshots/
.DS_Store
./.DS_Store
yarn.lock
cypress/downloads/
cypress/fixtures/tmp_individuals.csv
3 changes: 2 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ module.exports = defineConfig({
viewportHeight: 670,
e2e: {
projectId: "q6gc25", // Cypress Cloud, needed for recording
baseUrl: 'http://localhost',
baseUrl: 'http://localhost:3000',
defaultCommandTimeout: 15000,
taskTimeout: timeoutMinutes * 60 * 1000 + 10,
slowMo: 1000,
downloadsFolder: 'cypress/downloads',
setupNodeEvents(on, config) {
on('task', {
Expand Down
43 changes: 43 additions & 0 deletions cypress/e2e/invoice.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { invoicePage } from '../support/pages/InvoicePage';

describe('Invoice payment workflow', () => {
let data;

before(() => {
cy.fixture('invoicePayment').then((fixture) => {
data = fixture;
});
});

beforeEach(() => {
cy.login();
});

afterEach(function () {
// Clean data only if the test didn't failed
if (this.currentTest.state === 'failed') return;
invoicePage.deletePayment(data.family.head.chfId, data.payment, {
failIfMissing: false,
});
});

it('Create invoice payment', () => {

//create family and give them policy
invoicePage.createFamily(data.family);
invoicePage.createPolicy(data.family.head.chfId, data.policy);

// go to create invoice payment
invoicePage.goToForm(data.family.head.chfId);
invoicePage.fillForm(data.payment);

// save payment
cy.contains('[role="dialog"]', 'Create').within(() => {
cy.contains('button', 'Create').click({ force: true });
});
cy.waitForGraphQL('createPayment');

// check invoice payment
invoicePage.verifyExists(data.family.head.chfId, data.payment);
});
});
43 changes: 43 additions & 0 deletions cypress/fixtures/invoicePayment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"payment": {
"reconciliationStatus": "Reconciliated",
"status": "Accepted",
"reference": "ref001",
"payerName": "Joseph",
"code": "INV0010",
"label": "INV",
"codeThirdparty": "SP01",
"receiptNumber": "677763166",
"fees": 12345,
"amountReceived": 5000,
"paymentOrigin": "epargne",
"paymentDate": {
"day": 19,
"month": 3,
"year": 2026
}
},
"family": {
"location": "R1D1M1V1 Rachla",
"head": {
"givenNames": "Antoine",
"lastName": "Robert",
"gender": "Male",
"chfId": "777746566",
"dob": {
"day": 19,
"month": 12,
"year": 2025
}
}
},
"policy": {
"product": {
"code": "FCUL0001",
"name": "Fixed Cycle Cover Ultha"
},
"officer": {
"code": "E00007 Johnson James"
}
}
}
Loading