Skip to content

Commit

Permalink
test(suite): mark transaction groups as pending or confirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
komret committed Jun 21, 2024
1 parent 0a30b7b commit d3abb20
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
22 changes: 11 additions & 11 deletions packages/suite-web/e2e/tests/wallet/pending-transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ describe('Use regtest to test pending transactions', () => {
cy.task('pressYes');
cy.getTestElement('@modal/send').click();

cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').within(() => {
// pre-pending is immediately created and placed in "pending transactions group"
cy.getTestElement('@transaction-item/0/prepending/heading');
// however, after a while it is replaced by a standard pending transaction
cy.getTestElement(`@transaction-item/0/heading`).click({
scrollBehavior: 'bottom',
});
// count has not changed
cy.getTestElement('@transaction-group/pending/count').contains(index + 1);
});
// count has not changed
cy.getTestElement('@transaction-group/pending/count').contains(index + 1);
cy.getTestElement('@tx-detail/txid-value').then($el => {
cy.task('set', { key: address, value: $el.attr('id') });
});
Expand All @@ -71,20 +71,20 @@ describe('Use regtest to test pending transactions', () => {
});

// account 1 has 2 pending transactions (self and sent)
cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').within(() => {
cy.getTestElement('@transaction-item/0/heading').contains('Sending REGTEST');
cy.getTestElement('@transaction-item/1/heading').contains('Sending REGTEST to myself');
});

// account 2 has 1 pending transaction (receive)
cy.getTestElement('@account-menu/regtest/normal/1').click();
cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').within(() => {
cy.getTestElement('@transaction-item/0/heading').contains('Receiving REGTEST');
});

// while observing account 1, sent transaction is mined
cy.getTestElement('@account-menu/regtest/normal/0').click();
cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').within(() => {
cy.getTestElement('@transaction-item/0/heading').contains('Sending REGTEST');
cy.getTestElement('@transaction-item/1/heading').contains('Sending REGTEST to myself');
});
Expand All @@ -96,7 +96,7 @@ describe('Use regtest to test pending transactions', () => {
});
cy.wait(2000); // wait for potential notification about mined txs
// nothing has changed
cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').within(() => {
cy.getTestElement('@transaction-item/0/heading').contains('Sending REGTEST');
cy.getTestElement('@transaction-item/1/heading').contains('Sending REGTEST to myself');
});
Expand All @@ -112,18 +112,18 @@ describe('Use regtest to test pending transactions', () => {
});
});
// which causes sent transaction to disappear, self transaction stays
cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').within(() => {
cy.getTestElement('@transaction-item/0/heading').contains('Sending REGTEST to myself');
cy.getTestElement('@transaction-group/pending/count').contains(1);
});
cy.getTestElement('@transaction-group/pending/count').contains(1);
// and new group of transactions appears with the previously pending transaction now confirmed
cy.getTestElement('@wallet/accounts/transaction-list/group/1').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/confirmed/group/0').within(() => {
cy.getTestElement('@transaction-item/0/heading').contains('Sent REGTEST');
});

// receive pending transaction on account2 is now mined as well
cy.getTestElement('@account-menu/regtest/normal/1').click();
cy.getTestElement('@wallet/accounts/transaction-list/group/0').within(() => {
cy.getTestElement('@wallet/accounts/transaction-list/confirmed/group/0').within(() => {
cy.getTestElement(`@transaction-item/0/heading`).contains('Received REGTEST');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('Send form for bitcoin', () => {
cy.task('pressYes');

cy.getTestElement('@modal/send').click();
cy.getTestElement('@wallet/accounts/transaction-list/group/0').should(
cy.getTestElement('@wallet/accounts/transaction-list/pending/group/0').should(
'contain',
'OP_RETURN (meow)',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const TransactionGroupedList = ({
symbol={symbol}
transactions={value}
localCurrency={localCurrency}
isPending={isPending}
index={groupIndex}
>
{groupJointTransactions(value).map((item, index) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ interface TransactionsGroupProps {
symbol: Network['symbol'];
localCurrency: FiatCurrencyCode;
index: number;
isPending: boolean;
}

export const TransactionsGroup = ({
dateKey,
symbol,
transactions,
localCurrency,
isPending,
children,
index,
...rest
Expand Down Expand Up @@ -88,7 +90,7 @@ export const TransactionsGroup = ({
<TransactionsGroupWrapper
key={dateKey}
onMouseEnter={() => setIsHovered(true)}
data-test={`@wallet/accounts/transaction-list/group/${index}`}
data-test={`@wallet/accounts/transaction-list/${isPending ? 'pending' : 'confirmed'}/group/${index}`}
onMouseLeave={() => setIsHovered(false)}
{...rest}
>
Expand Down

0 comments on commit d3abb20

Please sign in to comment.