App icon indicating copy to clipboard operation
App copied to clipboard

Fix - “Submitted $amount” system message appears for a moment when Employee submit IOU

Open FitseTLT opened this issue 1 year ago • 1 comments

Details

Fixed Issues

$ https://github.com/Expensify/App/issues/38579 PROPOSAL: https://github.com/Expensify/App/issues/38579#issuecomment-2008043289

Tests

  1. Go to https://staging.new.expensify.com/
  2. Log in as Employee of a Collect WS
  3. Open WS chat and request a money
  4. Open IOU and press Submit button in the header
  5. Verify that the submitted system message is in the form You submitted this report to ...
  • [x] Verify that no errors appear in the JS console

Offline tests

QA Steps

  • [x] Verify that no errors appear in the JS console

PR Author Checklist

  • [x] I linked the correct issue in the ### Fixed Issues section above
  • [x] I wrote clear testing steps that cover the changes made in this PR
    • [x] I added steps for local testing in the Tests section
    • [x] I added steps for the expected offline behavior in the Offline steps section
    • [x] I added steps for Staging and/or Production testing in the QA steps section
    • [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • [x] I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • [x] I included screenshots or videos for tests on all platforms
  • [x] I ran the tests on all platforms & verified they passed on:
    • [x] Android: Native
    • [x] Android: mWeb Chrome
    • [x] iOS: Native
    • [x] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [x] MacOS: Desktop
  • [x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • [x] I followed proper code patterns (see Reviewing the code)
    • [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • [x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • [x] I verified that comments were added to code that is not self explanatory
    • [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • [x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • [x] If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • [x] I verified the JSDocs style guidelines (in STYLE.md) were followed
  • [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • [x] I followed the guidelines as stated in the Review Guidelines
  • [x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • [x] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • [x] I verified that if a function's arguments changed that all usages have also been updated correctly
  • [x] If any new file was added I verified that:
    • [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • [x] If a new CSS style is added I verified that:
    • [x] A similar style doesn't already exist
    • [x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • [x] If the PR modifies the form input styles:
    • [x] I verified that all the inputs inside a form are aligned with each other.
    • [x] I added Design label so the design team can review the changes.
  • [x] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • [x] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

https://github.com/Expensify/App/assets/38649957/17d57f1a-4c9c-41b3-80cf-e4dd2144b175

Android: mWeb Chrome

https://github.com/Expensify/App/assets/38649957/3ccf97d0-dbe6-4c60-9a0a-a23a3c021d4b

iOS: Native

https://github.com/Expensify/App/assets/38649957/b3166f98-18f5-466f-83c3-d8de1d826125

iOS: mWeb Safari

https://github.com/Expensify/App/assets/38649957/154478ba-7445-4a14-ac1b-e4ea5db0b574

MacOS: Chrome / Safari

https://github.com/Expensify/App/assets/38649957/388393dc-2c3c-4a75-8eb6-ab3fa57bc01d

MacOS: Desktop

https://github.com/Expensify/App/assets/38649957/8dedf37b-1f99-4a55-aa66-5972d759c9bd

FitseTLT avatar Mar 30 '24 17:03 FitseTLT

@situchan Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

melvin-bot[bot] avatar Mar 30 '24 17:03 melvin-bot[bot]

Will review in my morning time.

hungvu193 avatar Apr 01 '24 16:04 hungvu193

Note that, IOU preview is broken, it doesn't relate to this PR. It was reported here

https://github.com/Expensify/App/assets/16502320/21e179b3-4c12-46b5-90f8-0c6e45bc7cb9

hungvu193 avatar Apr 02 '24 02:04 hungvu193

Reviewer Checklist

  • [x] I have verified the author checklist is complete (all boxes are checked off).
  • [x] I verified the correct issue is linked in the ### Fixed Issues section above
  • [x] I verified testing steps are clear and they cover the changes made in this PR
    • [x] I verified the steps for local testing are in the Tests section
    • [x] I verified the steps for Staging and/or Production testing are in the QA steps section
    • [x] I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • [x] I checked that screenshots or videos are included for tests on all platforms
  • [x] I included screenshots or videos for tests on all platforms
  • [x] I verified tests pass on all platforms & I tested again on:
    • [x] Android: Native
    • [x] Android: mWeb Chrome
    • [x] iOS: Native
    • [x] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [x] MacOS: Desktop
  • [x] If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • [x] I verified proper code patterns were followed (see Reviewing the code)
    • [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • [x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • [x] I verified that comments were added to code that is not self explanatory
    • [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • [x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • [x] I verified the JSDocs style guidelines (in STYLE.md) were followed
  • [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • [x] I verified that this PR follows the guidelines as stated in the Review Guidelines
  • [x] I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • [x] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • [x] If a new component is created I verified that:
    • [x] A similar component doesn't exist in the codebase
    • [x] All props are defined accurately and each prop has a /** comment above it */
    • [x] The file is named correctly
    • [x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • [x] The only data being stored in the state is data necessary for rendering and nothing else
    • [x] For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • [x] Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • [x] All JSX used for rendering exists in the render method
    • [x] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • [x] If any new file was added I verified that:
    • [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • [x] If a new CSS style is added I verified that:
    • [x] A similar style doesn't already exist
    • [x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • [x] I verified that all the inputs inside a form are aligned with each other.
    • [x] I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • [x] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • [x] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • [x] I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native android Screenshot 2024-04-16 at 23 03 09
Android: mWeb Chrome

https://github.com/Expensify/App/assets/16502320/928e59e9-293c-4504-b4e0-43487c2be120

https://github.com/Expensify/App/assets/16502320/c30d101c-22fa-4684-8ae8-62a34575cf1a

iOS: Native

https://github.com/Expensify/App/assets/16502320/b602e4e0-59cf-4b04-bc9e-e0d778de0e86

Simulator Screenshot - iPhone 15 - 2024-04-16 at 22 44 58

iOS: mWeb Safari

https://github.com/Expensify/App/assets/16502320/0018337b-fb00-4e29-9423-8402f81d84fe

Simulator Screenshot - iPhone 15 - 2024-04-16 at 22 50 33

MacOS: Chrome / Safari

https://github.com/Expensify/App/assets/16502320/70177d79-431f-416c-b30b-69224cacd69f

https://github.com/Expensify/App/assets/16502320/f3b68d03-bf6e-44cb-90c5-c9a76687995a

MacOS: Desktop

https://github.com/Expensify/App/assets/16502320/46d995aa-598a-4d07-a8de-7f23ae0e0eca

Screenshot 2024-04-16 at 22 21 30

hungvu193 avatar Apr 02 '24 09:04 hungvu193

@FitseTLT Please update Offline and QA steps as well.

hungvu193 avatar Apr 02 '24 09:04 hungvu193

@FitseTLT The code looks good, don't forget to update the QA and Offline steps, so I can complete the checklist. Thank you

hungvu193 avatar Apr 02 '24 11:04 hungvu193

@FitseTLT The code looks good, don't forget to update the QA and Offline steps, so I can complete the checklist. Thank you

updated

FitseTLT avatar Apr 02 '24 11:04 FitseTLT

@FitseTLT The code looks good, don't forget to update the QA and Offline steps, so I can complete the checklist. Thank you

updated

I'm sorry but you need to update it as Same as Tests or Same as above.

hungvu193 avatar Apr 02 '24 11:04 hungvu193

@FitseTLT The code looks good, don't forget to update the QA and Offline steps, so I can complete the checklist. Thank you

updated

I'm sorry but you need to update it as Same as Tests or Same as above.

done

FitseTLT avatar Apr 02 '24 11:04 FitseTLT

Also @pecanoro as this pr is all about aligning what the BE is returning with the optimistic message we set in FE and I don't have the access to BE code, Can U please check that the message is the same with what u guys are setting in BE? I have tried to cover as many different cases as I could but giving a look at the BE code may give u more context.

FitseTLT avatar Apr 03 '24 14:04 FitseTLT

I think it is correct, the only missing piece does not seem to be handled in any cases in newDot ((automatically closed due to submit-only policy)), or I could not find it, so it is probably for old Expensify for now. However, I think we need to test a couple more examples, like submitting to yourself or reports that submit automatically.

pecanoro avatar Apr 03 '24 16:04 pecanoro

I think it is correct, the only missing piece does not seem to be handled in any cases in newDot ((automatically closed due to submit-only policy)), or I could not find it, so it is probably for old Expensify for now. However, I think we need to test a couple more examples, like submitting to yourself or reports that submit automatically.

Yeah I got a case I haven't covered where someone submits on behalf of someone. Will fix it! Thx for the hint

FitseTLT avatar Apr 03 '24 16:04 FitseTLT

@FitseTLT Any updates on that last case?

pecanoro avatar Apr 04 '24 19:04 pecanoro

@FitseTLT Any updates on that last case?

Will make it ready tomorrow

FitseTLT avatar Apr 04 '24 19:04 FitseTLT

I have added the case for admin-submit on behalf of the employee case. But tried to check non-admin approver case of submitting on behalf of employee but couldn't, so guys can u confirm if non-admin approver can submit on behalf of employee or not. Lastly, we shouln't worry about the auto-submit as it comes from BE :+1: But if you guys come up with uncovered case happy to add it 👍

FitseTLT avatar Apr 05 '24 20:04 FitseTLT

I have added the case for admin-submit on behalf of the employee case. But tried to check non-admin approver case of submitting on behalf of employee but couldn't, so guys can u confirm if non-admin approver can submit on behalf of employee or not. Lastly, we shouln't worry about the auto-submit as it comes from BE 👍 But if you guys come up with uncovered case happy to add it 👍

Can you also update the video including the case that you've added? Also please include it in your tests step.

hungvu193 avatar Apr 08 '24 07:04 hungvu193

@hungvu193 All yours now!

pecanoro avatar Apr 09 '24 20:04 pecanoro

I have added the case for admin-submit on behalf of the employee case. But tried to check non-admin approver case of submitting on behalf of employee but couldn't, so guys can u confirm if non-admin approver can submit on behalf of employee or not. Lastly, we shouln't worry about the auto-submit as it comes from BE 👍 But if you guys come up with uncovered case happy to add it 👍

Can you also update the video including the case that you've added? Also please include it in your tests step.

@FitseTLT I saw you liked my comment but you haven't updated it, do you have any update here please?

hungvu193 avatar Apr 09 '24 23:04 hungvu193

@FitseTLT Let us know when you update the description with the video so we can review it!

pecanoro avatar Apr 10 '24 09:04 pecanoro

Thx for your patience. I have updated snapshots. Only android native building is failing.

FitseTLT avatar Apr 10 '24 19:04 FitseTLT

Thanks. I'll review today.

hungvu193 avatar Apr 11 '24 03:04 hungvu193

hmm weird @FitseTLT can you check again? I couldn't approve from admin side.

https://github.com/Expensify/App/assets/16502320/5ecd854b-a6a1-4c9e-8920-594bbb45ca8e

hungvu193 avatar Apr 11 '24 06:04 hungvu193

@hungvu193 From the video I see that you are trying on an archived report and also I see you are trying to approve although what we need to do is submit.

FitseTLT avatar Apr 11 '24 08:04 FitseTLT

@hungvu193 From the video I see that you are trying on an archived report and also I see you are trying to approve although what we need to do is submit.

When I tried to approve it show report is archived even when I created a brand new workspace. That's why I asked you to check if you got the same issue with me.

hungvu193 avatar Apr 11 '24 08:04 hungvu193

@hungvu193 From the video I see that you are trying on an archived report and also I see you are trying to approve although what we need to do is submit.

When I tried to approve it show report is archived even when I created a brand new workspace. That's why I asked you to check if you got the same issue with me.

Whoo I really misunderstood your question, I didn't experience what you are saying. I don't know why but at least we know of course it cannot be related with this pr. 👍

FitseTLT avatar Apr 11 '24 08:04 FitseTLT

No worries, let's try it and let me know the result.

hungvu193 avatar Apr 11 '24 08:04 hungvu193

No worries, let's try it and let me know the result.

@FitseTLT any updates here please?

hungvu193 avatar Apr 12 '24 02:04 hungvu193

No worries, let's try it and let me know the result.

@FitseTLT any updates here please?

It is working perfectly for me @hungvu193

FitseTLT avatar Apr 12 '24 08:04 FitseTLT

No worries, let's try it and let me know the result.

@FitseTLT any updates here please?

It is working perfectly for me @hungvu193

Thank you. @pecanoro Can you also give it a try? Should be something wrong from my end

hungvu193 avatar Apr 12 '24 08:04 hungvu193

What is the action we are having trouble testing? Submitting from the admin side?

pecanoro avatar Apr 16 '24 10:04 pecanoro