-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug updating position after add funds (#58)
* Update portal backend version for integration test * Update position after position update * 2.2.1 * Merged from master * Change errors to asserts. Made conditional a bit more obvious. * Set INSECURE_COOKIE=true in portal backend for integration tests * Give display names to components to ease testing * Print more useful assertion messages when looking for various elements * Test * 2.3.2 * Bump chart versions
- Loading branch information
1 parent
73a4afa
commit 7e09869
Showing
11 changed files
with
218 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "v2.3.1" | ||
appVersion: "v2.3.2" | ||
description: Mojaloop Finance Portal UI v2 | ||
name: finance-portal-v2-ui | ||
version: 2.3.1 | ||
version: 2.3.2 |
This file contains 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
71 changes: 71 additions & 0 deletions
71
integration_test/tests/src/page-objects/pages/FinancialPositionsPage.ts
This file contains 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,71 @@ | ||
import { ReactSelector } from 'testcafe-react-selectors'; | ||
import { t } from 'testcafe'; | ||
|
||
export enum PositionUpdateAction { | ||
AddWithdrawFunds = 'Add / Withdraw Funds', | ||
ChangeNDC = 'Change Net Debit Cap', | ||
} | ||
|
||
export type FinancialPositionsRow = { | ||
dfsp: Selector, | ||
balance: Selector, | ||
position: Selector, | ||
ndc: Selector, | ||
ndcUsed: Selector, | ||
updateButton: Selector, | ||
} | ||
|
||
const finPosUpdateConfirmRoot = ReactSelector('FinancialPositionUpdateConfirm Modal'); | ||
export const FinancialPositionUpdateConfirmModal = { | ||
root: finPosUpdateConfirmRoot, | ||
cancelButton: finPosUpdateConfirmRoot.findReact('Button').withText('Cancel'), | ||
confirmOnlyButton: finPosUpdateConfirmRoot.findReact('Button').withText('Confirm Only'), | ||
confirmUpdateNdcButton: finPosUpdateConfirmRoot.findReact('Button').withText('Confirm and Update NDC'), | ||
}; | ||
|
||
const finPosUpdateRoot = ReactSelector('FinancialPositionUpdate Modal'); | ||
export const FinancialPositionUpdateModal = { | ||
root: finPosUpdateRoot, | ||
|
||
actionSelect: finPosUpdateRoot.findReact('Select'), | ||
|
||
addFundsRadioButton: finPosUpdateRoot.findReact('Radio').withText('Add Funds'), | ||
withdrawFundsRadioButton: finPosUpdateRoot.findReact('Radio').withText('Withdraw Funds'), | ||
|
||
amountInput: finPosUpdateRoot.findReact('Row input'), | ||
|
||
cancelButton: finPosUpdateRoot.findReact('Button').withText('Cancel'), | ||
submitButton: finPosUpdateRoot.findReact('Button').withText('Submit'), | ||
|
||
async selectAction(action: PositionUpdateAction) { | ||
await t.click(this.actionSelect); | ||
await t.click(this.actionSelect.findReact('Option').withText(action)); | ||
} | ||
}; | ||
|
||
export const FinancialPositionsPage = { | ||
async getDfspRowMap(): Promise<Map<string, FinancialPositionsRow>> { | ||
const rows = await this.getResultRows(); | ||
return new Map(await Promise.all( | ||
rows.map((r) => r.dfsp.innerText.then((t): [string, FinancialPositionsRow] => [t, r])) | ||
)); | ||
}, | ||
|
||
async getResultRows(): Promise<FinancialPositionsRow[]> { | ||
const rows = ReactSelector('FinancialPositions DataList Rows').findReact('RowItem'); | ||
// This `expect` forces TestCafe to take a snapshot of the DOM. If we don't make this call, | ||
// rows.count always returns zero, and this function fails. | ||
await t.expect(rows.exists).ok('Expected to find financial positions result rows'); | ||
const length = await rows.count; | ||
return Array | ||
.from({ length }) | ||
.map((_, i) => ({ | ||
dfsp: rows.nth(i).findReact('ItemCell').nth(0), | ||
balance: rows.nth(i).findReact('ItemCell').nth(1), | ||
position: rows.nth(i).findReact('ItemCell').nth(1), | ||
ndc: rows.nth(i).findReact('ItemCell').nth(1), | ||
ndcUsed: rows.nth(i).findReact('ItemCell').nth(1), | ||
updateButton: rows.nth(i).findReact('Button'), | ||
})); | ||
}, | ||
}; |
This file contains 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 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 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 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 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 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.