Repository navigation
feat(clients): add account CTAs to empty profile tabs #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Aman-Mittal
merged 5 commits into
apache:main
from
zhangxinyao88:codex/issue-328-empty-client-cta
Sep 6, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c876d5e
feat(clients): add account CTAs to empty profile tabs
zhangxinyao88 7acc097
test(clients): cover empty account CTA permissions and populated tabs
zhangxinyao88 6d28736
test(e2e): cover empty client account CTAs
zhangxinyao88 a0173da
test(e2e): capture empty account CTA states
zhangxinyao88 299ecd9
test(e2e): mock business date for client CTA flow
zhangxinyao88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { expect, test, type Page } from './fixtures'; | ||
|
|
||
| const CLIENT_ID = 2001; | ||
| const CLIENT_URL = `/clients/view/${CLIENT_ID}`; | ||
|
|
||
| test.use({ video: 'on' }); | ||
|
|
||
| async function signIn(page: Page): Promise<void> { | ||
| await page.route('**/config.json*', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ fineractApiUrl: '/api/v1', defaultTenant: 'default' }), | ||
| }); | ||
| }); | ||
| await page.route('**/api/v1/authentication**', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ | ||
| username: 'mifos', | ||
| userId: 1, | ||
| base64EncodedAuthenticationKey: 'YmFzZTY0', | ||
| authenticated: true, | ||
| officeId: 1, | ||
| officeName: 'Head Office', | ||
| permissions: ['ALL_FUNCTIONS'], | ||
| }), | ||
| }); | ||
| }); | ||
| await page.route('**/api/v1/businessdate**', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify([{ type: 'BUSINESS_DATE', date: [2026, 9, 5] }]), | ||
| }); | ||
| }); | ||
|
|
||
| await page.goto('/login'); | ||
| await page.locator('#tenantId').fill('default'); | ||
| await page.locator('#username').fill('mifos'); | ||
| await page.locator('#password').fill('password'); | ||
| await page.getByRole('button', { name: 'Sign In' }).click(); | ||
| await expect(page).toHaveURL('/dashboard'); | ||
| } | ||
|
|
||
| async function mockClientWithoutAccounts(page: Page): Promise<void> { | ||
| await page.route('**/api/v1/clients/2001**', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ | ||
| id: CLIENT_ID, | ||
| accountNo: '000002001', | ||
| displayName: 'Empty Account Client', | ||
| firstname: 'Empty', | ||
| lastname: 'Client', | ||
| officeName: 'Head Office', | ||
| status: { id: 300, value: 'Active' }, | ||
| }), | ||
| }); | ||
| }); | ||
| await page.route('**/api/v1/clients/2001/accounts**', async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify({ loanAccounts: [], savingsAccounts: [] }), | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| test('empty account tabs offer the matching creation action', async ({ page }, testInfo) => { | ||
| await signIn(page); | ||
| await mockClientWithoutAccounts(page); | ||
| await page.goto(CLIENT_URL); | ||
|
|
||
| await page.getByRole('tab', { name: 'Savings Accounts', exact: true }).click({ force: true }); | ||
| const savingsAction = page.getByTestId('client-create-savings-account'); | ||
| await expect(savingsAction).toBeVisible(); | ||
|
|
||
| const screenshot = testInfo.outputPath('empty-savings-account-cta.png'); | ||
| await page.screenshot({ path: screenshot, fullPage: true }); | ||
| await testInfo.attach('empty Savings Accounts CTA', { | ||
| path: screenshot, | ||
| contentType: 'image/png', | ||
| }); | ||
|
|
||
| await savingsAction.click(); | ||
| await expect(page).toHaveURL('/products/savings-accounts/create?clientId=2001'); | ||
|
|
||
| await page.goto(CLIENT_URL); | ||
| await page.getByRole('tab', { name: 'Loan Accounts', exact: true }).click({ force: true }); | ||
| const loanAction = page.getByTestId('client-create-loan-account'); | ||
| await expect(loanAction).toBeVisible(); | ||
|
|
||
| const loanScreenshot = testInfo.outputPath('empty-loan-account-cta.png'); | ||
| await page.screenshot({ path: loanScreenshot, fullPage: true }); | ||
| await testInfo.attach('empty Loan Accounts CTA', { | ||
| path: loanScreenshot, | ||
| contentType: 'image/png', | ||
| }); | ||
|
|
||
| await loanAction.click(); | ||
| await expect(page).toHaveURL('/loans/create?clientId=2001'); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.