Skip to content

Conversation

@brad-decker
Copy link
Contributor

@brad-decker brad-decker commented Jul 15, 2022

Explanation

When we refactored to not use global state for transaction data in the send flow, we made it a requirement to start a new draft transaction PRIOR to entering the send flow. This change allows us to gracefully handle situations that are edge cases such as when routing to the send screen directly, or if the user is in full screen mode and clicks back after moving to the confirm screen. Also added a test to cover this scenario.

More Information

Fixes #15188 #15183

Manual Testing Steps

  1. Start a send in full screen mode
  2. Fill in amount and click next to move to confirmation screen
  3. Click browser back button
  4. Send screen does not error.
  5. Pick a different recipient
  6. Add an amount
  7. Click next
  8. See 2 confirmations, each of which is a fully formed transaction reflecting user's intent

Pre-Merge Checklist

  • PR template is filled out
  • IF this PR fixes a bug, a test that would have caught the bug has been added
  • PR is linked to the appropriate GitHub issue
  • PR has been added to the appropriate release Milestone

+ If there are functional changes:

  • Manual testing complete & passed
  • "Extension QA Board" label has been applied

@brad-decker brad-decker requested a review from a team as a code owner July 15, 2022 15:08
@brad-decker brad-decker requested a review from darkwing July 15, 2022 15:08
@metamaskbot
Copy link
Collaborator

Builds ready [c316ec1]
Page Load Metrics (1794 ± 74 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint901641212210
domContentLoaded16292233178014771
load16292233179415574
domInteractive16292233178014771

highlights:

storybook

if (
draftTransactionExists === false ||
stage === SEND_STAGES.ADD_RECIPIENT ||
stage === SEND_STAGES.INACTIVE
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, good call out. Done in latest

// Ensure that the send flow renders on the add recipient screen when
// there is no draft transaction.
expect(
getByPlaceholderText('Search, public address (0x), or ENS'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we use this in another place but selecting elements by placeholder always feels kinda weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why? This is a common way user's navigate forms... often times the placeholder text in inputs is more prominent or easier to reason about than the labels or the placeholder itself is the label.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably just because I think of selecting elements by CSS paradigms, and you usually wouldn't select an element like this. It's fine, just breaks my brain a little.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The testing paradigm we should strive to emulate is one where we test our code how users interact with it. Instead of testing to see if internal values of a Counter class change when its addOne method is called, we should test that the on screen count increments when the user clicks the 'Add One' Button.

@metamaskbot
Copy link
Collaborator

Builds ready [96f44f0]
Page Load Metrics (1862 ± 57 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint952151308570274
domContentLoaded16432161185511857
load16432161186211957
domInteractive16432161185511857

highlights:

storybook

Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM! Code looks good, and QA'd testing steps and issues linked

@brad-decker brad-decker added the needs-qa Label will automate into QA workspace label Jul 18, 2022
@brad-decker brad-decker merged commit 751c119 into develop Jul 18, 2022
@brad-decker brad-decker deleted the fix-browser-back-button-from-send branch July 18, 2022 17:01
@github-actions github-actions bot locked and limited conversation to collaborators Jul 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-qa Label will automate into QA workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use browser back button on the send screen

5 participants