Skip to content

Conversation

@bznein
Copy link
Collaborator

@bznein bznein commented Nov 11, 2025

Note: based on #3666

This is a test that:

  • sets up regtest
  • send coints to RBTC account 1
  • creates a second RBTC account
  • send coins from 1 to 2
  • Checks that transactions appear in the list

Before asking for reviews, here is a check list of the most common things you might need to consider:

  • updating the Changelog
  • writing unit tests
  • checking if your changes affect other coins or tokens in unintended ways
  • testing on multiple environments (Qt, Android, ...)
  • having an AI review your changes

@bznein bznein requested a review from thisconnect November 11, 2025 16:15
@bznein bznein marked this pull request as draft November 11, 2025 16:41
@bznein bznein force-pushed the basicSendFlow branch 11 times, most recently from eda42fa to d54dca5 Compare November 12, 2025 10:53
@bznein bznein marked this pull request as ready for review November 12, 2025 11:04
@bznein bznein force-pushed the basicSendFlow branch 3 times, most recently from e8668b1 to a82ec48 Compare November 19, 2025 10:40
@bznein
Copy link
Collaborator Author

bznein commented Nov 19, 2025

@thisconnect ready for review :)

Copy link
Collaborator

@thisconnect thisconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice, added some comments, but overall LGTM

await page.getByRole('button', { name: 'Verify address on BitBox' }).click();
const addressLocator = page.locator('[data-testid="receive-address"]');
recvAdd = await addressLocator.inputValue();
console.log(`Receive address: ${recvAdd}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't there be an expect() call at the end?

maybe it could just test that the recvAdd starts with "brct1" (for regtest addresses but I am not sure).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't there be an expect() call at the end?

I guess we could technically do it, even though the step is mostly only trying to grab the address and we are reusing it later

maybe it could just test that the recvAdd starts with "brct1" (for regtest addresses but I am not sure).

I'll do that!

}
}}>
<div className={styles.txContent}>
<div className={styles.txContent} data-testid="transaction" tx-type={type}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it technically works without, I think we should keep using data-* prefix for custom attributes unless there is good reason not to.

Suggested change
<div className={styles.txContent} data-testid="transaction" tx-type={type}>
<div className={styles.txContent} data-testid="transaction" data-tx-type={type}>

await page.getByRole('link', { name: 'Settings' }).click();
await page.getByRole('link', { name: 'Manage Accounts' }).click();
await page.getByRole('button', { name: 'Add account' }).click();
await page.getByRole('button', { name: 'Add account' }).click();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a multi device you would have to choose the coin type first. So I guess this is a btc-only simulated device?

Just thinking out loud. Is the edition btconly/multi something we should be able to configure for each test in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is performed in regtest, which only supports BTC.
To test a multi behaviour, we'd need to use testnet with either a software keystore or a simulator, which are both "multi"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to suggest to test altcoins here, but just wanted to note that if the device was a multi it would have 1 extra step here.

await page.getByRole('link', { name: 'Manage Accounts' }).click();
await page.getByRole('button', { name: 'Add account' }).click();
await page.getByRole('button', { name: 'Add account' }).click();
await page.getByRole('button', { name: 'Done' }).click();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end of adding a 2nd account there should be a text: "Account added" or "<accountname> has now been added to your accounts."

Maybe something you could test with expect here?

await test.step('Verify there are no transactions yet', async () => {
await page.goto('/#/account-summary');
mineBlocks(12);
await page.locator('td[data-label="Account name"]').nth(0).click();
Copy link
Collaborator

@thisconnect thisconnect Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this and other selectors target td element but in the future we might refactor or redesign.
With that in mind it would be better to drop the element td from the selector? wdyt?

await test.step('Send RBTC to second account receive address', async () => {
await page.goto('/#/account-summary');
await page.getByRole('link', { name: 'Bitcoin Regtest Bitcoin' }).click();
console.log('Sending RBTC to second account');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the run-tests log I can only see, the following

Receive address: bcrt1qn00wa7j8v2ssq7y7774qua7xly02she0ukcygc
Receive address: bcrt1qh8r2rx5myc0pjhkjyx70hug2s4dpj6fufej4jg
Sending RBTC to second account

https://github.com/BitBoxSwiss/bitbox-wallet-app/actions/runs/19498423962/job/55806495741

maybe also add a console log 'Sending RBTC to first account' when sending the first time? Then the log info would be a bit more usefuls.

Copy link
Collaborator

@thisconnect thisconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some suggestion and comment/question

@bznein bznein merged commit 40a1541 into BitBoxSwiss:master Nov 19, 2025
13 checks passed
@bznein bznein deleted the basicSendFlow branch November 19, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants