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

Enable "Smoke test release" workflow #36598

Merged
merged 143 commits into from Feb 27, 2023
Merged

Enable "Smoke test release" workflow #36598

merged 143 commits into from Feb 27, 2023

Conversation

rodelgc
Copy link
Contributor

@rodelgc rodelgc commented Jan 25, 2023

All Submissions:

Changes proposed in this Pull Request:

Closes:

This PR contains the following changes:

  1. Smoke test release workflow now uses the Playwright tests, both API and E2E.
  2. Run the Smoke test release workflow:
    • automatically when a new release is published, including pre-releases.
    • manually, by running it from the Smoke test release page.
  3. The workflow runs the API & E2E tests in the following environments:
    WP & PHP version Site
    WP Latest, PHP 8.0 Release Smoke Test site in Bluehost
    WP Latest-1 wp-env localhost
    WP Latest-2 wp-env localhost
    PHP 7.4 wp-env localhost
    PHP 8.1 wp-env localhost
  4. Publish Allure report for each test on WooCommerce Test Reports > Smoke Tests on Releases page.
  5. Address several more flakiness discovered when running the E2E tests against the Release Smoke Test Site.
  6. The UPDATE_WC environment variable now accepts the WooCommerce version you want to run the tests against.

For now, this PR does not include the following because the Smoke test release file is getting huge already:

  • Running of tests with top plugins (WooCommerce Payments, WooCommerce Subscriptions, etc.).
  • Sending Slack notifications on failed tests.
  • You would still see duplicated steps throughout the Smoke test release file. They will be made into reusable workflows in the future.

The plugin tests and Slack notifications will be done on a separate PR, probably on a separate workflow file.

How to test the changes in this Pull Request:

Scenario 1: Test using a valid WooCommerce release version as input

  1. Go to Smoke test release.

  2. Trigger a new run using these steps:

    1. Click Run workflow.
    2. Select this branch (e2e/playwright-release).
    3. In the WooCommerce Release Tag field enter a valid WooCommerce release version like 7.4.0-beta.1 or 7.0.0. Do not use 7.2.0-rc.2 because it doesn't have a woocommerce.zip asset. Also, choose a version that's not yet listed in WooCommerce Test Reports > Smoke Tests on Releases.
    4. Start the run.
  3. Go to the workflow run you started.

  4. Wait for the Test WooCommerce update job to finish. It runs the update-woocommerce.spec.js E2E test against the Release Smoke test site to see update failures early on.

    YiiqZLDRnI
  5. Go to WooCommerce Test Reports > Smoke Tests on Releases. The WooCommerce version number you entered earlier should appear on the list. If not, wait for 1-2 more minutes to give GitHub Pages more time to upload the new report from Test WooCommerce update job.

  6. Click on the version number to expand it.

  7. In the WP Latest row:

    1. Verify the "E2E" column using these steps:
      1. You should see "E2E ✅" which means that update-woocommerce.spec.js passed on the Release smoke test site.
      2. Click on the "E2E" link. You should see the Allure report containing the passing update-woocommerce.spec.js test. It's the only test you'd see for now, since the other tests haven't ran yet.
      3. It's fine if you see can run the database update marked as "skipped" because the WC database version in our Release Smoke Test site is already the latest.
    2. Verify the "API" column using these steps:
      1. You should see the "API" text to be grayed out for now because the API tests haven't finished yet. Same with the other "E2E" and "API" tests of other environments in the list.

        ecNfYKJV4N
  8. We will now verify if the previous 2 versions of WordPress were correctly obtained. Go back to the Smoke test release run.

  9. Wait for the Get WP L-1 & L-2 version numbers job to finish, if it hasn't yet.

  10. Click Get WP L-1 & L-2 version numbers to see its steps.

  11. Click the step Get version numbers. It should print the correct L-1 and L-2 versions obtained from the WordPress.org API version check endpoint. Verify that they're correct.

    ZGEg5lVh2B
  12. Now, verify if the obtained PHP versions were correct. Click on any of the Test against PHP X.X jobs.

  13. Expand the Verify PHP version step. Verify that the PHP version found in WP Env environment is correct when compared to the Expected PHP version as shown below.

    lpgKMEUWfr
  14. To verify that the tests ran on the WP L-1 and L-2 versions, click on any of the Test against WP Latest-X jobs.

  15. Look for the step Verify environment details and click to expand it. This step basically runs shell commands that print certain environment details like the WordPress version installed.

  16. Verify that the printed WP version is correct.

    5mOoSRb91i
  17. Still under the Verify environment details step, verify that the installed WooCommerce version is the one that you selected earlier.

    xUYdFVugnZ
  18. Wait for all the jobs to finish.

  19. Go back to WooCommerce Test Reports > Smoke Tests on Releases and expand the WooCommerce version you chose.

  20. You should see the table filled up now with status icons, except for PHP 8.0 because it's already covered by WP Latest which ran against the Release Smoke Test site, which has PHP 8.0. Refer to the "Legend" section to see what each icon means.

    vuVfck0deP
  21. In the "WP Latest" row, click on the "E2E" link again. You should now see the Allure report of all tests, including the update-woocommerce.spec.js test you saw earlier.

  22. Click on the E2E and API links of other rows to see if you're taken to the correct Allure report.

  23. In the Allure report, verify the correctness of the following details:

    4RDMAGXQiI

Scenario 2: Test using an invalid WooCommerce release version as input

  1. Go to Smoke test release.
  2. Trigger a new run using these steps:
    1. Click Run workflow.
    2. Select this branch (e2e/playwright-release).
    3. In the WooCommerce Release Tag field enter an invalid value like 7.6.0 or 7.3.0-beta.3.
    4. Start the run.
  3. Open the workflow run you just started.
  4. After a few moments, verify that:
    1. The "Get WooCommerce release tag" job fails

    2. All the other jobs did not execute.

      YBF2KR5ViP
    3. Under the "Validate tag" step, the error release not found is printed.

      HwfNRwyThN

Scenario 3: Test using an valid WooCommerce release version, but does not have a woocommerce.zip release asset

  1. Go to Smoke test release.
  2. Trigger a new run using these steps:
    1. Click Run workflow.
    2. Select this branch (e2e/playwright-release).
    3. In the WooCommerce Release Tag field enter a valid release tag in the WooCommerce Core repo, but does not have a woocommerce.zip asset like 7.2.0-rc.2 or wc-beta-tester-2.2.0.
    4. Start the run.
  3. Open the workflow run.
  4. After a few moments, verify that:
    1. The "Get WooCommerce release tag" job fails.

    2. All the other jobs did not execute.

    3. The "Verify woocommerce.zip asset" step fails because there's no woocommerce.zip found. Note that the error message may differ.

      Error message on wc-beta-tester-2.2.0
      PNOUPOqrmT

      Error message on 7.2.0-rc.2
      jxT4Wrwyou

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you created a changelog file for each project being changed, ie pnpm --filter=<project> changelog add?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

Copy link
Contributor

@nigeljamesstevenson nigeljamesstevenson left a comment

Choose a reason for hiding this comment

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

Looks good to me Del! Thanks a lot for this 👏🏻

@nigeljamesstevenson
Copy link
Contributor

Hi @rodelgc - unfortunately this branch has a conflict. If you resolve it then I will be happy to merge - thanks again!

@rodelgc
Copy link
Contributor Author

rodelgc commented Feb 22, 2023

Hi @rodelgc - unfortunately this branch has a conflict. If you resolve it then I will be happy to merge - thanks again!

Resolved in latest commit.

Copy link
Contributor

@nigeljamesstevenson nigeljamesstevenson left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for the update 👏🏻

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #36598 (7227f86) into trunk (f9f6e68) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             trunk   #36598   +/-   ##
========================================
  Coverage     46.7%    46.7%           
  Complexity   17178    17178           
========================================
  Files          429      429           
  Lines        64779    64779           
========================================
  Hits         30240    30240           
  Misses       34539    34539           

Copy link
Contributor

@nigeljamesstevenson nigeljamesstevenson left a comment

Choose a reason for hiding this comment

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

Looks good Del - thanks!

@rodelgc rodelgc merged commit ea1925c into trunk Feb 27, 2023
@rodelgc rodelgc deleted the e2e/playwright-release branch February 27, 2023 04:11
@github-actions github-actions bot added this to the 7.6.0 milestone Feb 27, 2023
rodelgc added a commit that referenced this pull request Feb 27, 2023
* Add an encoding selector to the product importer

* Add changelog file

* Don't assume the character encoding parameter is present

* Add woocommerce_attributes_saved trigger. Closes #35004.

* Fix create wc extension script (#36917)

* Run create-extension for create-wc-extension script

* Add changelog

---------

Co-authored-by: Sam Seay <samueljseay@gmail.com>

* Update product editor package (#36830)

* Add missing dev packages to product-editor package

* Create components folder for organization

* Move product field, section and tab slots over to product-editor package

* Move use of product slot fills to product-editor package

* Sync dependencies

* Add changelogs

* Update README's and add constant for default values

* Update README's in product-editor package

* Change SORT_STRING to SORT_NATURAL for the encodings list

Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>

* Add changelog

* Add custom rendering logic to the item label (#36476)

* Add type definitions

* Add custom rendering logic to the item label

* Add stories

* Add changelog file

* Fix rebase merge issue

* Fix up stories after rebase

---------

Co-authored-by: Matt Sherman <matt@jam123.com>

* Enable "Smoke test release" workflow (#36598)

* First pass at updating release test workflow

* Add changelog

* Set dir env variables

* Update to workflow

* Fix indent

* Fix indent

* Clean up indent

* Re-order steps

* Change order of jobs

* Added common php versions

* Update pipeline

* Update some labels

* Simplify for testing

* Update paths

* Create tmp folder

* Fix path

* Paths

* Try outputting some debugging

* Add step ID back

* Remove working directory

* Another path tweak

* Add API release tests

* Add k6 tests

* Add PHP tests

* Launch wp-env during PHP tests

* Try default values

* Tweak some settings, add WP testing

* Tweak some settings

* Re-order e2e steps

* Update step descriptions

* Reorganize tests, add plugin tests

* Enable only e2e job

* Initial set up to run against release smoke test site

* Fix syntax

* Temporarily disable update wc spec

* Temporarily disable downloading woocommerce zip

* Download release zip using tag name

* Fix wrong job name

* Fix wrong job name

* Fix dir

* Delete fetch-asset-id.js

* REfactor update-woocommerce spec

* Add error handling

* Download release zip by tag

* Refactor update woo spec to download zip by tag

* Correct job name

* fail test on invalid tag

* Enable all e2e tests

* Run api tests before e2e tests

* Fix job dependency

* Add customer credentials to api job

* Separate job for WC Update

* Combine e2e allure-results, then report

* Enable report job

* Fix context

* Change job and artifact names

* Use test s3 path

* Minor job name change

* Upload artifacts to bucket

* Correct s3 path

* Add quiet option

* Retain video on failures

* Finalize s3 path

* Try WP latest-1

* Revert to wp latest

* Refine search for woocommerce zip asset

* Get created-at

* Specify repo in gh command

* Slugify env description

* Trim space

* Sync with bucket instead of copy

* Remove invalid --recursive flag

* Re-add missing step to combine e2e results from update wc test

* Ensure artifact upload on test failure

* Enable all e2e tests on WP latest

* Retain existing data before updating WC

* Make test compatible with 'Canceled' and 'Cancelled'

* Set env_desc as env var

* Re-add deleted file

* Fix UPDATE_WC in daily smoke test workflow

* Add tracing in global setup

* Remove tracing

* Temporarily run only basic spec

* Job for WP Latest-1 & 2

* Fix "Required input 'created_at' not provided"

* Minor rename

* Remove install filter

* Install deps in get-wp-matrix

* Delete get-wp-versions.js

* Add get-wp-versions.js to e2e-pw folder

* REname file

* REfactor

* Refactor script for getting WP prev versions

* Update job dependencies

* Temporarily remove disabled jobs

* Allow e2e-wp-latest after api test failure

* Update L-1 & L-2 job deps

* Fix report-wp-latest

* Fix failing api test

* Make get-wp-versions quicker

* Publish report immediately after test

* Test reporting in e2e-update-wc

* Fix missing parameter

* Fix env_desc, re-enable other jobs

* Enable all e2e tests

* Minor job name change

* Fix flaky test

* Add php version testing

* stringify php versions

* Re-enable all e2e tests

* Up timeout to 2min

* Remove PHP 8.0

* Add missing conditionals

* Fix php version verification script

* Fix starting dir

* Fix flakiness

* Skip e2e if api failed

* Verify woocommerce.zip early

* Add token

* Delete test summary on github for the meantime

* Use default playwright config

* More meaningful variable names

* Update step titles based on review

* Use expect.poll()

* Minor spacing corrections

* Use `stable-check` endpoint, delete unnecessary loop

* Update locators to be JN-compatible

* Fix erroneous getting of release tag

* Fix conflict of "No thanks" button locator with that of WP Mail Logging's

* Update github-script action to v6

* Revert to 'Cancelled'

* Remove unnecessary step

* Provide missing env variables

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>

* Rename workflow file

---------

Co-authored-by: Nestor Soriano <konamiman@konamiman.com>
Co-authored-by: helgatheviking <507025+helgatheviking@users.noreply.github.com>
Co-authored-by: louwie17 <lourensschep@gmail.com>
Co-authored-by: Sam Seay <samueljseay@gmail.com>
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
Co-authored-by: Maikel David Pérez Gómez <mdperez86@gmail.com>
Co-authored-by: Matt Sherman <matt@jam123.com>
Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>
samueljseay pushed a commit that referenced this pull request Feb 28, 2023
* First pass at updating release test workflow

* Add changelog

* Set dir env variables

* Update to workflow

* Fix indent

* Fix indent

* Clean up indent

* Re-order steps

* Change order of jobs

* Added common php versions

* Update pipeline

* Update some labels

* Simplify for testing

* Update paths

* Create tmp folder

* Fix path

* Paths

* Try outputting some debugging

* Add step ID back

* Remove working directory

* Another path tweak

* Add API release tests

* Add k6 tests

* Add PHP tests

* Launch wp-env during PHP tests

* Try default values

* Tweak some settings, add WP testing

* Tweak some settings

* Re-order e2e steps

* Update step descriptions

* Reorganize tests, add plugin tests

* Enable only e2e job

* Initial set up to run against release smoke test site

* Fix syntax

* Temporarily disable update wc spec

* Temporarily disable downloading woocommerce zip

* Download release zip using tag name

* Fix wrong job name

* Fix wrong job name

* Fix dir

* Delete fetch-asset-id.js

* REfactor update-woocommerce spec

* Add error handling

* Download release zip by tag

* Refactor update woo spec to download zip by tag

* Correct job name

* fail test on invalid tag

* Enable all e2e tests

* Run api tests before e2e tests

* Fix job dependency

* Add customer credentials to api job

* Separate job for WC Update

* Combine e2e allure-results, then report

* Enable report job

* Fix context

* Change job and artifact names

* Use test s3 path

* Minor job name change

* Upload artifacts to bucket

* Correct s3 path

* Add quiet option

* Retain video on failures

* Finalize s3 path

* Try WP latest-1

* Revert to wp latest

* Refine search for woocommerce zip asset

* Get created-at

* Specify repo in gh command

* Slugify env description

* Trim space

* Sync with bucket instead of copy

* Remove invalid --recursive flag

* Re-add missing step to combine e2e results from update wc test

* Ensure artifact upload on test failure

* Enable all e2e tests on WP latest

* Retain existing data before updating WC

* Make test compatible with 'Canceled' and 'Cancelled'

* Set env_desc as env var

* Re-add deleted file

* Fix UPDATE_WC in daily smoke test workflow

* Add tracing in global setup

* Remove tracing

* Temporarily run only basic spec

* Job for WP Latest-1 & 2

* Fix "Required input 'created_at' not provided"

* Minor rename

* Remove install filter

* Install deps in get-wp-matrix

* Delete get-wp-versions.js

* Add get-wp-versions.js to e2e-pw folder

* REname file

* REfactor

* Refactor script for getting WP prev versions

* Update job dependencies

* Temporarily remove disabled jobs

* Allow e2e-wp-latest after api test failure

* Update L-1 & L-2 job deps

* Fix report-wp-latest

* Fix failing api test

* Make get-wp-versions quicker

* Publish report immediately after test

* Test reporting in e2e-update-wc

* Fix missing parameter

* Fix env_desc, re-enable other jobs

* Enable all e2e tests

* Minor job name change

* Fix flaky test

* Add php version testing

* stringify php versions

* Re-enable all e2e tests

* Up timeout to 2min

* Remove PHP 8.0

* Add missing conditionals

* Fix php version verification script

* Fix starting dir

* Fix flakiness

* Skip e2e if api failed

* Verify woocommerce.zip early

* Add token

* Delete test summary on github for the meantime

* Use default playwright config

* More meaningful variable names

* Update step titles based on review

* Use expect.poll()

* Minor spacing corrections

* Use `stable-check` endpoint, delete unnecessary loop

* Update locators to be JN-compatible

* Fix erroneous getting of release tag

* Fix conflict of "No thanks" button locator with that of WP Mail Logging's

* Update github-script action to v6

* Revert to 'Cancelled'

* Remove unnecessary step

* Provide missing env variables

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: smoke tests These Issues/PRs relate to smoke testing. plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants