export send to slack utils, add unblock check to variable product test

This commit is contained in:
Ron Rennick 2021-04-20 13:32:14 -03:00
parent 40e887103b
commit 5feb03e9a7
7 changed files with 29 additions and 8 deletions

View File

@ -73,7 +73,7 @@ const runShopperTests = () => {
runCheckoutCreateAccountTest();
runCheckoutLoginAccountTest();
runCartCalculateShippingTest();
runCartRedirectionTest();
runCartRedirectionTest();
runOrderEmailReceivingTest();
};

View File

@ -11,9 +11,8 @@ const {
uiUnblocked,
addProductToOrder,
evalAndClick,
takeScreenshotFor,
sendFailedTestScreenshotToSlack,
} = require( '@woocommerce/e2e-utils' );
const { takeScreenshotFor, sendFailedTestScreenshotToSlack } = require( '@woocommerce/e2e-environment' );
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
@ -47,7 +46,6 @@ const runOrderApplyCouponTest = () => {
const couponDialog = await expect(page).toDisplayDialog(async () => {
await expect(page).toClick('button.add-coupon');
});
expect(couponDialog.message()).toMatch(couponDialogMessage);
// Accept the dialog with the coupon code

View File

@ -84,12 +84,19 @@ const runAddSimpleProductTest = () => {
const runAddVariableProductTest = () => {
describe('Add New Variable Product Page', () => {
it('can create product with variations', async () => {
beforeAll(async () => {
await merchant.login();
});
it('can create variable product', async () => {
await openNewProductAndVerify();
// Set product data
await expect(page).toFill('#title', 'Variable Product with Three Variations');
await expect(page).toSelect('#product-type', 'Variable product');
});
it('can create set variable product attributes', async () => {
// Create attributes for variations
await waitAndClick( page, '.attribute_tab a' );
@ -111,7 +118,9 @@ const runAddVariableProductTest = () => {
// Wait for attribute form to save (triggers 2 UI blocks)
await uiUnblocked();
await uiUnblocked();
});
it('can create variable product variations', async () => {
// Create variations from attributes
await waitForSelector( page, '.variations_tab' );
await waitAndClick( page, '.variations_tab a' );
@ -129,8 +138,11 @@ const runAddVariableProductTest = () => {
// Set some variation data
await uiUnblocked();
await uiUnblocked();
});
it('can create variation attributes', async () => {
await waitAndClick( page, '.variations_tab a' );
await uiUnblocked();
await waitForSelector(
page,
'select[name="attribute_attr-1[0]"]',

View File

@ -3,6 +3,8 @@
## Added
- `takeScreenshotFor` utility function to take screenshots within tests
- `sendFailedTestScreenshotToSlack` to send the screenshot to the configured Slack channel
- `sendFailedTestMessageToSlack` to send the context for screenshot to the configured Slack channel
- `toBeInRange` expect numeric range matcher
# 0.2.1

View File

@ -5,6 +5,7 @@ const babelConfig = require( './babel.config' );
const esLintConfig = require( './.eslintrc.js' );
const allE2EConfig = require( './config' );
const allE2EUtils = require( './utils' );
const slackUtils = require( './src/slack' );
/**
* External dependencies
*/
@ -16,4 +17,5 @@ module.exports = {
...allE2EConfig,
...allE2EUtils,
...allPuppeteerUtils,
...slackUtils,
};

View File

@ -1 +1,3 @@
export * from './reporter';
const slackUtils = require( './reporter' );
module.exports = slackUtils;

View File

@ -69,7 +69,7 @@ const initializeSlack = () => {
* @param testName
* @returns {Promise<void>}
*/
export async function sendFailedTestMessageToSlack( testName ) {
async function sendFailedTestMessageToSlack( testName ) {
const { branch, commit, webUrl } = initializeSlack();
if ( ! branch ) {
return;
@ -127,7 +127,7 @@ export async function sendFailedTestMessageToSlack( testName ) {
* @param screenshotOfFailedTest
* @returns {Promise<void>}
*/
export async function sendFailedTestScreenshotToSlack( screenshotOfFailedTest ) {
async function sendFailedTestScreenshotToSlack( screenshotOfFailedTest ) {
const pr = initializeSlack();
if ( ! pr ) {
return;
@ -154,3 +154,8 @@ export async function sendFailedTestScreenshotToSlack( screenshotOfFailedTest )
}
}
}
module.exports = {
sendFailedTestMessageToSlack,
sendFailedTestScreenshotToSlack,
};