Skip to content

Commit f769875

Browse files
DawoudIOclaude
andcommitted
Fix Cypress payment test: use /payments endpoint instead of /pledges
The `should have payments in the system after demo import` test was calling `/api/deposits/{id}/pledges` which returns pledge-type records linked to a deposit. In ChurchCRM, pledges are never linked to deposits (no dep_id); only payment records carry a dep_id. The correct endpoint is `/api/deposits/{id}/payments`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b18a656 commit f769875

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

cypress/e2e/new-system/02-demo-import.spec.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ describe('02 - Demo Data Import', () => {
195195
});
196196

197197
it('should have payments in the system after demo import', () => {
198-
// Use /api/deposits/{id}/pledges instead of /api/payments/ because the
199-
// payments endpoint filters by user ShowPayments setting (off by default)
200198
cy.request({
201199
method: 'GET',
202200
url: '/api/deposits',
@@ -207,17 +205,18 @@ describe('02 - Demo Data Import', () => {
207205
const deposits = response.body.Deposits;
208206
expect(deposits.length).to.be.greaterThan(0);
209207

208+
// Use the first deposit (oldest, closed) — it always has payments linked via dep_id
210209
const depositId = deposits[0].Id;
211210
return cy.request({
212211
method: 'GET',
213-
url: `/api/deposits/${depositId}/pledges`,
212+
url: `/api/deposits/${depositId}/payments`,
214213
timeout: 30000
215214
});
216-
}).then((pledgesResponse) => {
217-
expect(pledgesResponse.status).to.equal(200);
218-
expect(pledgesResponse.body).to.be.an('array');
219-
expect(pledgesResponse.body.length).to.be.greaterThan(0);
220-
cy.log(`Found ${pledgesResponse.body.length} payment(s) in deposit`);
215+
}).then((paymentsResponse) => {
216+
expect(paymentsResponse.status).to.equal(200);
217+
expect(paymentsResponse.body).to.be.an('array');
218+
expect(paymentsResponse.body.length).to.be.greaterThan(0);
219+
cy.log(`Found ${paymentsResponse.body.length} payment(s) in deposit`);
221220
});
222221
});
223222

0 commit comments

Comments
 (0)