Skip to content
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

Refactor integration enable disabled for script data. #21267

Merged
merged 13 commits into from
Apr 16, 2024

Conversation

thijsoo
Copy link
Contributor

@thijsoo thijsoo commented Mar 25, 2024

Context

  • We want to extract the script data logic to determine if integrations are enabled from the metabox logic.

Summary

This PR can be summarized in the following changelog entry:

  • Refactors the way script data is handled.

Relevant technical choices:

  • I chose to wrap the framework components directly in the repository class to not need a wrapper class just to hold the data. This way if we want to add a new integration to this system we can just add a new class in the framework folder and the repository will pick it up based on the interface.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Make sure free and premium are enabled.

Jetpack markdown

  • Install and activate the Jetpack plugin.
  • Open a post.
  • Paste the following in your browser console wpseoScriptData.metabox.markdownEnabled and make sure it is false.
  • Go to /wp-admin/admin.php?page=jetpack#/writing and enable Write posts or pages in plain-text Markdown syntax
  • Refresh your post and make sure wpseoScriptData.metabox.markdownEnabled is now true.

Multilingual

  • Install the following plugins from the WP directory but do not active them yet: Polylang, TranslatePress
  • Install wpml as a zip.
  • For each of the plugins activate one, refresh a post and then make sure wpseoScriptData.metabox.multilingualPluginActive is true. Deactivate it again refresh and make sure it is false. Repeat this for all three plugins.

Semrush

  • Make sure Semrush is toggled on in the integrations page. /wp-admin/admin.php?page=wpseo_integrations
  • Go to the editor
  • Paste the following in your browser console wpseoScriptData.metabox.semrushIntegrationActive and make sure it is true
  • Toggle the Semrush to off and refresh the editor and make sure it now returns false.
  • Enable Semrush again and run the following in the browser wpseoScriptData.metabox.SEMrushLoginStatus make sure it is false. (if you have never logged into Semrush before).
  • Click on Get related keyphrases and login in. Refresh and make sure the variable is now true. Also make sure wpseoScriptData.metabox.countryCode now has a value.

Wincher

  • Make sure Wincher is toggled on in the integrations page. /wp-admin/admin.php?page=wpseo_integrations
  • Go to the editor
  • Paste the following in your browser console wpseoScriptData.metabox.wincherIntegrationActive and make sure it is true
  • Toggle the Wincher to off and refresh the editor and make sure it now returns false.
  • Enable wincher again and run the following in the browser wpseoScriptData.metabox.wincherLoginStatus make sure it is false. (if you have never logged into Wincher before).
  • Click on Track SEO performance and login in. Refresh and make sure the variable is now true. Also make sure wpseoScriptData.metabox.wincherWebsiteId has a value.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • Smoke test Semrush and Wincher integration from the post editor
  • Smoke test the whole metabox scripta data object
    • A way to do that is to load a edit post page, run wpseoScriptData.metabox in the console and compare between this RC and the production version to confirm that the data returned is exactly the same.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@thijsoo thijsoo added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Mar 25, 2024
@thijsoo thijsoo linked an issue Mar 25, 2024 that may be closed by this pull request
@thijsoo thijsoo marked this pull request as ready for review March 26, 2024 12:48
@coveralls
Copy link

coveralls commented Mar 26, 2024

Pull Request Test Coverage Report for Build ead23dd595851e7500228feac22e8051e52e0f47

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 58 of 86 (67.44%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 54.56%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/analysis/isSEMrushIntegrationActive.js 0 1 0.0%
packages/js/src/analysis/isWincherIntegrationActive.js 0 1 0.0%
src/editors/framework/integrations/multilingual.php 14 16 87.5%
src/editors/framework/integrations/jetpack-markdown.php 10 14 71.43%
src/editors/framework/integrations/wincher.php 13 18 72.22%
src/editors/application/integrations/Integration-Information-repository.php 0 7 0.0%
src/editors/framework/integrations/semrush.php 15 23 65.22%
Totals Coverage Status
Change from base Build 6d81e2d8cec02f54e26aa74dd6da4226d6355b18: 0.3%
Covered Lines: 29697
Relevant Lines: 54411

💛 - Coveralls

Copy link
Contributor

@leonidasmi leonidasmi left a comment

Choose a reason for hiding this comment

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

CR: ✅

@leonidasmi
Copy link
Contributor

Acceptance test is ✅ as well, merging.

@leonidasmi leonidasmi added this to the 22.7 milestone Apr 16, 2024
@leonidasmi leonidasmi merged commit e9ac8ff into trunk Apr 16, 2024
36 checks passed
@leonidasmi leonidasmi deleted the 21186-refactor-integration-enabledisables branch April 16, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor integration enable/disables
3 participants