[$250] iOS&Android Expense - App does not respond to long tap on receipt placeholder area on expense preview
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.72-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both If this was caught during regression testing, add the test name, ID and link from TestRail: Exp Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team
Action Performed:
- Go to staging.new.expensify.com
- Go to workspace chat.
- Create an expense with receipt.
- On the main workspace chat, long tap on the receipt area on the preview.
- Note that it responds to long tap and opens menu.
- Delete the expense.
- Submit an expense without receipt.
- On the main workspace chat, long tap on the receipt placeholder area on the preview.
Expected Result:
App will respond to the long tap and open more options menu.
Actual Result:
App does not respond to long tap on the empty receipt placeholder area on the expense preview.
Workaround:
Unknown
Platforms:
- [x] Android: Standalone
- [x] Android: HybridApp
- [ ] Android: mWeb Chrome
- [x] iOS: Standalone
- [x] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/91ebb35f-3f2f-4f84-ac83-d8e0262065a0
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021866480849153052085
- Upwork Job ID: 1866480849153052085
- Last Price Increase: 2024-12-10
Issue Owner
Current Issue Owner: @suneox
Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Edited by proposal-police: This proposal was edited at 2024-12-12 08:04:33 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Long press on a empty receipt doesn't show the context menu.
What is the root cause of that problem?
The receipt empty state is wrapped with a pressable. https://github.com/Expensify/App/blob/b9107bf59cbb3982d958abbae357e3b903ed4c63/src/components/ReceiptEmptyState.tsx#L24-L33
This makes it a nested pressable in a ReportPreview or MoneyRequestPreviewContent. The long press doesn't bubble up, which is why we manually handle the report preview long press to show the context menu. https://github.com/Expensify/App/blob/b9107bf59cbb3982d958abbae357e3b903ed4c63/src/components/ReportActionItem/ReportPreview.tsx#L464-L468
But we don't do the same for the receipt empty state component.
What changes do you think we should make in order to solve the problem?
But instead of handling the long press manually for receipt empty state, we can just render a View instead of Pressable if the receipt empty state onPress is undefined. (we need to remove the onPress default value)
https://github.com/Expensify/App/blob/b9107bf59cbb3982d958abbae357e3b903ed4c63/src/components/ReceiptEmptyState.tsx#L24-L33
const Wrapper = onPress ? PressableWithoutFeedback : View;
return (
<Wrapper
Then, we can remove the receipt image onPress from the ReportPreview and MoneyRequestPreviewContent. (the onPress is only being used by receipt empty state)
https://github.com/Expensify/App/blob/b9107bf59cbb3982d958abbae357e3b903ed4c63/src/components/ReportActionItem/ReportPreview.tsx#L475-L480
https://github.com/Expensify/App/blob/b9107bf59cbb3982d958abbae357e3b903ed4c63/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx#L351-L355
It was added because the parent pressable onPress isn't triggered when pressing on the receipt empty state. But we can remove it now since we won't use nested pressable anymore for the receipt empty state.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
When creating the test for this, I found that it behaves differently when running on the test environment. The issue we have here is basically if we have nested pressable, then only the inner pressable will receive the press/long-press event (which was observed first in this PR).
But when I recreate this on the test environment as simple as this:
render(
<Pressable onLongPress={() => console.log('outer')}>
<Pressable testID='test'>
</Pressable>
</Pressable>
)
fireEvent(await screen.findByTestId('test'), 'longPress');
the outer pressable long press is triggered just fine. So, the unit test can't cover this case.
@bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Job added to Upwork: https://www.upwork.com/jobs/~021866480849153052085
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (External)
@bernhardoj proposal LGTM. In this case, we can prevent nested pressables
π π π C+ reviewed
Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@bernhardoj @suneox can we add unit testing to the proposal? Or list a strong reason why we aren't adding unit tests? See this slack post for a reminder on our new policy of unit tests for bugs.
@bernhardoj @suneox can we add unit testing to the proposal? Or list a strong reason why we aren't adding unit tests? See this slack post for a reminder on our new policy of unit tests for bugs.
Currently, our tests focus on unit testing for functions like utilities, Onxy data, Req/Res, .... However, this issue involves user interactions, which we donβt fully support in unit tests yet But we can explore related code changes and provide manual test scenarios to prevent regression.
I believe we are able to test user interactions, there just aren't many test suites yet. See below test suites:
tests/ui/WorkspaceSwitcherTest.tsxtests/ui/UnreadIndicatorsTest.tsxtests/ui/SwitchToExpensifyClassicTest.tsxtests/ui/PaginationTest.tsx
If there is a technical reason why we can't add unit tests for this I'd like that to be added to the proposal. If it would take too much work than I'd also accept that, but I'd like to know why it takes so much work / isn't possible right now.
I have the same thought as @suneox of this comment.
If there is a technical reason why we can't add unit tests for this I'd like that to be added to the proposal.
I was trying to create the test and found that it's not "possible" to test it. I have added the explanation on the proposal.
@bernhardoj Thank you for the explanation! Sorry for bugging you both for it but we are really trying to push for more unit tests and its very helpful for me to know why its difficult or what scenarios we aren't able to test right now. Thank you! Lets fix this without new jest tests π
π£ @suneox π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
PR is ready
cc: @suneox
Reviewing label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.77-6 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/54100
If no regressions arise, payment will be issued on 2024-12-30. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @suneox requires payment automatic offer (Reviewer)
- @bernhardoj requires payment through NewDot Manual Requests
@suneox @bfitzexpensify @suneox The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Payment summary:
@bernhardoj to be paid $250 for contributor work via ND manual request @suneox to be paid $250 for C+ work - @suneox, please complete the BZ checklist and I'll finalise payment via Upwork
BugZero Checklist:
- [x] [Contributor] Classify the bug:
Bug classification
Source of bug:
- [ ] 1a. Result of the original design (eg. a case wasn't considered)
- [x] 1b. Mistake during implementation
- [ ] 1c. Backend bug
- [ ] 1z. Other:
Where bug was reported:
- [x] 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
- [ ] 2b. Reported on staging (eg. found during regression or PR testing)
- [ ] 2d. Reported on a PR
- [ ] 2z. Other:
Who reported the bug:
- [ ] 3a. Expensify user
- [ ] 3b. Expensify employee
- [ ] 3c. Contributor
- [x] 3d. QA
- [ ] 3z. Other:
-
[x] [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/52848/files#r1899525216
-
[x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
-
[x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
N/A: Due to it isn't an impactful bug
Thanks! Payment complete.
Requested in ND.
$250 approved for @bernhardoj