-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add QAB for Create report flow #59167
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
Add QAB for Create report flow #59167
Conversation
case CONST.QUICK_ACTIONS.TRACK_MANUAL: | ||
case CONST.QUICK_ACTIONS.TRACK_SCAN: | ||
case CONST.QUICK_ACTIONS.TRACK_DISTANCE: | ||
selectOption(() => startMoneyRequest(CONST.IOU.TYPE.TRACK, reportID, requestType, true), false); | ||
return; | ||
case CONST.QUICK_ACTIONS.CREATE_REPORT: | ||
selectOption(() => createNewReport(currentUserPersonalDetails, policyID), true); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be changed to 'return' here to maintain consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a linter rule prohibiting it for some reason :(. But I will change everything to break
, so that it's consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works!, but what's the issue that it throws?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/libs/actions/Report.ts
Outdated
{optimisticData, successData, failureData}, | ||
); | ||
Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: optimisticReportID, backTo: Navigation.getActiveRoute()}), {forceReplace: shouldForceReplaceScreen}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to move it here 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that we should do it in the page rather than here, it's mostly what we have been following in the application NAB though, @mountiny thoughts ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is mainly because we later add conditional navigation to the routes, it's better to do it in the page than passing a new prop altogether
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was reluctant to add Navigation
import to QuickActionNavigation.ts
but after all, that doesn't seem so bad. I'll do it the way you suggest.
@thesahindia 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] |
@thesahindia this is handled as part of the project |
🚧 @mountiny has triggered a test app build. You can view the workflow run here. |
@@ -2528,6 +2528,15 @@ function buildNewReportOptimisticData(policy: OnyxEntry<Policy>, reportID: strin | |||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReport?.reportID}`, | |||
value: {[reportActionID]: optimisticReportPreview}, | |||
}, | |||
{ | |||
onyxMethod: Onyx.METHOD.SET, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we use SET in all of these, I think we should just use Merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allgandalf can you think of a reason to use Set for these instead of Merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found some comments from the previous implementation:
App/src/libs/actions/Report.ts
Lines 1012 to 1013 in 92a5a89
// Change the method to set for new reports because it doesn't exist yet, is faster, | |
// and we need the data to be available when we navigate to the chat page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some quick docs from the upstream repo:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It says:
- Use
set()
when you need to delete an Onyx key completely from storage - Use
set()
when you need to completely reset an object or array of data
I say merge
should be better here no than set
, lets see what the authors thought process was
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every onyx data update(there's about 18 of them) of ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE
is a SET, for sake of consistence I also used SET.
That might be a good explanation, why we always use SET:
Use set() when you need to completely reset an object or array of data
new Quick Action is something different, that the old one and no stale data should be left, so using SET seems reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but at the same time we only use the same keys so nothing stale would be left behind. NAB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a test for the expected onyx data when the createReport action is executed? same when it fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated tests are the new normal 😌
policyID: string | undefined, | ||
selectOption: (onSelected: () => void, shouldRestrictAction: boolean) => void, | ||
) { | ||
const quickActionReportID = `${quickAction?.chatReportID ?? CONST.DEFAULT_NUMBER_ID}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If report ID is not present we pass it as undefined, so that the onyx gets the correct value, please update this one, let the undefined value be passed and deal with it whereever type check throws error
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
Fixed comments and added test cases, all yours @allgandalf! |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-03-28.at.5.55.46.PM.movAndroid: mWeb ChromeScreen.Recording.2025-03-28.at.5.55.02.PM.moviOS: NativeScreen.Recording.2025-03-28.at.5.57.27.PM.moviOS: mWeb SafariScreen.Recording.2025-03-28.at.5.58.17.PM.movMacOS: Chrome / SafariScreen.Recording.2025-03-28.at.5.48.57.PM.movMacOS: DesktopScreen.Recording.2025-03-28.at.5.52.07.PM.mov |
@@ -2528,6 +2528,15 @@ function buildNewReportOptimisticData(policy: OnyxEntry<Policy>, reportID: strin | |||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReport?.reportID}`, | |||
value: {[reportActionID]: optimisticReportPreview}, | |||
}, | |||
{ | |||
onyxMethod: Onyx.METHOD.SET, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but at the same time we only use the same keys so nothing stale would be left behind. NAB
navigateToQuickAction(true, {action: CONST.QUICK_ACTIONS.ASSIGN_TASK, targetAccountID: 123}, {accountID: 1234}, undefined, (onSelected: () => void) => { | ||
onSelected(); | ||
}); | ||
expect(startOutCreateTaskQuickAction).toHaveBeenCalled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a test where we ensure the QAB data was correctly set in onyx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree ^, but not blocking my review for this
Why does the header change ? Can't we set it optimistically ? Screen.Recording.2025-03-28.at.5.45.00.PM.mov |
It's getting fixed in empty state PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test LGTM!
Onyx.disconnect(connection); | ||
|
||
// Then the quickAction.action should be set to CREATE_REPORT | ||
expect(quickAction?.action).toBe(CONST.QUICK_ACTIONS.CREATE_REPORT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future pr could you also assert the report id
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.21-0 🚀
|
@SzymczakJ How we can enable it?
|
@izarutskaya all your applause test emails on the domain have the beta enabled already |
@mountiny What means this precondition, could you please explain this? Thank you
|
@izarutskaya I think that means you had free trial on a workspace, did not put billing card on it and the trial expired so you cannot create new billable actions |
@mountiny I think we can't check this PR as applause account don' have free trial. We can see this only on gmail, but it's not in beta. Gmail accounts are restricted once the trial has expired, not Expensifail accounts. Let me know please if I something missed. |
All good, we will test it in the full walkthrough before releasing the feature |
Sorry, for not responding earlier, @mountiny explained that correctly. |
🚀 Deployed to production by https://github.com/grgia in version: 9.1.21-3 🚀
|
Explanation of Change
Fixed Issues
$ #57657
PROPOSAL:
Tests
To test you need to have tableReportView beta enabled and a paid workspace with chat enabled.
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2025-03-27.at.15.43.28.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2025-03-27.at.15.32.24.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2025-03-27.at.15.18.48.mov
MacOS: Desktop