-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(dashboard): added browser tests for batch payments (#3831)
* chore:added batch payments * chore: misc changes in test * chore: update deps * chore: misc changes * chore: remove logs * chore: update deps * chore: update deps and added waiting time' * chore: adding more deps * chore: exit if user is not funded * chore: adding response log * chore: adding load wallet * chore: linux EOL
- Loading branch information
1 parent
22adf9c
commit bd15cd4
Showing
15 changed files
with
379 additions
and
42 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
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
61 changes: 61 additions & 0 deletions
61
apps/dashboard/cypress/e2e/batch-payments/batch-payments.cy.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,61 @@ | ||
import { | ||
testData, | ||
expectedTransactions, | ||
btcPaymentInUSDCurrency, | ||
} from "../../support/test-data" | ||
|
||
describe("Batch payments test", () => { | ||
beforeEach(() => { | ||
cy.viewport(1920, 1080) | ||
cy.setCookie("next-auth.session-token", testData.NEXT_AUTH_SESSION_TOKEN, { | ||
secure: true, | ||
}) | ||
cy.visit("/batch-payments") | ||
}) | ||
|
||
it("Batch Payments Test", () => { | ||
cy.get("[data-testid=csv-upload-input]").selectFile("cypress/fixtures/template.csv") | ||
|
||
cy.get("[data-testid=confirm-batch-payments-btn]").should("exist") | ||
cy.get("[data-testid=confirm-batch-payments-btn]").should("be.visible") | ||
cy.get("[data-testid=confirm-batch-payments-btn]").should("not.be.disabled") | ||
cy.get("[data-testid=confirm-batch-payments-btn]").click() | ||
|
||
cy.get("[data-testid=batch-payments-modal-message]").should( | ||
"have.text", | ||
"Batch Payment Completed", | ||
) | ||
|
||
cy.loginAndGetToken(testData.PHONE, testData.CODE).then((token) => { | ||
const authToken = token | ||
cy.getTransactions(authToken, 4).then((transactions) => { | ||
// Check for specific BTC transactions | ||
btcPaymentInUSDCurrency.forEach((expectedBtcTransaction) => { | ||
const found = transactions.some( | ||
(transaction) => | ||
transaction.settlementCurrency === | ||
expectedBtcTransaction.settlementCurrency && | ||
transaction.status === expectedBtcTransaction.status && | ||
transaction.settlementDisplayAmount === | ||
expectedBtcTransaction.settlementDisplayAmount, | ||
) | ||
expect(found).to.be.true | ||
}) | ||
|
||
expectedTransactions.forEach((expectedTransaction) => { | ||
if ( | ||
!btcPaymentInUSDCurrency.some( | ||
(btcTx) => | ||
btcTx.settlementCurrency === expectedTransaction.settlementCurrency && | ||
btcTx.status === expectedTransaction.status && | ||
btcTx.settlementDisplayAmount === | ||
expectedTransaction.settlementDisplayAmount, | ||
) | ||
) { | ||
expect(transactions).to.deep.include(expectedTransaction) | ||
} | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
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,3 +1,4 @@ | ||
/* eslint-disable import/no-unassigned-import */ | ||
import "./api-keys/api-keys.cy" | ||
import "./callback/callback.cy" | ||
import "./batch-payments/batch-payments.cy" |
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,5 @@ | ||
username,amount,currency,wallet,memo | ||
test_user_a,12,USD,USD,Testing to send 12 USD | ||
test_user_b,10,USD,USD,Testing to send 10 USD | ||
test_user_c,5,USD,BTC,Testing to send 5 USD | ||
test_user_a,100,SATS,BTC,Testing to send 100 SATS |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,37 @@ export const testData = { | |
NEXT_AUTH_SESSION_TOKEN: Cypress.env("NEXT_AUTH_SESSION_TOKEN"), | ||
EMAIL: "[email protected]", | ||
CALLBACK_URL: "https://www.google.com/", | ||
PHONE: "+16505554350", | ||
CODE: "000000", | ||
} | ||
|
||
export const CORE_URL = "http://localhost:4455" | ||
|
||
export const expectedTransactions = [ | ||
{ | ||
settlementAmount: -100, | ||
settlementCurrency: "BTC", | ||
status: "SUCCESS", | ||
settlementDisplayAmount: "-0.04", | ||
}, | ||
{ | ||
settlementAmount: -1000, | ||
settlementCurrency: "USD", | ||
status: "SUCCESS", | ||
settlementDisplayAmount: "-10.00", | ||
}, | ||
{ | ||
settlementAmount: -1200, | ||
settlementCurrency: "USD", | ||
status: "SUCCESS", | ||
settlementDisplayAmount: "-12.00", | ||
}, | ||
] | ||
|
||
export const btcPaymentInUSDCurrency = [ | ||
{ | ||
settlementCurrency: "BTC", | ||
status: "SUCCESS", | ||
settlementDisplayAmount: "-5.00", | ||
}, | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# set -e | ||
# set -x | ||
|
||
echo "Setting up DEV_DIR variable" | ||
DEV_DIR="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")" | ||
source "${DEV_DIR}/helpers/auth.sh" | ||
source "${DEV_DIR}/helpers/onchain.sh" | ||
|
||
user_phone="+16505554350" | ||
token="$(login_user "${user_phone}")" | ||
echo "Fetching wallets for account" | ||
|
||
echo "Funding wallets" | ||
fund_user_onchain "$token" "USD" | ||
fund_user_onchain "$token" "BTC" |
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,8 @@ | ||
mutation onChainAddressCreate($input: OnChainAddressCreateInput!) { | ||
onChainAddressCreate(input: $input) { | ||
address | ||
errors { | ||
message | ||
} | ||
} | ||
} |
Oops, something went wrong.