Skip to content

[No QA] add comprehensive layout and responsiveness tests for NumericInput - #104544

Merged
mountiny merged 3 commits into
Expensify:mainfrom
software-mansion-labs:jmgraa/numeric-input-layout-tests
Oct 22, 2026
Merged

mountiny merged 3 commits into
Expensify:mainfrom
software-mansion-labs:jmgraa/numeric-input-layout-tests

Conversation

@jmgraa

@jmgraa jmgraa commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Following the consolidation of NumericInput with the full-screen layout architecture and BigNumberPad (#102140), this PR introduces a dedicated UI test suite validating responsiveness and layout behavior across device form factors, screen orientations, and input capabilities (phones, tablets, and non-touch devices).

Key testing coverage introduced:

  • Responsive Phone Layout (NumericInputLayoutTest.tsx):
    • Tests dynamic transition between single-column centered layout in portrait and two-column split layout in landscape on phones (useIsInLandscapeMode).
    • Verifies bottom safe area inset handling across form factors and orientation changes.
    • Tests focus delegation and selection preservation when interacting with pad button gaps on web.
  • Tablet Form Factor (NumericInputLayoutTabletTest.tsx):
    • Verifies that tablet devices maintain a single scrollable column layout in landscape orientation rather than splitting into two columns.
  • Non-Touch Devices (NumericInputLayoutWithoutTouchScreenTest.tsx):
    • Verifies number pad omission on devices without touch screens.
    • Tests inline action button positioning directly beneath the amount input and footer bottom spacing without residual pad gaps.
    • Verifies orientation-specific error positioning (absolute with bottom spacing in portrait vs. normal flow in landscape).
  • Test Utilities & Cleanup (NumericInputLayoutTestUtils.tsx, NumericBigNumberPadTest.tsx):
    • Centralizes mock layout providers, layout rendering helpers, test IDs, and style helpers in NumericInputLayoutTestUtils.tsx.
    • Removes redundant layout event bubbling and landscape safe-area tests from NumericBigNumberPadTest.tsx now covered by the dedicated layout suite.

Fixed Issues

$ #98171
PROPOSAL: #97970

Tests

N/A - Test suite additions only. Automated tests are executed via CI, and can be run locally with: npm run test -- tests/ui/NumericInputLayout* tests/ui/NumericBigNumberPadTest.tsx

  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

N/A

  • 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: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • 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 verified any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • 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)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • 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.

@jmgraa

jmgraa commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T14:56:12.824550Z 724ccec Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 3edc9035ee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@JakubKorytko JakubKorytko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nothing blocking, a few small ones below

Comment thread tests/ui/NumericInputLayoutTest.tsx Resolved
Comment thread tests/ui/NumericInputLayoutTest.tsx Resolved
@JakubKorytko

Copy link
Copy Markdown
Member

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

I found no correctness bugs. The tests assert real behavior and I found nothing flaky. Before merging, close one coverage gap and fix a few PR description claims.

1. Coverage gap: no test presses the pad anymore. The removed NumericBigNumberPadTest cases fired mouseDown on layout-pad. The new tests fire on the footer (L268, L297, L345). In two columns, the footer is a direct child of the root View, but the pad sits inside the body ScrollView (NumericInputLayout.tsx:97-111). If the handler moved to the footer wrapper, every new test would still pass, but pressing the gaps between pad keys would stop refocusing the input. To fix this, run the single-column/two-column it.each against PAD_TEST_ID too.

2. The PR description claims checks the tests don't make:

  • Tablet: "body width limits, and action positioning". NumericInputLayoutTabletTest.tsx:61-77 only checks one column versus two.
  • Layout: "pad button gaps". See item 1.
  • Non-touch: "directly beneath the amount input". places the actions right under the amount only checks that the button and the input share layout-amount. It would still pass if the actions rendered above the input. Either assert the order or rename the test.
Nits and what I checked
  • Duplicates: the new landscape safe-area tests replace the weaker ones at NumericBigNumberPadTest.tsx:621-650, so you can delete the old ones in this cleanup. The currency-press check in the non-touch test duplicates NumericButtonTest.tsx:42.
  • Tablet a wide window case (L63): it runs the same branch as the 1366x1024 case and does not touch the web window.screen helper. Drop it or rename it.
  • Checked and fine:
    • The footer press reaches the root onMouseDown in both layouts.
    • The tablet test really depends on isTablet, which is read once at import in isInLandscapeMode/index.native.ts. With isTablet set to false, both cases would fail.
    • findAncestorWithStyle returns undefined, so the toBeDefined() checks mean something.
    • The useSafeAreaInsets mock reaches useSafeAreaPaddings.
    • The not.toHaveProperty checks run on flattened objects, so they can fail.
  • I reviewed by reading the code only. I couldn't run Jest in this environment.

@jmgraa
jmgraa marked this pull request as ready for review October 21, 2026 14:44
@jmgraa
jmgraa requested a review from a team as a code owner October 21, 2026 14:44
@melvin-bot
melvin-bot Bot requested review from bernhardoj and removed request for a team October 21, 2026 14:54
@melvin-bot

melvin-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

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

@bernhardoj

bernhardoj commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • 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)
    • 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • 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
  • I verified any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • 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)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • 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
    • 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 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@melvin-bot
melvin-bot Bot requested a review from mountiny October 22, 2026 04:44

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, thanks for this

@mountiny
mountiny merged commit d347157 into Expensify:main Oct 22, 2026
35 of 38 checks passed
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.20-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀

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

Bundle Size Analysis (Sentry):

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.

6 participants