-
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
Hides jetpack during onboarding if already connected #2516
Hides jetpack during onboarding if already connected #2516
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/2458-streamline-onboarding #2516 +/- ##
=======================================================================
- Coverage 64.5% 63.8% -0.7%
=======================================================================
Files 795 326 -469
Lines 22844 5086 -17758
Branches 1220 1229 +9
=======================================================================
- Hits 14739 3247 -11492
+ Misses 7938 1672 -6266
Partials 167 167
Flags with carried forward coverage won't be shown. Click here to find out 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.
This looks right to me. One small code quality nitpick, but it looks like it's functioning correctly. 👍🏻
@@ -101,6 +101,8 @@ const SetupAccounts = ( props ) => { | |||
* and the whole page would display this AppSpinner, which is not desired. | |||
*/ | |||
const isLoadingJetpack = ! jetpack; | |||
const isJetpackInactive = jetpack?.active !== 'yes'; |
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.
Nit: There are a couple other places below where we are checking for the jetpack.active
value (e.g., isLoadingGoogle
and isGoogleAccountDisabled
. Let's consolidate all of this logic by updating those references to make use of the new variable you're adding here. For readability, I'd also suggest making the variable isJetpackActive
rather than inactive, to avoid the double negative when checking for ! isJetpackInactive
, ex:
const isJetpackActive = jetpack?.active === 'yes';
// ...etc.
{ ! isJetPackActive && ( <WPComAccountCard /> ) }
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.
Updated
@joemcgill I've refactored the code per the feedback. Also confirmed that settings still show the card, AC is also updated to reflect this. Back to you for another review. |
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 @dsawardekar. The updates all look good to me. I tried running the e2e tests locally with these changes and noticed that this would require quite a few updates to the existing test suite, since many of the existing playwright tests depend on finding HTML elements in a particular order in the screen.
I went ahead and opened a follow-up PR that addresses those issues so you can review how these were previously set up.
Once you've taken a look, let's merge that PR into this branch prior to passing to QA for review.
…e-tests Update e2e tests for #2487
Thanks, @joemcgill . I've merged the PR, and updated the AC to remove the non-mocking based instructions. |
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, @dsawardekar. Looks good to me.
@joemcgill, I have reviewed the PR and found it to be functioning as described ✅. However, I came across a use case where I would appreciate your feedback: Current Behavior: When a user completes the onboarding flow, the WordPress.com card is hidden if Jetpack is connected, and the status is displayed as "connected" on the plugin’s Settings tab. Use Case: The button on the Settings screen labelled "Disconnect from all accounts" suggests that clicking it will disconnect all accounts, including the WordPress.com account. Furthermore, when the user clicks this button, a confirmation message (e.g., "I understand that I am disconnecting any WordPress.com account...") appears, reinforcing that the WordPress.com account will be disconnected. Given this, a user might expect the WordPress.com card to reappear on the onboarding screen when they restart the plugin setup. However, with the current implementation, the WordPress.com card does not appear on the first screen of the onboarding steps after all accounts have been disconnected. This discrepancy between the expected behaviour and the label/button details could cause some confusion for users. Recording.794.mp4Additional Note: I tested the same flow with the stable build and found that, when the user disconnects all accounts and restarts the onboarding journey, the WordPress.com card appears on the onboarding screen with a "CONNECTED" status. |
Thanks @ankitguptaindia! Re:
This behavior is something that both @dsawardekar and I noticed as well. This seems to be the current behavior in the |
@eason9487 this one is ready for your review. |
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 and the change in SetupAccounts
looks good.
Left a few suggestions for the e2e test. It would be great if unused methods could be removed.
const isLoadingGoogleMCAccount = | ||
google?.active === 'yes' && scope.gmcRequired && ! googleMCAccount; | ||
|
||
if ( isLoadingJetpack || isLoadingGoogle || isLoadingGoogleMCAccount ) { | ||
return <AppSpinner />; | ||
} | ||
|
||
const isGoogleAccountDisabled = jetpack?.active !== 'yes'; |
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 improvement! Thanks!
Re: #2516 (comment)
I'm no longer seeing this behavior today and the WP.com connection is being disconnected correctly when clicking "Disconnect all accounts" so this may have been due to a local configuration issue. |
@joemcgill PR updated, back to you for CR. RE: Disconnection I'm still seeing the disconnection issue. It appears to disconnect correctly, but shows an error on the FE. But if you refresh the page, everything except the Jetpack connection has disconnected. I'm currently using the jetpack REST override to reset the state. If there is a better way, please let me know. |
await expect( | ||
page.getByRole( 'button', { name: 'Connect' } ).first() | ||
).toBeEnabled(); |
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.
Let's remove this assertion once the once the previous suggestion is updated.
await expect( | |
page.getByRole( 'button', { name: 'Connect' } ).first() | |
).toBeEnabled(); |
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 updates
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 update for e2e tests! LGTM.
0bb6163
into
feature/2458-streamline-onboarding
Changes proposed in this Pull Request:
This PR improves the plugin setup process by conditionally hiding the WP.com account connection card when the store is already connected to WP.com.
Closes: #2487
Screenshots:
Disconnected:
Connected:
Settings:
Detailed test instructions:
npm run build
You can use the below code in an mu-plugin to temporarily test this by toggling the active state to 'yes' / 'no'.
Additional details:
Update - Hides WP.com card if already connected
To run the e2e tests for the onboarding process you can use,
$ npm run test:e2e -- tests/e2e/specs/setup-mc/step-1-accounts.test.js'
This PR also includes some refactoring of the E2E test playwright utilities to avoid relying on nth-child locations for account cards, now that the WP.com account card will not be displayed in some scenarios.
Changelog entry