Skip to content

Commit e1238c8

Browse files
authored
Add finance giving demo data (#8102)
## Summary Adds realistic finance/giving demo data to the demo data import system so users exploring ChurchCRM can see populated donation deposits, pledges, and giving history out of the box. ## Changes - `src/ChurchCRM/Service/DemoDataService.php`: implement finance demo data generation (deposits, pledges, giving records) - `src/admin/demo/finance.json`: static demo dataset for finance records - `src/skin/js/importDemoData.js`: wire up finance data import to the demo data UI ## Why The existing demo data import covered people, families, and groups but left Finance completely empty. New users evaluating ChurchCRM had no way to see what the finance module looks like with real data, making it harder to assess the product. ## Files Changed - `src/ChurchCRM/Service/DemoDataService.php` - `src/admin/demo/finance.json` - `src/skin/js/importDemoData.js` ## Testing - Go to Admin Dashboard → Import Demo Data - After import, navigate to Finance → verify deposits, pledges, and giving records are populated 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents d763edd + f769875 commit e1238c8

File tree

6 files changed

+819
-80
lines changed

6 files changed

+819
-80
lines changed

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

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,90 @@ describe('02 - Demo Data Import', () => {
141141

142142
it('should show people listing with demo data', () => {
143143
cy.visit('/v2/people');
144-
144+
145145
// Should see the people listing
146146
cy.contains('People').should('be.visible');
147-
147+
148148
// Should have table with people data
149149
cy.get('table', { timeout: 10000 }).should('exist');
150-
150+
151151
// Wait for table to populate (DataTable lazy loading)
152152
cy.wait(2000);
153-
153+
154154
// Should have rows with people
155155
cy.get('table tbody tr').should('have.length.at.least', 1);
156156
});
157157
});
158+
159+
describe('Verify Finance Demo Data', () => {
160+
beforeEach(() => {
161+
loginAsAdmin();
162+
});
163+
164+
it('should have deposits in the system after demo import', () => {
165+
cy.request({
166+
method: 'GET',
167+
url: '/api/deposits',
168+
timeout: 30000
169+
}).then((response) => {
170+
expect(response.status).to.equal(200);
171+
// /api/deposits returns { Deposits: [...] } (Propel collection format)
172+
expect(response.body).to.have.property('Deposits');
173+
expect(response.body.Deposits).to.be.an('array');
174+
expect(response.body.Deposits.length).to.be.greaterThan(0);
175+
cy.log(`Found ${response.body.Deposits.length} deposit(s)`);
176+
});
177+
});
178+
179+
it('should have at least one open deposit', () => {
180+
cy.request({
181+
method: 'GET',
182+
url: '/api/deposits',
183+
timeout: 30000
184+
}).then((response) => {
185+
expect(response.status).to.equal(200);
186+
// /api/deposits returns { Deposits: [...] } (Propel collection format)
187+
expect(response.body).to.have.property('Deposits');
188+
expect(response.body.Deposits).to.be.an('array');
189+
190+
// Closed is stored as bool (false = open, true = closed)
191+
const openDeposits = response.body.Deposits.filter(d => !d.Closed);
192+
expect(openDeposits.length).to.be.greaterThan(0);
193+
cy.log(`Found ${openDeposits.length} open deposit(s) out of ${response.body.Deposits.length} total`);
194+
});
195+
});
196+
197+
it('should have payments in the system after demo import', () => {
198+
cy.request({
199+
method: 'GET',
200+
url: '/api/deposits',
201+
timeout: 30000
202+
}).then((response) => {
203+
expect(response.status).to.equal(200);
204+
expect(response.body).to.have.property('Deposits');
205+
const deposits = response.body.Deposits;
206+
expect(deposits.length).to.be.greaterThan(0);
207+
208+
// Use the first deposit (oldest, closed) — it always has payments linked via dep_id
209+
const depositId = deposits[0].Id;
210+
return cy.request({
211+
method: 'GET',
212+
url: `/api/deposits/${depositId}/payments`,
213+
timeout: 30000
214+
});
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`);
220+
});
221+
});
222+
223+
it('should show finance dashboard after demo import', () => {
224+
cy.visit('/finance/');
225+
226+
// Should see the finance dashboard title
227+
cy.contains('Finance Dashboard').should('be.visible');
228+
});
229+
});
158230
});

cypress/e2e/ui/admin/admin.dashboard.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe("Admin Dashboard", () => {
7272
// Verify options are present
7373
cy.contains("Optional Data to Include");
7474
cy.get("#includeDemoSundaySchool").should("be.checked");
75-
cy.get("#includeDemoFinancial").should("be.disabled");
75+
cy.get("#includeDemoFinancial").should("be.checked");
7676
cy.get("#includeDemoEvents").should("be.disabled");
7777

7878
// Verify instructions section

0 commit comments

Comments
 (0)