2c3bec8429 | ||
---|---|---|
.. | ||
specs | ||
CHANGELOG.md | ||
README.md | ||
index.js | ||
package.json |
README.md
WooCommerce Core End to End Test Suite
This package contains the automated end-to-end tests for WooCommerce.
Table of contents
Pre-requisites
Setting up the test environment
Follow E2E setup instructions.
Setting up core tests
- Create the folder
tests/e2e/specs
in your repository if it does not exist. - To add a core test to your test suite, create a new
.test.js
file withintests/e2e/specs
. Example code to run all the shopper tests:
const { runShopperTests } = require( '@woocommerce/e2e-core-tests' );
runShopperTests();
Test functions
The functions to access the core tests are:
Activation and setup
runSetupOnboardingTests
- Run all setup and onboarding testsrunActivationTest
- Merchant can activate WooCommercerunOnboardingFlowTest
- Merchant can complete onboarding flowrunTaskListTest
- Merchant can complete onboarding task listrunInitialStoreSettingsTest
- Merchant can complete initial settings
Merchant
runMerchantTests
- Run all merchant testsrunCreateCouponTest
- Merchant can create couponrunCreateOrderTest
- Merchant can create orderrunAddSimpleProductTest
- Merchant can create a simple productrunAddVariableProductTest
- Merchant can create a variable productrunUpdateGeneralSettingsTest
- Merchant can update general settingsrunProductSettingsTest
- Merchant can update product settingsrunTaxSettingsTest
- Merchant can update tax settingsrunOrderStatusFilterTest
- Merchant can filter orders by order statusrunOrderRefundTest
- Merchant can refund an orderrunOrderApplyCouponTest
- Merchant can apply a coupon to an orderrunProductEditDetailsTest
- Merchant can edit an existing productrunProductSearchTest
- Merchant can search for a product and view itrunMerchantOrdersCustomerPaymentPage
- Merchant can visit the customer payment pagerunOrderSearchingTest
- Merchant can search for order via different termsrunAddNewShippingZoneTest
- Merchant can create shipping zones and let shopper test themrunMerchantOrderEmailsTest
- Merchant can receive order emails and resend emails by Order Actions
Shopper
runShopperTests
- Run all shopper testsrunCartApplyCouponsTest
- Shopper can use coupons on cartrunCartPageTest
- Shopper can view and update cartrunCheckoutApplyCouponsTest
- Shopper can use coupons on checkoutrunCheckoutPageTest
- Shopper can complete checkoutrunMyAccountPageTest
- Shopper can access my account pagerunSingleProductPageTest
- Shopper can view single product page in many variations (simple, variable, grouped)runMyAccountPayOrderTest
- Shopper can pay for his order in My AccountrunCartApplyCouponsTest
- Shopper can apply coupons in the cartrunCheckoutApplyCouponsTest
- Shopper can apply coupons in the checkoutrunProductBrowseSearchSortTest
- Shopper can browse, search & sort productsrunVariableProductUpdateTest
- Shopper can view and update variations on a variable product
Contributing a new test
- In your branch create a new
example-test-name.test.js
under thetests/e2e/core-tests/specs
folder. - Jest does not allow its global functions to be accessed outside the jest environment. To allow the test code to be published in a package import any jest global functions used in your test
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
- Wrap your test in a function and export it
const runExampleTestName = () => {
describe('Example test', () => {
beforeAll(async () => {
// ...
});
it('do some example action', async () => {
// ...
});
// ...
});
});
module.exports = runExampleTestName;
- Add your test to
tests/e2e/core-tests/specs/index.js
const runExampleTestName = require( './grouping/example-test-name.test' );
// ...
module.exports = {
// ...
runExampleTestName,
}