Skip to content

Conversation

@leogermani
Copy link
Contributor

@leogermani leogermani commented Mar 25, 2021

Adapts the local suite tests to work with user-less.

If the test is called in a context without a logged in user and without a connection owner, it will skip the check for the user token health.

If there is a connected logged in user, or if the site has a connected owner, it will also check for the user token health

Changes proposed in this Pull Request:

  • Adapt local test suite for user-less connections

Jetpack product discussion

Does this pull request change what data or activity we track or use?

N/A

Testing instructions:

  • Connect your site only at a site level (if not using the docker env, you need to activate user-less testing mode)
  • Visit the Jetpack Debugger no WP Admin
  • Visit the Jetpack Debugger on jptools.wordpress.com .
  • Make sure tests pass
  • Connect the user and run the tests again

Invalidate the Blog token and see that the test fails

@leogermani leogermani added the [Status] Needs Review This PR is ready for review. label Mar 25, 2021
@leogermani leogermani added this to the jetpack/9.6 milestone Mar 25, 2021
@leogermani leogermani requested a review from fgiannar March 25, 2021 18:14
@leogermani leogermani self-assigned this Mar 25, 2021
@leogermani leogermani requested a review from kraftbj as a code owner March 25, 2021 18:14
Copy link

@test-case-reminder test-case-reminder bot left a comment

Choose a reason for hiding this comment

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

Here are some suggested test cases for this PR.

Connection

  • In-place connection with free plan
  • In-place connection with paid plan
  • In-place connection with product purchase
  • Classic connection. Use Safari, or set a constant JETPACK_SHOULD_NOT_USE_CONNECTION_IFRAME to true
  • Disconnect/reconnect connection
  • Secondary user connection
  • Connection on multisite

Verify that the changes are compatible with the plugins that use the connection package.

  • WooCommerce Payments
  • Jetpack Boost
  • Previous versions of Jetpack

If you think that suggestions should be improved please edit the configuration file here. You can also modify/add test-suites to be used in the configuration file.

@github-actions github-actions bot added [Package] Connection [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Mar 25, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • 🔴 Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: April 6, 2021.
  • Scheduled code freeze: March 29, 2021.

Copy link
Contributor

@fgiannar fgiannar left a comment

Choose a reason for hiding this comment

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

Hi Leo!

Thanks for working on this!
I left some thoughts/suggestions inline.

$m = new Connection_Manager();
$user_id = get_current_user_id() ? get_current_user_id() : $m->get_connection_owner_id();
$m = new Connection_Manager();
$user_id = get_current_user_id() ? get_current_user_id() : $m->get_connection_owner_id();
Copy link
Contributor

Choose a reason for hiding this comment

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

Two suggestions :)

  1. How about we use $m->is_userless() here?
  2. I was thinking if it would be more straightforward to keep all token health checks in the same test? This way we don't need to skip it in case of a user-less connection or run a duplicate test in case of a full connection.

@fgiannar fgiannar added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Mar 26, 2021
Copy link
Contributor

@fgiannar fgiannar left a comment

Choose a reason for hiding this comment

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

LGTM 🥇

@leogermani leogermani merged commit 2eff7f7 into master Mar 26, 2021
@leogermani leogermani deleted the add/test_blog_token_health branch March 26, 2021 15:51
@github-actions github-actions bot removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Connection [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants