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

Open a test tools modal with 5 taps on dev #13900

Merged
merged 22 commits into from
Feb 22, 2023
Merged

Conversation

neil-marcellini
Copy link
Contributor

@neil-marcellini neil-marcellini commented Dec 30, 2022

cc @Beamanator

Details

On dev only, you can now open a test tools modal by tapping anywhere in the app 5 times, making it easy to toggle force offline from any page.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/246352
PROPOSAL: N/A

Tests

  1. Tap or click rapidly 5 times anywhere in the app that doesn't already trigger navigation
  2. Verify that a modal opens with the test tools
  3. Toggle Force offline and verify that the app goes offline
  4. Toggle Force offline and verify that the app goes back online
  5. Close the modal by clicking outside of it
  6. Repeat these steps on another page
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

  1. Tap or click rapidly 5 times anywhere in the app that doesn't already trigger navigation
  2. Verify that a modal does not open. The feature only exists on dev.
  • Verify that no errors appear in the JS console

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 / Chrome
    • iOS / native
    • iOS / 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 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 correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • 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 a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • 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)
    • 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)
    • All JSX used for rendering exists in the render method
    • 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
  • 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(themeColors.componentBG)
  • 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 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.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
androidChrome.mov
Mobile Web - Safari
iOSSafari.mp4
Desktop
desktop.mov
iOS
iOS.mp4
Android
android.mov

@neil-marcellini neil-marcellini self-assigned this Dec 30, 2022
@neil-marcellini neil-marcellini changed the title Special gesture for the test tool menu [No QA] Open a test tools modal with 5 taps on dev Feb 8, 2023
@neil-marcellini neil-marcellini changed the title [No QA] Open a test tools modal with 5 taps on dev Open a test tools modal with 5 taps on dev Feb 8, 2023
@neil-marcellini neil-marcellini marked this pull request as ready for review February 8, 2023 01:50
@neil-marcellini neil-marcellini requested a review from a team as a code owner February 8, 2023 01:50
@melvin-bot melvin-bot bot requested review from mananjadhav and techievivek and removed request for a team February 8, 2023 01:50
@MelvinBot
Copy link

@mananjadhav @techievivek One of you needs to 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]

@neil-marcellini
Copy link
Contributor Author

@techievivek do you have an Android device? Would you be willing to help me try to test on Android chrome with a physical device? I'm hoping the bug I observed is only on the simulator.

@MelvinBot
Copy link

🎯 @mananjadhav, thanks for reviewing and testing this PR! 🎉

An E/App issue has been created to issue payment here: #14993.

@@ -72,6 +76,19 @@ class ScreenWrapper extends React.Component {
}

render() {
// Open the test tools menu on 5 taps in dev only
const isDevEnvironment = this.props.environment === CONST.ENVIRONMENT.DEV;
Copy link
Collaborator

@mananjadhav mananjadhav Feb 9, 2023

Choose a reason for hiding this comment

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

@neil-marcellini Should this be here or still an outer layer?

I tried the taps on Login page and it didn't work? Now I am not sure if we would even need it there, but we do have controls like sign-in and language change which cannot be tested offline if the Test modal won't show up.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good point. It will be good to place it in a more outer layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this to the ScreenWrapper since it appears to wrap almost every page. The public screens that have content other than a loading indicator, such as the SetPasswordPage and the SignInPage, do not use the screen wrapper.

I could try to use the ScreenWrapper on these pages but I would have to test how that works. Alternatively I could create another wrapper component specifically for this gesture and use it on these public pages as well in the screen wrapper.

I think it's relatively rare to test changing offline state on the public screens, so maybe I could implement that with a follow up PR sometime next week? Does that work for you guys?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah a follow up PR sounds okay to me.

@mananjadhav

This comment was marked as outdated.

@mananjadhav
Copy link
Collaborator

@neil-marcellini While it worked fine for all the platforms, I am able to reproduce the glitch on the physical device too.

android-test-modals-glitch.mp4

@neil-marcellini
Copy link
Contributor Author

@mananjadhav Ok, thanks for testing on the physical device! I'll look into why that's failing on Android Chrome later this week. In the meantime, please let me know if you have any ideas about why it's not working there.

@neil-marcellini
Copy link
Contributor Author

@mananjadhav @techievivek I did some debugging on Android Chrome and I found that for whatever reason the onBackdropPress callback in the BaseModal was getting called. I think Android Chrome might not be able to keep up with the rapid taps or something like that.

I ended up throttling a function to toggle the modal visibility, that way a quick press after it mounts won't close it. It's slightly hacky but I think it's fine because I don't think most people will use this on the android emulator with Chrome. You can simply turn off the wifi on the android emulator. Please review again 😄

@mananjadhav
Copy link
Collaborator

@neil-marcellini I agree that it is fine to have a throttle because it is only for dev environment. But it still doesn't work for Android Chrome.

mweb-chrome-throttle-test-modals.mov

@mananjadhav
Copy link
Collaborator

@neil-marcellini Tried the same on physical device, still the popup closes immediately.

mweb-android-test-tools.mp4

@neil-marcellini
Copy link
Contributor Author

Hmm that's odd @mananjadhav, it works for me. I did find that it didn't always work, such as if I did 4 or 6 taps, or if I held for too long on the last tap. I'm not really sure how to improve it here so hopefully this is good enough and we can merge this and move on. @techievivek please review.

@techievivek
Copy link
Contributor

techievivek commented Feb 22, 2023

Yeah, I think for v1 this is good, and if we want to improve it, we can look into it later.

@mananjadhav
Copy link
Collaborator

Okay noted thanks @techievivek @neil-marcellini. We just need to be sure that this doesn't come up as a regression during the QA.

Copy link
Contributor

@techievivek techievivek 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 to me, just waiting for the Travis to finish.

@mananjadhav
Copy link
Collaborator

mananjadhav commented Feb 22, 2023

I had this checklist completed earlier too with all the screencasts from different platforms.

@techievivek techievivek merged commit a7ec150 into main Feb 22, 2023
@techievivek techievivek deleted the neil-test-tool-gesture branch February 22, 2023 12:47
@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.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
Open Search Page TTI 616.945 ms → 632.872 ms (+15.927 ms, +2.6%)
App start runJsBundle 182.933 ms → 192.125 ms (+9.192 ms, +5.0%)
App start TTI 686.785 ms → 694.193 ms (+7.408 ms, +1.1%)
App start nativeLaunch 21.552 ms → 22.323 ms (+0.771 ms, +3.6%)
App start regularAppStart 0.013 ms → 0.013 ms (-0.000 ms, -3.1%)
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 616.945 ms
Stdev: 19.754 ms (3.2%)
Runs: 586.6466879993677 586.6809899993241 588.3949379995465 590.3994140010327 596.84305800125 597.0896819997579 600.0101319998503 600.2480069994926 601.7180179990828 606.8258459996432 609.1899829991162 609.7310380004346 609.8837900012732 611.0078529994935 614.7593590002507 615.7736409995705 615.8055419996381 620.3297129999846 621.1501470003277 626.2141110002995 628.4182130005211 628.4646410010755 629.3535160012543 631.4781499989331 631.8678390011191 632.6377370003611 632.659831000492 635.480793999508 636.0747880004346 660.772339001298 669.3743900004774

Current
Mean: 632.872 ms
Stdev: 27.164 ms (4.3%)
Runs: 577.7454429995269 583.4919440001249 588.1239019986242 588.8636879995465 602.3492440003902 602.6859130002558 603.6247559990734 609.6338300015777 612.0572510007769 614.7919929996133 615.6063240002841 623.421916000545 628.5736900009215 629.7908119987696 638.1230070013553 638.3346360009164 639.5703940000385 640.0281569994986 640.0954189989716 640.8884280007333 643.8561599999666 646.9882810004056 646.9914139993489 648.9596359990537 652.2970379982144 653.3720300011337 657.6560880001634 666.5683190003037 667.5960700009018 669.3446859996766 670.0001640003175 671.625652000308 671.7075200006366
App start runJsBundle Baseline
Mean: 182.933 ms
Stdev: 15.375 ms (8.4%)
Runs: 161 163 163 167 168 169 169 171 171 173 175 176 177 178 181 181 183 183 187 189 190 190 191 194 196 196 197 207 217 225

Current
Mean: 192.125 ms
Stdev: 21.526 ms (11.2%)
Runs: 159 166 170 170 172 173 173 174 174 175 176 183 185 185 186 186 187 188 190 191 194 194 199 207 208 214 218 222 223 224 234 248
App start TTI Baseline
Mean: 686.785 ms
Stdev: 26.765 ms (3.9%)
Runs: 635.9556220006198 640.310789000243 643.0165539998561 643.5238559991121 646.0566300004721 664.1541130002588 664.2613759990782 664.8315089996904 671.5236659999937 673.9392039999366 675.5838949996978 677.5890170000494 682.1782510001212 685.5754090007395 688.4463999997824 690.6671959999949 692.0610160008073 692.4656739998609 692.790524000302 695.8979540001601 696.3194660004228 697.4025899991393 699.0958099998534 701.2938819993287 707.3115270007402 708.6492759995162 712.9314699992537 718.9396100006998 720.3506809994578 721.7883199993521 734.5289619993418 737.6838240008801

Current
Mean: 694.193 ms
Stdev: 30.476 ms (4.4%)
Runs: 643.8388829994947 649.4732300005853 654.2748479992151 655.5623799990863 663.3689559996128 663.7102770004421 668.0764789991081 668.3380110003054 669.3422720003873 670.2980250008404 676.2132559996098 683.105340000242 684.8965729996562 685.2753860000521 688.6430259998888 690.8025109991431 692.2627670001239 693.5276050008833 695.516829000786 698.2250619996339 707.2072700001299 713.281020000577 714.8770230002701 719.2213049996644 723.9781049992889 730.2157240007073 731.6981169991195 739.4273400008678 744.663200000301 749.3123669996858 751.3426600005478
App start nativeLaunch Baseline
Mean: 21.552 ms
Stdev: 2.444 ms (11.3%)
Runs: 18 19 19 19 19 19 20 20 20 20 20 20 21 21 21 21 22 22 22 22 22 23 23 24 24 24 24 28 28

Current
Mean: 22.323 ms
Stdev: 3.296 ms (14.8%)
Runs: 19 19 19 19 19 19 20 20 20 20 21 21 21 21 21 21 22 22 22 22 23 23 23 23 25 25 25 26 28 31 32
App start regularAppStart Baseline
Mean: 0.013 ms
Stdev: 0.001 ms (4.9%)
Runs: 0.012206999585032463 0.012328999117016792 0.012328999117016792 0.012369999662041664 0.01245100051164627 0.012613998726010323 0.012614000588655472 0.012655001133680344 0.012735998257994652 0.012736000120639801 0.012776000425219536 0.012777000665664673 0.012938998639583588 0.012939998880028725 0.013103000819683075 0.013182999566197395 0.013265000656247139 0.013345999643206596 0.013345999643206596 0.013345999643206596 0.013468999415636063 0.013508999720215797 0.013508999720215797 0.013631001114845276 0.013670999556779861 0.013752998784184456 0.01411999948322773 0.014160001650452614 0.014281999319791794 0.014322999864816666 0.014567000791430473

Current
Mean: 0.013 ms
Stdev: 0.001 ms (4.5%)
Runs: 0.011840999126434326 0.011880999431014061 0.012125998735427856 0.012207001447677612 0.012248000130057335 0.01228800043463707 0.012289000675082207 0.012328999117016792 0.012368999421596527 0.012369001284241676 0.012369999662041664 0.012532999739050865 0.012653999030590057 0.012654999271035194 0.01269499957561493 0.012736000120639801 0.012736000120639801 0.012775998562574387 0.01285799965262413 0.012897999957203865 0.012899000197649002 0.012980001047253609 0.013061000034213066 0.013183999806642532 0.013224000111222267 0.013345999643206596 0.013387000188231468 0.01354999840259552 0.013590998947620392 0.013793999329209328 0.014443999156355858

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/techievivek in version: 1.2.76-0 🚀

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

@neil-marcellini
Copy link
Contributor Author

I'm reverting this because it caused a regression 😞. It was mentioned in Slack here.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

1 similar comment
@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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.

5 participants