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] Can Edit and Delete Product Review #44411

Merged
merged 16 commits into from Feb 9, 2024

Conversation

alvarothomas
Copy link
Contributor

@alvarothomas alvarothomas commented Feb 6, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes https://github.com/woocommerce/woocommerce-quality/issues/610

Closes https://github.com/woocommerce/woocommerce-quality/issues/611

The tests focus on editing and deleting product reviews, verifying the visibility of review elements in the admin interface as a merchant.

How to test the changes in this Pull Request:

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

  1. Code review.
  2. Verify if there are any additional steps or assertions that need to be included
  3. Run pnpm test:e2e-pw ./tests/e2e-pw/tests/merchant/product-reviews.spec.js --headed and make sure that all the tests are passing.
  4. CI jobs should be green.

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 - Improvement to existing functionality

Message

Add e2e tests to edit and delete product reviews.

Comment

Add test to edit a product review and another test to delete it
@alvarothomas alvarothomas added plugin: woocommerce Issues related to the WooCommerce Core plugin. focus: e2e tests Issues related to e2e tests labels Feb 6, 2024
@alvarothomas alvarothomas requested a review from a team February 6, 2024 17:56
@alvarothomas alvarothomas self-assigned this Feb 6, 2024
Copy link
Contributor

github-actions bot commented Feb 6, 2024

Hi @adimoldovan, @woocommerce/solaris

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

Copy link
Contributor

github-actions bot commented Feb 6, 2024

Test Results Summary

Commit SHA: 83067ef

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests288002903175m 40s

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.

@adimoldovan adimoldovan self-requested a review February 7, 2024 15:13
Copy link
Contributor

@adimoldovan adimoldovan left a comment

Choose a reason for hiding this comment

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

Hi @alvarothomas, thanks for working on this.

The problem I see with this spec is that all 3 tests are using the same product, and if they are to run in parallel they will impact each other. The delete test will probably delete the review and the other 2 tests will fail.
Each test should be independent, and have its own test data. I would suggest to either use a beforeEach, that will create a product before each test instead of a single product beforeAll, or use a fixture, that will isolate the data for each test. Here's an example of a product fixture.

@alvarothomas
Copy link
Contributor Author

Hi @alvarothomas, thanks for working on this.

The problem I see with this spec is that all 3 tests are using the same product, and if they are to run in parallel they will impact each other. The delete test will probably delete the review and the other 2 tests will fail. Each test should be independent, and have its own test data. I would suggest to either use a beforeEach, that will create a product before each test instead of a single product beforeAll, or use a fixture, that will isolate the data for each test. Here's an example of a product fixture.

That's a very good point, @adimoldovan . Thank you for suggesting this. The solution of using fixtures seems indeed cleaner and reusable.

alvarothomas and others added 5 commits February 8, 2024 13:50
Change test data use from constants at the top to test data created in a fixture for each test. Also, added extra line to the changelog file.
Fixed mixed lines on previous commit.
Copy link
Contributor

@adimoldovan adimoldovan left a comment

Choose a reason for hiding this comment

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

The fixture setup looks great @alvarothomas.
I checked the tests again and found some locators that should be updated to be unique to the review, otherwise the tests will fail if there are other reviews in the table besides the one in your test (which is very possible). See my suggested edits.
Also, the delete test needs another assertion, for the same reason. See my comments below.

I'm not sure about the scope of the task (if quick edit was the scope), but I'm wondering if editing the review via the review edit page should also be covered.
The same though with bulk delete.

alvarothomas and others added 8 commits February 8, 2024 16:30
…s.spec.js


Remove edited timestamp

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
…s.spec.js


Update hover action to review id.

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
…s.spec.js


Change Quick Edit button to reach review identifier

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
…s.spec.js


Replace updated review check to single line assert

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
…s.spec.js


Hover to edit on review identifier

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
…s.spec.js


Point to trash a review to its identifier.

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
…s.spec.js


Point to trash a review to its identifier.

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Added Review Edit test apart from Quick Edit test. Included assertions to verify that the review has been edited and can be seen both in the reviews list and the shop's page.
@adimoldovan adimoldovan self-requested a review February 9, 2024 14:44
Copy link
Contributor

@adimoldovan adimoldovan left a comment

Choose a reason for hiding this comment

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

This looks good! Thank you @alvarothomas.

@alvarothomas alvarothomas merged commit accbf30 into trunk Feb 9, 2024
33 checks passed
@alvarothomas alvarothomas deleted the e2e-can-edit-product-review branch February 9, 2024 15:12
@github-actions github-actions bot added this to the 8.7.0 milestone Feb 9, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 9, 2024
@nigeljamesstevenson nigeljamesstevenson added status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Feb 9, 2024
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. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants