Skip to content

Commit 89e9d7d

Browse files
(test): Add e2e to check for bill line status (#615)
1 parent 0ecff07 commit 89e9d7d

2 files changed

Lines changed: 30 additions & 46 deletions

File tree

e2e/specs/billing-dashboard.spec.ts

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,20 @@ test.describe('Billing Dashboard workflow', () => {
156156
expect(extractNumericValue(updatedAmountDue)).toBe(0);
157157
});
158158

159-
/**
160-
* TODO: Uncomment this after the ticket below has been implemented:
161-
* https://openmrs.atlassian.net/browse/O3-5394
162-
*
163-
* The ticket is about updating the payment status of the line items when the payment is processed.
164-
* Once the ticket is implemented, we can uncomment the test step below
165-
*/
166-
167-
// await test.step('And the Service status in the Line items table should change to PAID', async () => {
168-
// const lineItems = await invoicePage.getLineItems();
169-
// expect(lineItems.length).toBeGreaterThan(0);
170-
// lineItems.forEach((lineItem) => {
171-
// expect(lineItem.status).toBe('PAID');
172-
// });
173-
174-
// // Also verify backend line items have paymentStatus set to PAID
175-
// const billResponse = await api.get(`billing/bill/${billUuid}`);
176-
// const billData = await billResponse.json();
177-
// billData.lineItems.forEach((lineItem: { paymentStatus: string }) => {
178-
// expect(lineItem.paymentStatus).toBe('PAID');
179-
// });
180-
// });
159+
await test.step('And the Service status in the Line items table should change to PAID', async () => {
160+
const lineItems = await invoicePage.getLineItems();
161+
expect(lineItems.length).toBeGreaterThan(0);
162+
lineItems.forEach((lineItem) => {
163+
expect(lineItem.status).toBe('PAID');
164+
});
165+
166+
// Also verify backend line items have paymentStatus set to PAID
167+
const billResponse = await api.get(`billing/bill/${billUuid}`);
168+
const billData = await billResponse.json();
169+
billData.lineItems.forEach((lineItem: { paymentStatus: string }) => {
170+
expect(lineItem.paymentStatus).toBe('PAID');
171+
});
172+
});
181173

182174
await test.step('And the Payments section should display a payment record', async () => {
183175
const paymentHistory = await paymentPage.getPaymentHistory();

e2e/specs/billing-patient-chart.spec.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -505,30 +505,22 @@ test.describe('Billing: Patient Chart workflow', () => {
505505
await waitForSuccessNotification(page, 'Payment processed successfully');
506506
});
507507

508-
/**
509-
* TODO: Uncomment this after the ticket below has been implemented:
510-
* https://openmrs.atlassian.net/browse/O3-5394
511-
*
512-
* The ticket is about updating the payment status of the line items when the payment is processed.
513-
* Once the ticket is implemented, we can uncomment the test step below
514-
*/
515-
516-
// await test.step('Then the line item should be marked as PAID', async () => {
517-
// await page.reload();
518-
// await invoicePage.waitForInvoiceToLoad();
519-
520-
// const lineItems = await invoicePage.getLineItems();
521-
// lineItems.forEach((lineItem) => {
522-
// expect(lineItem.status).toBe('PAID');
523-
// });
524-
525-
// // Verify backend state
526-
// const billResponse = await api.get(`billing/bill/${billUuid}?v=full`);
527-
// const billData = await billResponse.json();
528-
// billData.lineItems.forEach((lineItem: { paymentStatus: string }) => {
529-
// expect(lineItem.paymentStatus).toBe('PAID');
530-
// });
531-
// });
508+
await test.step('Then the line item should be marked as PAID', async () => {
509+
await page.reload();
510+
await invoicePage.waitForInvoiceToLoad();
511+
512+
const lineItems = await invoicePage.getLineItems();
513+
lineItems.forEach((lineItem) => {
514+
expect(lineItem.status).toBe('PAID');
515+
});
516+
517+
// Verify backend state
518+
const billResponse = await api.get(`billing/bill/${billUuid}?v=full`);
519+
const billData = await billResponse.json();
520+
billData.lineItems.forEach((lineItem: { paymentStatus: string }) => {
521+
expect(lineItem.paymentStatus).toBe('PAID');
522+
});
523+
});
532524
});
533525

534526
test('Process payment with multiple payment methods', async ({ page, api, patient }) => {

0 commit comments

Comments
 (0)