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
Conversation
Add test to edit a product review and another test to delete it
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: |
Test Results SummaryCommit SHA: 83067ef
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. |
There was a problem hiding this 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.
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
That's a very good point, @adimoldovan . Thank you for suggesting this. The solution of using fixtures seems indeed cleaner and reusable. |
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.
…ommerce/woocommerce into e2e-can-edit-product-review
There was a problem hiding this 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.
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js
Outdated
Show resolved
Hide resolved
…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.
There was a problem hiding this 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.
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:
pnpm test:e2e-pw ./tests/e2e-pw/tests/merchant/product-reviews.spec.js --headed
and make sure that all the tests are passing.Changelog entry
Significance
Type
Message
Add e2e tests to edit and delete product reviews.
Comment