Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace growl errors by modal in VBA flow #4924

Merged
merged 17 commits into from
Sep 2, 2021
Merged

Conversation

aldo-expensify
Copy link
Contributor

@aldo-expensify aldo-expensify commented Aug 30, 2021

Replacing all growls in the VBA flow by the modal.

The error message coming from the backend is being shown in the ConfirmModal now.

Errors messages associated with inputs where we don't handle highlighting yet, like checkboxes, are shown in the ConfirmModal.

Error modal generic message: 'Please double check any highlighted field and try again'

Fixed Issues

$ #4785

Tests / QA Steps

Company Step: /bank-account/company

  1. Navigate to /bank-account/company
  2. Fill all inputs, input an invalid 'Zip code' (less than 6 numbers)
  3. Click 'Save & continue'
  4. Expected results: errors in inputs validated in the front (i.e. zip code, tax id, etc) should be highlighted in the form and a generic message should be shown in a modal.Screen Shot 2021-09-01 at 3 56 23 PM
  5. Input a 'Zip Code' of 6 numbers (i.e. 123123) and input an invalid phone number (i.e. 123).
  6. Click 'Save & continue'
  7. Expected results: The phone number is a field validated in the backend, we will display a specific message in the error modal.Screen Shot 2021-09-01 at 3 57 39 PM

ACH Contract / Beneficial Owners Step: /bank-account/contract

  1. Navigate to /bank-account/contract
  2. Check I accept the terms and conditions and I certify that the information provided is true and accurate
  3. Check Somebody else owns more than 25% of XXX, this will add a form to input a beneficial owner's information. Don't fill any of the beneficial owner data.
  4. Click 'Save & continue'
  5. Expected result: Highlighted invalid field (frontend validation) with error modal with generic message Screen Shot 2021-09-01 at 4 20 07 PM

Requestor Step: /bank-account/requestor

  1. Navigate to /bank-account/requestor
  2. Fill all inputs
  3. Input a date with invalid format in 'Date of birth', in example: asd
  4. Expected result: 'Date of birth' field is highlighted with an error, we get the error modal with the generic message (this validation happened in the frontend).Screen Shot 2021-09-01 at 4 09 26 PM
  5. Input a date rejected by the backend in the 'Date of birth' , in example: 2020-10-10
  6. Expected result: The error modal displays a specific error about the 'Date of birth' being incorrect. No field is highlighted.Screen Shot 2021-09-01 at 4 12 51 PM

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@aldo-expensify aldo-expensify requested a review from a team as a code owner August 30, 2021 19:58
@MelvinBot MelvinBot requested review from flodnv and removed request for a team August 30, 2021 19:58
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Good start. I left a few ideas for improvements.

src/libs/actions/BankAccounts.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/RequestorStep.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/ReimbursementAccountPage.js Outdated Show resolved Hide resolved
src/pages/ReimbursementAccount/ReimbursementAccountPage.js Outdated Show resolved Hide resolved
src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/libs/actions/BankAccounts.js Outdated Show resolved Hide resolved
src/libs/actions/BankAccounts.js Outdated Show resolved Hide resolved
src/libs/actions/BankAccounts.js Outdated Show resolved Hide resolved
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Changes look perfect! 🏆

I think the one thing left to resolve is that there are some places where the confirm modal title does not entirely make sense. Trying to get a reply to the thread here now

@aldo-expensify
Copy link
Contributor Author

think the one thing left to resolve is that there are some places where the confirm modal title does not entirely make sense. Trying to get a reply to the thread here now

To handle this, would it be fine to include an extra parameter on the showBankAccountErrorModal like:

function showBankAccountErrorModal(errorModalMessage = null, errorModalTitle = null) {
    Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isErrorModalVisible: true, errorModalMessage, errorModalTitle});
}

Use it in the display modal like:

<ConfirmModal
  title={lodashGet(this.props, 'reimbursementAccount.errorModalTitle', this.props.translate('companyStep.confirmModalTitle'))}

Then, when we set the error from the server and want a custom title, we do:

showBankAccountErrorModal(error, translateLocal('bankAccount.error.serverErrorModalTitle'));

@marcaaron
Copy link
Contributor

To handle this, would it be fine to include an extra parameter on the showBankAccountErrorModal
Then, when we set the error from the server and want a custom title

Let's wait for feedback first? I haven't seen much discussion about whether these particular errors should have custom titles.

@aldo-expensify
Copy link
Contributor Author

Let's wait for feedback first? I haven't seen much discussion about whether these particular errors should have custom titles.

Hey @marcaaron, considering we are going to use the Oops header, does the proposed way of handling it above work for you?

@marcaaron
Copy link
Contributor

Hey @marcaaron, considering we are going to use the Oops header, does the proposed way of handling it above work for you?

Ah no, I think we should make all the headers say "Oops" if that's acceptable?
I'm not sure there is a need to get very custom on these headers and it is always best to do the simplest thing.

@aldo-expensify
Copy link
Contributor Author

Ah no, I think we should make all the headers say "Oops" if that's acceptable?
I'm not sure there is a need to get very custom on these headers and it is always best to do the simplest thing.

Okk, I think I was miss-understanding that we wanted different headers. I will change the generic header of the error modal to "Oops" then!

@aldo-expensify
Copy link
Contributor Author

Update:

  • Replaced error modal header with "Oops" (EN) / "Ups" (ES)
  • Moved translation keys related to error modal from companyStep into bankAccount

@aldo-expensify aldo-expensify changed the title [WIP] Replace growl errors by modal Replace growl errors by modal Sep 1, 2021
@aldo-expensify aldo-expensify changed the title Replace growl errors by modal Replace growl errors by modal in VBA flow Sep 1, 2021
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Looks perfect there are just two small issues where unnecessary new lines are added. But other than than great work.

src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/libs/actions/BankAccounts.js Outdated Show resolved Hide resolved
@aldo-expensify
Copy link
Contributor Author

Update: removed empty lines

@marcaaron marcaaron self-requested a review September 1, 2021 19:56
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the changes!

Approving the code. But we still need to clean up the PR description because there is nothing listed for QA Steps. We need to put something there so that QA knows what to test (and also figure out what QA is able to test or not). Otherwise, they will inevitably ping you (or me since I reviewed) and come asking if there is QA to do or not :)

Also, we should test this on all platforms to make sure the changes are safe. There's checkboxes listed so that we test on every platform. But if there's a good reason not to then we can mention it somewhere.

@marcaaron
Copy link
Contributor

Oh and also update any screenshots since they are now out of date I think.

@MitchExpensify
Copy link
Contributor

Flo is likely offline for the night. Anyone else we can request? @marcaaron

@marcaaron
Copy link
Contributor

@MitchExpensify the comments are for @aldo-expensify 😄

@aldo-expensify
Copy link
Contributor Author

Looks good! Thanks for the changes!

Approving the code. But we still need to clean up the PR description because there is nothing listed for QA Steps. We need to put something there so that QA knows what to test (and also figure out what QA is able to test or not). Otherwise, they will inevitably ping you (or me since I reviewed) and come asking if there is QA to do or not :)

Also, we should test this on all platforms to make sure the changes are safe. There's checkboxes listed so that we test on every platform. But if there's a good reason not to then we can mention it somewhere.

I'll start cleaning this up now (QA steps, outdated pictures), thanks for the reminder!

@aldo-expensify
Copy link
Contributor Author

Updated the Tests section and merged it with QA into Tests / QA Steps. Tested locally in Web (mobile/desktop) and Android.

There is one thing in the bank-account/contract step that looks like a bug, but it could also be that it just doesn't work well in the development environment. I'll test it in main branch, it feels unrelated to what we are doing.

In the /bank-account/contract step, add a beneficial owner and put a birth date that is wrong for the backend validation: 2020-10-10, we get not very descriptive message in the error modal. If we try a second time with the same data, it flashes back to the empty form and then success:

Screen.Recording.2021-09-01.at.5.13.40.PM.mov

@marcaaron
Copy link
Contributor

There is one thing in the bank-account/contract step that looks like a bug, but it could also be that it just doesn't work well in the development environment. I'll test it in main branch, it feels unrelated to what we are doing.

Nice! That was just called out by @JmillsExpensify here. I think we'll need to create a follow up issue to look into it.

If anything else pops up that you notice we can check in the free plan channel to see if @MitchExpensify & @kevinksullivan are aware of the issue yet.

@marcaaron marcaaron merged commit 5e71d36 into main Sep 2, 2021
@marcaaron marcaaron deleted the aldo_replace-growl-by-modal branch September 2, 2021 00:28
@MitchExpensify
Copy link
Contributor

Nice one @aldo-expensify!

I'll create a follow up issue to change the error copy we use when the age entered is under our required 18 years old

@OSBotify
Copy link
Contributor

OSBotify commented Sep 2, 2021

🚀 Deployed to staging by @marcaaron in version: 1.0.91-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Sep 3, 2021

🚀 Deployed to production by @roryabraham in version: 1.0.92-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

4 participants