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

E2E: Fix skipping of core profiler in page-loads.spec.js #39084

Merged
merged 2 commits into from Jul 5, 2023

Conversation

rodelgc
Copy link
Contributor

@rodelgc rodelgc commented Jul 4, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #39056.

Currently, the E2E tests in page-loads.spec.js fail when it's run while the default admin user has not skipped OBW yet. This is because the if condition here, which was meant to skip the guided setup, doesn't execute -- currentPage.name will never be equal to Home.

This PR fixes this by:

  • moving these lines onto a beforeAll hook so that the skipping will happen only once, rather than leaving it in the beforeEach block where it runs before each test unnecessarily.
  • simplifying the if condition to rely only on whether coreProfilerEnabled is true or not.

This PR also removes these lines, as I think we no longer have a use case where the old onboarding wizard will be shown to the user.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

Testing locally

  1. Run the usual setup scripts for launching wp-env. But don't run any tests yet.
  2. As expected, when you navigate to WooCommerce > Home, you'll be taken to the core profiler Welcome page. Do not click "Skip guided setup". But if you happen to have skipped it by accident, you can send a POST request to http://localhost:8086/wp-json/wc-admin/onboarding/profile with the following payload in order to reset the skipped state:
     {
     "skipped": false
     }
  3. Run only the page-loads.spec.js file. All tests in it should pass.
    pnpm --filter=woocommerce test:e2e-pw page-loads.spec.js

Testing on the permanent sites for daily and release tests

Assuming you don't have a running wp-env local environment, and you're on the woocommerce monorepo root dir:

  1. Run only pnpm install to install dependencies. No need to run the build and env:test PNPM commands.
  2. Make sure that the daily and release test sites do not skip the core profiler. As mentioned earlier, do this by sending a POST request to /wp-json/wc-admin/onboarding/profile with this payload:
    {
    "skipped": false
    }
  3. Run the page-loads.spec.js E2E spec against the daily and release smoke test sites using the following environment variables. Get their values from the secret store if you haven't saved them yet.
    export BASE_URL='...'
    export ADMIN_USER='...'
    export ADMIN_USER_EMAIL='...'
    export ADMIN_PASSWORD='...'
    export CUSTOMER_USER='...'
    export CUSTOMER_PASSWORD='...'
    export CUSTOMER_USER_EMAIL='...'
    export RESET_SITE=true
    pnpm --filter=woocommerce test:e2e-pw page-loads.spec.js
  4. All tests should pass.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement

Message

Comment

@github-actions github-actions bot added focus: e2e tests Issues related to e2e tests plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Jul 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2023

Test Results Summary

Commit SHA: 85dba1a

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 53s
E2E Tests1900018020817m 54s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@rodelgc rodelgc changed the title E2E: Skip core profiler in global setup E2E: Fix skipping of core profiler in page-loads.spec.js Jul 5, 2023
@rodelgc rodelgc marked this pull request as ready for review July 5, 2023 03:59
@rodelgc rodelgc requested review from a team July 5, 2023 03:59
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

Hi , @woocommerce/solaris, @woocommerce/mothra

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@rodelgc rodelgc removed the request for review from a team July 5, 2023 04:07
@rodelgc rodelgc mentioned this pull request Jul 5, 2023
11 tasks
Copy link
Contributor

@lanej0 lanej0 left a comment

Choose a reason for hiding this comment

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

Tests and re-tests as expected. LGTM!

@lanej0 lanej0 merged commit ed1ace1 into trunk Jul 5, 2023
21 checks passed
@lanej0 lanej0 deleted the e2e/skip-core-profiler branch July 5, 2023 23:15
@github-actions github-actions bot added this to the 8.0.0 milestone Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: e2e tests Issues related to e2e tests plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E: Make page-loads.spec.js pass when run on its own
2 participants