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(); runCheckoutCreateAccountTest();
runCheckoutLoginAccountTest(); runCheckoutLoginAccountTest();
runCartCalculateShippingTest(); runCartCalculateShippingTest();
runCartRedirectionTest(); runCartRedirectionTest();
runOrderEmailReceivingTest(); runOrderEmailReceivingTest();
}; };

View File

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

View File

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

View File

@ -3,6 +3,8 @@
## Added ## Added
- `takeScreenshotFor` utility function to take screenshots within tests - `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 - `toBeInRange` expect numeric range matcher
# 0.2.1 # 0.2.1

View File

@ -5,6 +5,7 @@ const babelConfig = require( './babel.config' );
const esLintConfig = require( './.eslintrc.js' ); const esLintConfig = require( './.eslintrc.js' );
const allE2EConfig = require( './config' ); const allE2EConfig = require( './config' );
const allE2EUtils = require( './utils' ); const allE2EUtils = require( './utils' );
const slackUtils = require( './src/slack' );
/** /**
* External dependencies * External dependencies
*/ */
@ -16,4 +17,5 @@ module.exports = {
...allE2EConfig, ...allE2EConfig,
...allE2EUtils, ...allE2EUtils,
...allPuppeteerUtils, ...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 * @param testName
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
export async function sendFailedTestMessageToSlack( testName ) { async function sendFailedTestMessageToSlack( testName ) {
const { branch, commit, webUrl } = initializeSlack(); const { branch, commit, webUrl } = initializeSlack();
if ( ! branch ) { if ( ! branch ) {
return; return;
@ -127,7 +127,7 @@ export async function sendFailedTestMessageToSlack( testName ) {
* @param screenshotOfFailedTest * @param screenshotOfFailedTest
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
export async function sendFailedTestScreenshotToSlack( screenshotOfFailedTest ) { async function sendFailedTestScreenshotToSlack( screenshotOfFailedTest ) {
const pr = initializeSlack(); const pr = initializeSlack();
if ( ! pr ) { if ( ! pr ) {
return; return;
@ -154,3 +154,8 @@ export async function sendFailedTestScreenshotToSlack( screenshotOfFailedTest )
} }
} }
} }
module.exports = {
sendFailedTestMessageToSlack,
sendFailedTestScreenshotToSlack,
};