Skip to content

[HOLD for payment 2024-08-19] [$750] [Violations] Remove violations beta from front-end #44995

Description

@cead22

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Problem

Violations were implemented under a beta and we're ready to release this functionality to everyone

Solution

  • Remove all the code in the front end using the violations beta, and run a thorough set of manual tests to make sure everything is working as designed.
  • The proposal should outline all the places in the code we need to update
  • The proposed test script is below, and both online and offline tests should be done on every platform

(related https://github.com/Expensify/Expensify/issues/338701)


Tests

Pre-testing steps

  • Make sure emails sent to the testing email addresses go to an inbox you can access to validate your account(s)
  • Create a new workspace in new dot and go to the workspace settings
    • From the members tab, invite an additional user to the policy
    • From the More Features tab, enable categories and tags
    • From the Categories tab, add at least 2 categories, click settings, and switch on “Members must categorize all expenses”
    • From the Tags tab, add at least 2 tags, click settings, and switch on “Members must tag all expenses”

Important Notes

  • Only the violations related to tags and categories work while offline. That means if you have a missing tag or missing category violation, you’re offline, and you update the tag or category, the violation should disappear. Similarly, if you’re online, the violation should disappear right away.
    • For other violations, you’ll need to wait for the API to return a response and update the transaction violations.
  • Some tests ask to verify that the report preview looks correct. If you're on the case of a single-expense report, where we put a money request preview directly in the workspace chat (as oppposed to workspace chat having report previews, and reports having money request previews), you can add a second expense to the report and then verify the report preview, or omit the step and verify the money request preview
  • If you find any steps need to be updated, please let us know so we can update our testing script

Missing tag and missing category violations

Manual Request

  1. Press big plus sign > submit expense
  2. Select Manual tab (from Manual | Scan | Distance)
  3. Enter amount and press next
  4. Press the workspace from the pre-testing steps (press the row, not the split button in the row)
  5. Press the show more button if it’s there
    • Verify there’s a Required label on the Category row
    • Verify there’s a Required label on the tag row
  6. Enter a merchant
  7. Press the Request $X.XX button
  8. Repeat steps 1-7
    • Verify the report preview in the workspace chat has a red circle
  9. Press the report preview
    • Verify the money request previews in the iou report have a red circle
  10. Press the first money request preview
    • Verify you see the Missing Category red text under the category row
  11. Press the category row
  12. Press on a category
    • Verify you no longer see the Missing Category red text under the category row
  13. Press the Tag row
  14. Press on a tag
    • Verify you no longer see the Missing Tag red text under the category row
  15. Press on the IOU chat report link at the top
  16. Press on the second money request view
  17. Repeat steps 11-15
  18. Press on the IOU chat report link at the top
    • Verify the money request previews in the iou report no longer have a red circle
  19. Press on the policy expense chat report link at the top
    • Verify the report preview in the policy expense chat report no longer has a red circle
  20. 🛜 Repeats all these steps while offline

Scan Request

  1. Same as the Manual Request test above, replacing steps 2 and 3 with the following
  2. Select Scan tab (from Manual | Scan | Distance)
  3. Press choose file, select an image
  4. Press the workspace from the pre-testing steps (press the row, not the split button in the row)
    • Verify there’s a Required label on the Category row
    • Verify there’s a Required label on the tag row
  5. Press the Submit expense button
  6. Continue from the verification of step 8 above, and once done, repeat all these steps while offline 🛜

Distance Request

  1. Same as the Manual Request test above, replacing steps 2 and 3 with the following
  2. Select Distance tab (from Manual | Scan | Distance)
  3. Press Start and enter an address, eg 88 Kearny st. Then Press Finish and enter an address, eg, 1180 jackson st. And press Next
  4. Continue from step 4 above, and once done, repeat all these steps while offline 🛜

Category out of policy, tag out of policy violation, expense over limit, max age, over category limit, receipt required

Manual Request

  1. In old dot, in the workspace editor > expenses tab, set max expense age to 5, max expense amount to $10, receipt required amount to $5
  2. In the workspace editor > categories tab, set the max amount for one of the categories to $3
  3. On new dot, press big plus sign > submit expense
  4. Select Manual tab (from Manual | Scan | Distance)
  5. Enter $15 as the amount amount and press next
  6. Press the workspace from the pre-testing steps
  7. Press the show more button
  8. Press the Date row, and set the date to be more than 5 days ago
  9. Press the category row, select a category that doesn’t have a max amount
  10. Press the tag row, select a tag
  11. Enter a merchant
  12. Press the Submit $15 button
  13. If you have more than one expense
    • Confirm the report preview has a red circle
  14. Press the report preview
    • Confirm the money request preview has a red circle and shows “Review Required”
  15. Press the report preview or money request preview (depending on the number of expenses)
    • Verify you see Receipt required over $5 violation
    • Verify you see Amount over $10.00/person limit violation
    • Verify you see Date older than 5 days violation
  16. Press the category row, and select the category with max amount set to $3
    • Verify you see Receipt required over $3 category limit violation
  17. On a different tab, sign into old dot as an admin of the workspace where the money request was created
  18. Go to the policy editor, and disable the category and the tag you added to the money request
  19. Switch back to new dot, and refresh the page
    • Verify you see Category no longer valid violation
    • Verify you see Tag no longer valid violation
  20. Switch back to old dot, re-enable the category and tag you had disabled, remove the max amount from the category, and from the expenses tab, remove the values from the Max Expense Age (Days), Max Expense Amount and Receipt Required Amount fields
  21. Switch back to new dot, and refresh the page
    • Verify you don’t see Category out of policy violation
    • Verify you don’t see Tag out of policy violation
    • Verify you don’t see Amount over $10/person limit violation
    • Verify you don’t see Date older than 5 days violation
    • Verify you don’t see Receipt required over $5 violation
  22. Repeat steps 1-3 in old dot
  23. 🛜 Switch to new dot and go offline
  24. Repeat steps 1-14. The report preview, money request preview should be grayed out
  25. Go online, and repeat steps 15-21

Scan Request

  1. Same as the Manual Request test above, replacing steps 4 and 5 with the following
  2. Select Scan tab (from Manual | Scan | Distance)
  3. Press choose file, select an image
  4. Press the workspace from the pre-testing steps
    • Verify there’s a Required label on the Category row
    • Verify there’s a Required label on the tag row
  5. Press the Request button
  6. Continue from the verification of step 13 above, and once done, repeat all these steps while offline 🛜

Distance Request

  1. Same as the Manual Request test above, replacing steps 4 and 5 with the following
  2. Select Distance tab (from Manual | Scan | Distance)
  3. Press Start and enter an address, eg 88 Kearny st. Then Press Finish and enter an address, eg, 1180 jackson st. And press Next
  4. Continue from step 6 above, and once done, repeat all these steps while offline 🛜

Tag violations on workspace with Independent Tags (multi-level tags)

Manual Request

  1. In old dot, in the workspace editor > tags tab, switch on the Use multiple levels of tags toggle
  2. Click import from spreadsheet, and upload the file in this issue comment
  3. On new dot, press big plus sign > submit expense
  4. Select Manual tab (from Manual | Scan | Distance)
  5. Enter $15 as the amount amount and press next
  6. Press the workspace from the pre-testing steps (press the row, not the split button in the row)
  7. Press the merchant row and enter a merchant
  8. Press the Submit $15 button
  9. Confirm the report preview has a red circle
  10. Press the report preview
  11. If the report has more than 1 expense
    • Confirm the money request preview has a red circle and shows “Review Required”
  12. Press the money request preview
    • Verify you see Missing Region, Missing Project, and Missing Department violations
  13. Press the Region menu item, and select a region
    • Verify that the Missing Region violation disappears right away
  14. Repeat for Department and Project
  15. Press the Region menu item, and unselect the selected region
    • Verify that the Missing Region violation appears right away
  16. 🛜 Switch to new dot and go offline
  17. Repeat steps 1-16. The report preview, money request preview should be grayed out
  18. Go online, and confirm everything looks the same, except nothing is grayed out
  19. Submit a new expense on the same workspace, and select all the required fields so there are no violation on that expense
  20. Click on the link in the transaction thread header to go back to the expense report if you didn’t land there already
    • Verify the money request preview says Missing Region next to the a red circle

Tag violations on workspace with Dependent Tags (multi-level tags)

Manual Request

  1. In old dot, in the workspace editor > tags tab, switch on the Use multiple levels of tags and the People must tag expenses toggles
  2. Click import from spreadsheet, uncheck “Are these independent tags?”, and upload the file in this issue comment
  3. On new dot, press big plus sign > submit expense
  4. Select Manual tab (from Manual | Scan | Distance)
  5. Enter $15 as the amount amount and press next
  6. Press the workspace from the pre-testing steps (press the row, not the split button in the row)
  7. Press the merchant row and enter a merchant
    • Confirm the Required label shows on the State, Region, and City rows
  8. Press the Submit $15 button
  9. Confirm the report preview has a red circle
  10. Press the report preview
  11. If the report has more than 1 expense
    • Confirm the money request preview has a red circle and shows “Review Required”
  12. Press the money request preview
    • Verify you see Missing State, Missing Region, and Missing City violations
  13. Press the Region menu item, and select a region
    • Verify that the Missing Region violation disappears right away
    • Verify you see All tags required violations under State and City
  14. Select a State
    • Verify that the see All tags required violation disappears from under State
    • Verify you see All tags required violations under City
  15. Select a City
    • Verify that the see All tags required violations are gone
  16. De-select City
    • Verify that the All tags required violation appears under City
  17. 🛜 Switch to new dot and go offline
  18. Repeat steps 1-16. The report preview, money request preview should be grayed out
  19. Go online, and confirm everything looks the same, except nothing is grayed out
  20. Submit a new expense on the same workspace, and select all the required fields so there are no violation on that expense
  21. Click on the link in the transaction thread header to go back to the expense report if you didn’t land there already
    • Verify the money request preview for the first expense says Review Required next to the a red circle
      Switch off requirement for tags and categories
      For the next tests, stop requiring tags and categories so you can focus on receipt related violations
  • Go to the workspace settings for the workspace you’re using
    • From the Categories tab switch off “Members must categorize all expenses”
    • From the Tags tab switch off “Members must tag all expenses”

Receipt Audit Scan

  1. Press big plus sign > submit expense
  2. Select Scan tab (from Manual | Scan | Distance)
  3. Press choose file and upload the popbagel.pdf file in this issue comment
  4. Select the workspace to submit to
  5. Wait for it to scan, it should be quick since we have a parser for square receipts
    • Verify you see “Receipt * Verified √” above the receipt
    • Verify amount is set to $21.90, and date to 2020-01-23
  6. Update the amount to $25
    • Verify you see “Amount greater than scanned receipt” violation under the amount field
  7. Click the blue link in the report header
  8. If there aren’t any other expenses on the report you added the receipt to, submit another expense on the same workspace
  9. Navigate to the expense report
    • Verify you see "Cash * Review required 🔴" in the Request Preview

Receipt Audit Distance

  1. Press big plus sign > submit expense
  2. Select Distance tab (from Manual | Scan | Distance)
  3. Press Start and enter an address, eg 88 Kearny st. Then Press Finish and enter an address, eg, 1180 jackson st. And press Next
  4. Select the workspace to submit to
  5. Click Submit $XX button
  6. Update the amount to $7
    • Verify you see “Amount differs from calculated distance” violation under the amount field
  7. Click the blue link in the report header
  8. If there aren’t any other expenses on the report you added the receipt to, submit another expense on the same workspace
  9. Navigate to the expense report
    • Verify you see "Distance * Review required 🔴" in the Request Preview
      Receipt Audit Card (Amount greater than card transaction)
  10. Import a third party domain control card via OldDot
  11. Find the card transaction in the workspace chat corresponding to the assigned employee, or visit the Search page and find the transaction by date.
  12. Open the card expense
  13. Change the amount of the card transaction to an amount higher than the original charge
  14. Verify that you see “Amount greater than scanned receipt”
  15. Verify that you see “Receipt * Issue found 🔴” above the receipt
  16. Navigate back to the transaction/expense preview.
  17. Verify that you see “Review required 🔴" in the Request Preview

Receipt Audit - Receipt Not Verified

  1. Press big plus sign > submit expense
  2. Select Scan tab (from Manual | Scan | Distance)
  3. Press choose file and upload a bad receipt. You can take a screenshot of a blank space on your screen and upload that
  4. Select the workspace to submit to
  5. Wait for it to scan, it should fail
    • Verify you see “Receipt scanning failed. Enter details manually.” violation under the receipt
  6. Add an amount and a merchant
    • Verify all violations are gone

cc @JmillsExpensify


View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e029ffdb5d51f383
  • Upwork Job ID: 1810382758841290536
  • Last Price Increase: 2024-07-08
  • Automatic offers:
    • ShridharGoel | Contributor | 103067321
Issue OwnerCurrent Issue Owner: @JmillsExpensify

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2ExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions