update core-tests, utils package readmes (#28715)

This commit is contained in:
Ron Rennick 2021-01-19 09:00:59 -04:00 committed by GitHub
parent 0d7e5d1596
commit 8721b5d9d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 34 deletions

View File

@ -37,32 +37,32 @@ The functions to access the core tests are:
### Activation and setup
- `runSetupOnboardingTests` - Run all setup and onboarding tests
- `runActivationTest` - Merchant can activate WooCommerce
- `runOnboardingFlowTest` - Merchant can complete onboarding flow
- `runTaskListTest` - Merchant can complete onboarding task list
- `runInitialStoreSettingsTest` - Merchant can complete initial settings
- `runActivationTest` - Merchant can activate WooCommerce
- `runOnboardingFlowTest` - Merchant can complete onboarding flow
- `runTaskListTest` - Merchant can complete onboarding task list
- `runInitialStoreSettingsTest` - Merchant can complete initial settings
### Merchant
- `runMerchantTests` - Run all merchant tests
- `runCreateCouponTest` - Merchant can create coupon
- `runCreateOrderTest` - Merchant can create order
- `runAddSimpleProductTest` - Merchant can create a simple product
- `runAddVariableProductTest` - Merchant can create a variable product
- `runUpdateGeneralSettingsTest` - Merchant can update general settings
- `runProductSettingsTest` - Merchant can update product settings
- `runTaxSettingsTest` - Merchant can update tax settings
- `runOrderStatusFilterTest` - Merchant can filter orders by order status
- `runOrderRefundTest` - Merchant can refund an order
- `runOrderApplyCouponTest` - Merchant can apply a coupon to an order
- `runCreateCouponTest` - Merchant can create coupon
- `runCreateOrderTest` - Merchant can create order
- `runAddSimpleProductTest` - Merchant can create a simple product
- `runAddVariableProductTest` - Merchant can create a variable product
- `runUpdateGeneralSettingsTest` - Merchant can update general settings
- `runProductSettingsTest` - Merchant can update product settings
- `runTaxSettingsTest` - Merchant can update tax settings
- `runOrderStatusFilterTest` - Merchant can filter orders by order status
- `runOrderRefundTest` - Merchant can refund an order
- `runOrderApplyCouponTest` - Merchant can apply a coupon to an order
### Shopper
- `runShopperTests` - Run all shopper tests
- `runCartPageTest` - Shopper can view and update cart
- `runCheckoutPageTest` - Shopper can complete checkout
- `runMyAccountPageTest` - Shopper can access my account page
- `runSingleProductPageTest` - Shopper can view single product page
- `runCartPageTest` - Shopper can view and update cart
- `runCheckoutPageTest` - Shopper can complete checkout
- `runMyAccountPageTest` - Shopper can access my account page
- `runSingleProductPageTest` - Shopper can view single product page
## Contributing a new test

View File

@ -14,21 +14,20 @@ npm install @woocommerce/e2e-utils --save
Example:
~~~js
import {
CustomerFlow,
StoreOwnerFlow,
createSimpleProduct,
uiUnblocked
shopper,
merchant,
createSimpleProduct
} from '@woocommerce/e2e-utils';
describe( 'Cart page', () => {
beforeAll( async () => {
await StoreOwnerFlow.login();
await merchant.login();
await createSimpleProduct();
await StoreOwnerFlow.logout();
await merchant.logout();
} );
it( 'should display no item in the cart', async () => {
await CustomerFlow.goToCart();
await shopper.goToCart();
await expect( page ).toMatchElement( '.cart-empty', { text: 'Your cart is currently empty.' } );
} );
} );
@ -36,10 +35,11 @@ describe( 'Cart page', () => {
## Test Function
### Merchant `StoreOwnerFlow`
### Merchant `merchant`
| Function | Parameters | Description |
|----------|-------------|------------|
| `goToOrder` | `orderId` | Go to view a single order |
| `login` | | Log in as merchant |
| `logout` | | Log out of merchant account |
| `openAllOrdersView` | | Go to the orders listing |
@ -51,11 +51,9 @@ describe( 'Cart page', () => {
| `openPlugins` | | Go to the Plugins screen |
| `openSettings` | | Go to WooCommerce -> Settings |
| `runSetupWizard` | | Open the onboarding profiler |
| `goToOrder` | `orderId` | Go to view a single order |
| `updateOrderStatus` | `orderId, status` | Update the status of an order |
|----------|-------------|-------------|
### Shopper `CustomerFlow`
### Shopper `shopper`
| Function | Parameters | Description |
|----------|------------|-------------|
@ -67,23 +65,28 @@ describe( 'Cart page', () => {
| `goToAccountDetails` | | Go to My Account -> Details |
| `goToCart` | | Go to the cart page |
| `goToCheckout` | | Go to the checkout page |
| `goToShop` | | Go to the shop page |
| `goToProduct` | `productId` | Go to a single product in the shop |
| `goToOrders` | | Go to My Account -> Orders |
| `goToDownloads` | | Go to My Account -> Downloads |
| `goToMyAccount` | | Go to the My Account page |
| `goToOrders` | | Go to My Account -> Orders |
| `goToProduct` | `productId` | Go to a single product in the shop |
| `goToShop` | | Go to the shop page |
| `login` | | Log in as the shopper |
| `placeOrder` | | Place an order from the checkout page |
| `productIsInCheckout` | `productTitle, quantity, total, cartSubtotal` | Verify product is in cart on checkout page |
| `removeFromCart` | `productTitle` | Remove a product from the cart on the cart page |
| `setCartQuantity` | `productTitle, quantityValue` | Change the quantity of a product on the cart page |
|----------|------------|-------------|
### Page Utilities
| Function | Parameters | Description |
|----------|------------|-------------|
| `addProductToOrder` | `orderId, productName` | adds a product to an order using the product search |
| `clearAndFillInput` | `selector, value` | Replace the contents of an input with the passed value |
| `clickFilter` | `selector` | helper method that clicks on a list page filter |
| `clickTab` | `tabName` | Click on a WooCommerce -> Settings tab |
| `createCoupon` | `couponAmount` | creates a basic coupon. Default amount is 5. Returns the generated coupon code. |
| `createSimpleOrder` | `status` | creates a basic order with the provided status string |
| `moveAllItemsToTrash` | | helper method that checks every item in a list page and moves them to the trash |
| `settingsPageSaveChanges` | | Save the current WooCommerce settings page |
| `permalinkSettingsPageSaveChanges` | | Save the current Permalink settings |
| `setCheckbox` | `selector` | Check a checkbox |
@ -95,7 +98,6 @@ describe( 'Cart page', () => {
| `verifyValueOfInputField` | `selector, value` | Verify an input contains the passed value |
| `clickFilter` | `selector` | Click on a list page filter |
| `moveAllItemsToTrash` | | Moves all items in a list view to the Trash |
|----------|------------|-------------|
### Test Utilities