-
Notifications
You must be signed in to change notification settings - Fork 21
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
Kickoff MC and Ads account creation #2618
Kickoff MC and Ads account creation #2618
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/2509-consolidate-google-account-cards #2618 +/- ##
===============================================================================
Coverage ? 62.7%
===============================================================================
Files ? 324
Lines ? 5153
Branches ? 1259
===============================================================================
Hits ? 3232
Misses ? 1744
Partials ? 177
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Multiple API calls.
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.
@ankitrox I left a few comments on the PR. Can you kindly check them out please? Also most importantly I think we should implement the useCreateAccounts
hook in such a way that when we need to implement the other features, we can easily tweak/update it. Right now the hook is too rigid 😁 I suggest the following changes:
- The hook returns additional properties:
description
: for theYou don’t have Merchant Center nor Google Ads accounts, so we’re creating them for you.
texthelperText
: for theMerchant Center is required to sync products so they show on Google. Google Ads is required to set up conversion measurement for your store.
- The text above will be set when we need to create both accounts (which is the case for this ticket).
adsAccountCreated
: boolean to indicate that an ads account has been createdmcAccountCreated
: boolean to indicate that MC account has been created- From the 2 properties above, we can deduce
accountsCreated
.
- From the 2 properties above, we can deduce
isCreatingAdsAccount
: boolean to indicate that ads account creation is in progress.isCreatingMCAccount
: boolean to indicate that MC account creation is in progress.- From the 2 properties above, we can deduce
isCreatingAccounts
- From the 2 properties above, we can deduce
js/src/components/google-combo-account-card/connect-google-combo-account-card.scss
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connect-google-combo-account-card.scss
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connect-google-combo-account-card.scss
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connect-google-combo-account-card.scss
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
We had a typo in the feature branch for #2509. I've updated the branch and am changing the base of this PR to merge into the correct branch now. |
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.
@ankitrox I left some comments. Can you kindly check them out and let me know what you think please?
Thanks!
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
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've given this a look and given a bit of feedback inline. I do think it's important to resolve the hook dependencies conversation here before sending this to QA. There also seems to be some ESLint and Unit test issues to resolve before this is ready.
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/account-creation-description.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
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.
Nice updates! Some small suggestions about the new useGoogleMCAccountReady()
hook inline
This removes the unnecessary `SetupAdsAccountPage` from the E2E tests, since they were only being used for mocking and both `SetupAdsAccountPage` and `SetUpAccountsPage` extend the same mocking library.
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 looking much better to me, and i've been able to test several of the different connected states. I think we can improve some of the E2E test structure some more as the rest of the component gets filled out.
@eason9487 can you give this another look?
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 didn't view the code changes related to e2e testing in detail since they were continuously pushed commits while I was reviewing.
Due to #2618 (comment) and the following UI errors in one of the e2e test cases, I guess the e2e testing probably still needs to be adjusted accordingly, so I would like to submit the current feedback for this round.
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
js/src/components/google-combo-account-card/connected-google-combo-account-card.js
Outdated
Show resolved
Hide resolved
); | ||
[ '', 'billing', 'link_merchant' ].includes( step ); | ||
|
||
return isReady !== null ? isReady : null; |
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.
The ternary here seems redundant because it means:
If isReady
is !== null
, return isReady
If isReady
is === null
, return null
This can be simplified to:
return isReady !== null ? isReady : null; | |
return isReady; |
However, it seems this all be simplified to a boolean return value by wrapping the expression in parenthesis like this (and updating the docblock):
const isReady = (
hasGoogleAdsConnection &&
hasAccess &&
[ '', 'billing', 'link_merchant' ].includes( step )
);
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 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.
@joemcgill This has been addressed here:
google-listings-and-ads/js/src/hooks/useGoogleAdsAccountReady.js
Lines 24 to 26 in 9137ef6
if ( ! adsAccountResolved || ! adsAccountStatusResolved ) { | |
return null; | |
} |
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.
Also:
google-listings-and-ads/js/src/hooks/useGoogleAdsAccountReady.js
Lines 28 to 32 in 9137ef6
return ( | |
hasGoogleAdsConnection && | |
hasAccess && | |
[ '', 'billing', 'link_merchant' ].includes( step ) | |
); |
js/src/hooks/useGoogleMCAccount.js
Outdated
@@ -60,6 +64,12 @@ const useGoogleMCAccount = () => { | |||
GOOGLE_MC_ACCOUNT_STATUS.INCOMPLETE, | |||
].includes( acc?.status ); | |||
|
|||
const isReady = | |||
hasGoogleMCConnection && |
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 can be omitted since you are checking for the same account statuses below
hasGoogleMCConnection && |
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.
Upvote this.
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 has been removed:
google-listings-and-ads/js/src/hooks/useGoogleMCAccount.js
Lines 67 to 70 in 9137ef6
const isReady = | |
acc?.status === GOOGLE_MC_ACCOUNT_STATUS.CONNECTED || | |
( acc?.status === GOOGLE_MC_ACCOUNT_STATUS.INCOMPLETE && | |
acc?.step === 'link_ads' ); |
await setUpAccountsPage.fulfillAdsAccountStatus( { | ||
has_access: true, | ||
invite_link: '', | ||
step: 'link_merchant', |
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 very similar to the response from mockAdsStatusClaimed()
except for the step
that is returned. This matches what the API returns from the ads/account-status
endpoint:
However, when the the Ads account is in this state, the ads/connections
response would look something like this:
Making these two responses consistent would make for a more robust test, I think.
I've left a bit of feedback, but would appreciate if @eason9487 could give the latest iteration another look. |
js/src/hooks/useGoogleMCAccount.js
Outdated
@@ -60,6 +64,12 @@ const useGoogleMCAccount = () => { | |||
GOOGLE_MC_ACCOUNT_STATUS.INCOMPLETE, | |||
].includes( acc?.status ); | |||
|
|||
const isReady = | |||
hasGoogleMCConnection && |
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.
Upvote this.
@@ -11,31 +11,50 @@ export default class MockRequests { | |||
this.page = page; | |||
} | |||
|
|||
fulfillTimes( times ) { |
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 needs a docblock
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 has been updated.
tests/e2e/utils/mock-requests.js
Outdated
@@ -129,7 +148,6 @@ export default class MockRequests { | |||
* Fulfill the MC connection request. | |||
* | |||
* @param {Object} payload | |||
* @return {Promise<void>} |
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 don't think this return docs should be removed here or for fulfillAdsConnection
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.
Reverted this one.
tests/e2e/utils/mock-requests.js
Outdated
@@ -189,7 +207,6 @@ export default class MockRequests { | |||
* Fulfill the Ads Connection request. | |||
* | |||
* @param {Object} payload | |||
* @return {Promise<void>} |
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.
Keep (see above)
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.
Reverted this one.
Thanks for your valuable suggestion on E2E @eason9487. I have addressed these changes and left response to your comments. Assigning this to you for another pass. |
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.
Thanks for the work. LGTM.
Left a few comments and I believe it won't need another round of code reviews. I'll be approving in advance.
Thanks for your review and valuable suggestions @eason9487 . I've made the changes and merging the PR. |
7ceffde
into
feature/2509-consolidate-google-account-cards
Changes proposed in this Pull Request:
Closes #2567 .
Replace this with a good description of your changes & reasoning.
Screenshots:
Detailed test instructions
Create a new site and setup the GLA plugin (Make sure you are testing on the feature branch if this is not merged).
Go to
Marketing > Google for Woocommerce
and start onboarding process.Connect to the fresh Google account. This account should not have any existing merchant center accounts or Google ads account.
As soon as user sign-in flow is completed and user lands back to onboarding screen, there should be the card status changed to the one which should read
You don’t have Merchant Center nor Google Ads accounts, so we’re creating them for you.
as per the Figma designs.Once Merchant Center account and Ads account is created, card state will be changed this. Which will display Merchant Center ID and Google Ads ID (for 1-2 seconds ads ID may be seen as zero because ads request gets resolved later).
Note that there would be some error notices popping up regarding ads account connection and ads connection status, but this can be ignored for this issue and will be handled in Onboarding: Claim New Ads Accounts in the Google Combo Accounts Card #2582
Use custom plugin to test with existing account.
As it is very inconvenient to test with the fresh account everytime; especially in the scenario where Google may not allow more accounts to be created and asks for new mobile number (where we are out of phone numbers). Following method can help us to test with existing Google account.
*_options
table.These options can also be cleared using following npm command in local setup.
Additional details:
Changelog entry