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

Debug Mode - Report and Report Actions #45481

Merged

Conversation

pac-guerreiro
Copy link
Contributor

@pac-guerreiro pac-guerreiro commented Jul 16, 2024

Details

This PR introduces a new feature named Debug mode, which aims to provide both developers and QA's the necessary tools to diagnose the causes of issues and also detect issues.

These are the tools provided by this PR:

  • Toggle debug mode in Troubleshoot page
  • Check your accountID on Settings page
  • On a report, you’re able to debug it by pressing on the chat header and then pressing on Debug, just below Private Notes
  • On this new report debug page, you’re able to modify each property of the report object, in the details tab
  • In the JSON tab, you can check the JSON representation of the report
  • In the actions tab, you can see the list of all report actions associated with the current report
  • You’re able to create a new report action, where you just need to insert the JSON that represent the report action that you want to test and preview how it will look like in the chat
  • By pressing an existing report action, you’re redirected to a new report action debug page, where you can modify each property of the report action object, in the details tab
  • In the JSON tab, you can check the JSON representation of the report action
  • And in the preview tab, you can preview what the report action looks like in the chat

Fixed Issues

$ #48071
PROPOSAL:

Tests

  1. Go to Settings > Troubleshoot and enable debug mode
  2. Confirm that your accountID is shown on the header of the settings page, right below your email
  3. Go to Inbox and select any chat, then click on the chat header and click on Debug
  4. Check the details tab and confirm that any changes you apply are being saved correctly and applied in real-time
  5. Check the JSON tab and confirm that the changes you applied on details tab are present in the json representation of the data. Also confirm that you’re able to copy the json data using the top button
  6. Check the actions tab and try to create a new report action from there
    1. On the report action creation page, check that valid JSON data does get previewed and when you save it, it displays in real time on the report
  7. Click on any existing report action from the list in actions tab and repeat steps 4 and 5.

Offline tests

Same as tests.

QA Steps

Same as tests.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • 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)
    • 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).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • 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)
  • I followed proper code patterns (see Reviewing the code)
    • 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)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • 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.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • 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:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • 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.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • 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
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • 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
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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.
  • 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)
  • 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.
  • 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.
  • 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:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • 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.
  • 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
Android.-.Native.mp4
Android: mWeb Chrome
Android.-.Chrome.mp4
iOS: Native
iOS.-.Native.mov
iOS: mWeb Safari
iOS.-.Safari.mp4
MacOS: Chrome / Safari
MacOS.-.Chrome.mp4
MacOS: Desktop
MacOS.-.Native.mp4

@pac-guerreiro pac-guerreiro changed the title Debug Mode - Reports and Report Actions Debug Mode - Report and Report Actions Jul 16, 2024
@pac-guerreiro pac-guerreiro changed the title Debug Mode - Report and Report Actions [WIP] Debug Mode - Report and Report Actions Jul 16, 2024
src/ROUTES.ts Outdated Show resolved Hide resolved
src/components/TestToolMenu.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugJSON.tsx Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/Report/DebugReportActionCreatePage.tsx Outdated Show resolved Hide resolved
src/pages/Debug/Report/DebugReportActionCreatePage.tsx Outdated Show resolved Hide resolved
src/pages/Debug/Report/DebugReportActionPage.tsx Outdated Show resolved Hide resolved
src/pages/ProfilePage.tsx Outdated Show resolved Hide resolved
@pac-guerreiro pac-guerreiro changed the title [WIP] Debug Mode - Report and Report Actions Debug Mode - Report and Report Actions Jul 22, 2024
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
@pac-guerreiro pac-guerreiro marked this pull request as ready for review July 26, 2024 15:04
@pac-guerreiro pac-guerreiro requested a review from a team as a code owner July 26, 2024 15:04
@melvin-bot melvin-bot bot requested review from chiragsalian and removed request for a team July 26, 2024 15:04
Copy link

melvin-bot bot commented Jul 26, 2024

@chiragsalian 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]

Copy link
Contributor

@fabioh8010 fabioh8010 left a comment

Choose a reason for hiding this comment

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

minor comment, LGTM

src/pages/Debug/DebugDetails.tsx Outdated Show resolved Hide resolved
src/pages/ReportDetailsPage.tsx Show resolved Hide resolved
src/utils/isObject.ts Outdated Show resolved Hide resolved
src/libs/Navigation/linkingConfig/config.ts Show resolved Hide resolved
src/languages/es.ts Outdated Show resolved Hide resolved
src/pages/Debug/Report/DebugReportPage.tsx Outdated Show resolved Hide resolved
@DylanDylann
Copy link
Contributor

DylanDylann commented Jul 31, 2024

Screenshot 2024-07-31 at 15 36 29

I suggest dividing it into two folders

Report

  • DebugReportPage
  • DebugReportActions

ReportAction

  • DebugReportActionCreatePage
  • DebugReportActionPage
  • DebugReportActionPreview

@DylanDylann
Copy link
Contributor

I think we should add a style when hovering the item on this page then user can know that they can click on it

Screenshot 2024-07-31 at 16 23 27

@DylanDylann
Copy link
Contributor

@pac-guerreiro Please address above comments and resolve conflict

@pac-guerreiro
Copy link
Contributor Author

@DylanDylann

I applied your suggestions and requested translations from expensify team 😄

Also, I added a new file named DebugUtils, which includes functions that are useful for the debug mode, thus preventing a lot of code duplication 😄

@pac-guerreiro
Copy link
Contributor Author

I also added a feature to the JSON tab, which allows people to copy the whole JSON object to the clipboard 😄

@DylanDylann
Copy link
Contributor

DylanDylann commented Aug 5, 2024

Screen.Recording.2024-08-05.at.12.09.26.mov

@pac-guerreiro Crash App when typing an invalid time

@DylanDylann
Copy link
Contributor

DylanDylann commented Aug 5, 2024

@pac-guerreiro Everything else looks good. I will test again after the above comments are resolved. Thanks

@pac-guerreiro
Copy link
Contributor Author

@DylanDylann comments addressed, thank you for the review 😄

@DylanDylann
Copy link
Contributor

DylanDylann commented Aug 6, 2024

@pac-guerreiro Another crash bug has been found. Please verify all date fields to ensure they are not causing the app to crash. Thank you.

Screen.Recording.2024-08-06.at.17.28.12.mov

@pac-guerreiro
Copy link
Contributor Author

@DylanDylann it should not crash now! 😄

@DylanDylann
Copy link
Contributor

DylanDylann commented Aug 7, 2024

@pac-guerreiro We are displaying Expected: yyyy-MM-dd HH:mm:ss message for all fields

Screenshot 2024-08-07 at 14 11 28

@pac-guerreiro
Copy link
Contributor Author

@chiragsalian @mountiny

I had to rebase the whole branch with main to sign those two commits. It should be ready now to merge!

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Thanks!

@chiragsalian chiragsalian merged commit 8d19726 into Expensify:main Sep 18, 2024
19 of 20 checks passed
Copy link

melvin-bot bot commented Sep 18, 2024

@chiragsalian looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@melvin-bot melvin-bot bot added the Emergency label Sep 18, 2024
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@chiragsalian
Copy link
Contributor

Not an emergency. ESLint was failing and we discussed and agreed to ignore eslint errors for this PR to avoid further delays since its pretty large.

@mvtglobally
Copy link

@chiragsalian @DylanDylann @mountiny This seems like a very dev heavy PR. Can you pls QA this internally?

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/chiragsalian in version: 9.0.38-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.0.38-4 🚀

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.