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

Protect: Add E2E Tests #42197

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from
Open

Protect: Add E2E Tests #42197

wants to merge 7 commits into from

Conversation

nateweller
Copy link
Contributor

@nateweller nateweller commented Mar 4, 2025

Proposed changes:

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

N/A

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

No

Testing instructions:

  • See the E2E README to run tests locally. Alternatively, you can review the logs from the automated test run on this PR.

@nateweller nateweller added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Mar 4, 2025
@nateweller nateweller requested a review from a team March 4, 2025 02:46
@nateweller nateweller self-assigned this Mar 4, 2025
Copy link
Contributor

github-actions bot commented Mar 4, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the add/protect/e2e-tests branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/protect/e2e-tests
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/protect/e2e-tests

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Tests] Includes Tests E2E Tests labels Mar 4, 2025
Copy link
Contributor

github-actions bot commented Mar 4, 2025

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.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Protect plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Copy link

jp-launch-control bot commented Mar 4, 2025

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@dkmyta
Copy link
Contributor

dkmyta commented Mar 4, 2025

I don't appear to be able to get the tests running locally and I don't see a line item in the PR checks for Jetpack Protect like for example Jetpack Boost has - does it make sense to separate them out early like that? If not, which of the E2E checks can I reference to verify that the tests are running/logging the results?

@nateweller nateweller force-pushed the add/protect/e2e-tests branch from f7f6603 to 16eb5e4 Compare March 5, 2025 19:03
@github-actions github-actions bot added Actions GitHub actions used to automate some of the work around releases and repository management Docs labels Mar 5, 2025
@nateweller nateweller added [Status] In Progress and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Mar 5, 2025
@nateweller
Copy link
Contributor Author

Added the config needed to get the tests running in GitHub, but they aren't passing 🤔

Works fine locally, getting some 404 errors when running in the cloud:

Running 1 test using 1 worker

Warning: Plugin 'jetpack' is already active.
Failed to load resource: the server responded with a status of 404 (Not Found)
Failed to load resource: the server responded with a status of 404 (Not Found)
Failed to load resource: the server responded with a status of 404 (Not Found)
Failed to load resource: the server responded with a status of 404 (Not Found)
The above error occurred in the <v> component:

Still looking into it...

@nateweller
Copy link
Contributor Author

@dkmyta Okay, all good for re-review here 👍

You should now see the Protect E2E tests running in GitHub along with the rest.

Re: Running locally, here are some random tips from getting it going recently myself:

// make sure the env is good
nvm use
rm -rf node_modules && pnpm i
jetpack install -r
cd projects/plugins/protect/tests/e2e

// if projects/plugins/protect/tests/e2e/config/local.cjs doesn't exist locally yet, make sure to decrypt the secret
CONFIG_KEY=YOUR_KEY pnpm config:decrypt

// continue making sure the env is good
pnpm env:reset        // or pnpm env:up
pnpm tunnel:reset     // or pnpm tunnel:up

// run the tests with live preview in browser
pnpm test:run --headed

@nateweller nateweller added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Mar 5, 2025
@nateweller nateweller force-pushed the add/protect/e2e-tests branch from ee7def0 to 0c9a5b4 Compare March 8, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions GitHub actions used to automate some of the work around releases and repository management Docs E2E Tests [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Status] Needs Review This PR is ready for review. [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants