Merge branch 'trunk' into packages/api/json-transform-tests

This commit is contained in:
Lucas Bustamante 2022-01-19 13:28:32 -03:00
commit 58e2c6ecaa
27 changed files with 100 additions and 112 deletions

View File

@ -9,6 +9,36 @@
"action": "add",
"cwd": "packages/js/e2e-core-tests"
}
},
"build": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "build"
}
},
"clean": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "clean"
}
},
"compile": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "compile"
}
},
"prepare": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "prepare"
}
},
"lint": {
"executor": "@nrwl/workspace:run-script",
"options": {
"script": "lint"
}
}
}
}

View File

@ -7,7 +7,6 @@ const {
verifyCheckboxIsSet,
verifyValueOfInputField,
uiUnblocked,
evalAndClick,
createOrder,
clickAndWaitForSelector,
} = require( '@woocommerce/e2e-utils' );

View File

@ -1,8 +1,6 @@
/**
* Internal dependencies
*/
const config = require( 'config' );
const {
merchant,
withRestApi,

View File

@ -7,9 +7,14 @@ const {
merchant,
uiUnblocked,
verifyAndPublish,
createSimpleProduct
createSimpleProduct,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe, beforeAll } = require( '@jest/globals' );
let productId;
const runProductEditDetailsTest = () => {

View File

@ -11,7 +11,7 @@ const {
setBrowserViewport,
verifyAndPublish,
waitForSelector,
waitForSelectorWithoutThrow
waitForSelectorWithoutThrow,
} = require( '@woocommerce/e2e-utils' );
const {
waitAndClick,

View File

@ -5,7 +5,7 @@
const {
merchant,
settingsPageSaveChanges,
verifyValueOfInputField
verifyValueOfInputField,
} = require( '@woocommerce/e2e-utils' );
/**

View File

@ -8,7 +8,7 @@ const {
settingsPageSaveChanges,
unsetCheckbox,
verifyCheckboxIsSet,
verifyCheckboxIsUnset
verifyCheckboxIsUnset,
} = require( '@woocommerce/e2e-utils' );
const runProductSettingsTest = () => {

View File

@ -2,6 +2,10 @@
* Internal dependencies
*/
const { merchant, withRestApi } = require('@woocommerce/e2e-utils');
/**
* External dependencies
*/
const { lorem, helpers } = require('faker');
const runAddShippingClassesTest = () => {

View File

@ -12,11 +12,7 @@ const {
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, describe, beforeAll } = require( '@jest/globals' );
const config = require( 'config' );
const firstProductPrice = config.has( 'products.simple.price' ) ? config.get( 'products.simple.price' ) : '9.99';

View File

@ -3,7 +3,6 @@
*/
const {
shopper,
createCoupon,
createSimpleProduct,
uiUnblocked,
applyCoupon,
@ -14,11 +13,7 @@ const { getCouponId, getCouponsTable } = require( '../utils/coupons' );
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, describe, beforeAll } = require( '@jest/globals' );
const runCartApplyCouponsTest = () => {
describe('Cart applying coupons', () => {

View File

@ -5,17 +5,13 @@ const {
shopper,
withRestApi,
createSimpleProduct,
uiUnblocked
uiUnblocked,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, describe, beforeAll } = require( '@jest/globals' );
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );

View File

@ -3,7 +3,6 @@
*/
const {
shopper,
createCoupon,
createSimpleProduct,
uiUnblocked,
applyCoupon,
@ -15,11 +14,7 @@ const { getCouponId, getCouponsTable } = require( '../utils/coupons' );
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, describe, beforeAll } = require( '@jest/globals' );
const runCheckoutApplyCouponsTest = () => {

View File

@ -15,11 +15,7 @@
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, describe, beforeAll } = require( '@jest/globals' );
const config = require( 'config' );
const customerBilling = config.get( 'addresses.customer.billing' );

View File

@ -13,11 +13,7 @@
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, describe, beforeAll } = require( '@jest/globals' );
const config = require('config');

View File

@ -9,6 +9,11 @@ const {
uiUnblocked,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe, beforeAll, afterAll } = require( '@jest/globals' );
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
const singleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';

View File

@ -9,6 +9,11 @@ const {
withRestApi,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe, beforeAll, afterAll } = require( '@jest/globals' );
const customerEmailAddress = 'john.doe.test@example.com';
const runMyAccountCreateAccountTest = () => {

View File

@ -9,6 +9,11 @@ const {
uiUnblocked
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe, beforeAll, afterAll } = require( '@jest/globals' );
let simplePostIdValue;
let orderNum;
const config = require( 'config' );

View File

@ -6,6 +6,11 @@ const {
shopper,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe } = require( '@jest/globals' );
const pages = [
['Orders', 'my-account/orders', shopper.goToOrders],
['Downloads', 'my-account/downloads', shopper.goToDownloads],

View File

@ -10,6 +10,11 @@
deleteAllEmailLogs,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe, beforeAll, afterAll } = require( '@jest/globals' );
let simplePostIdValue;
let orderId;
const config = require( 'config' );
@ -17,15 +22,6 @@ const simpleProductName = config.get( 'products.simple.name' );
const customerEmail = config.get( 'addresses.customer.billing.email' );
const storeName = 'WooCommerce Core E2E Test Suite';
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const runOrderEmailReceivingTest = () => {
describe('Shopper Order Email Receiving', () => {
beforeAll(async () => {

View File

@ -11,11 +11,7 @@ const {
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const { it, beforeAll } = require( '@jest/globals' );
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );

View File

@ -6,9 +6,13 @@ const {
createSimpleProduct,
createVariableProduct,
createGroupedProduct,
uiUnblocked
uiUnblocked,
} = require( '@woocommerce/e2e-utils' );
/**
* External dependencies
*/
const { it, describe, beforeAll } = require( '@jest/globals' );
const config = require( 'config' );
// Variables for simple product

View File

@ -2,10 +2,8 @@ import { GroupedProduct } from '@woocommerce/api';
import { Factory } from 'fishery';
/**
* Creates a new factory for creating variable products.
* This does not include creating product variations.
* Instead, use `variationFactory()` for that.
*
* Creates a new factory for creating grouped products.
*
* @param {HTTPClient} httpClient The HTTP client we will give the repository.
* @return {AsyncFactory} The factory for creating models.
*/

View File

@ -146,7 +146,9 @@ final class WC_Cart_Session {
} elseif ( ! empty( $values['data_hash'] ) && ! hash_equals( $values['data_hash'], wc_get_cart_item_data_hash( $product ) ) ) { // phpcs:ignore PHPCompatibility.PHP.NewFunctions.hash_equalsFound
$update_cart_session = true;
/* translators: %1$s: product name. %2$s product permalink */
wc_add_notice( sprintf( __( '%1$s has been removed from your cart because it has since been modified. You can add it back to your cart <a href="%2$s">here</a>.', 'woocommerce' ), $product->get_name(), $product->get_permalink() ), 'notice' );
$message = sprintf( __( '%1$s has been removed from your cart because it has since been modified. You can add it back to your cart <a href="%2$s">here</a>.', 'woocommerce' ), $product->get_name(), $product->get_permalink() );
$message = apply_filters( 'woocommerce_cart_item_removed_because_modified_message', $message, $product );
wc_add_notice( $message, 'notice' );
do_action( 'woocommerce_remove_cart_item_from_session', $key, $values );
} else {

View File

@ -21,7 +21,6 @@ class WC_Shop_Customizer {
add_action( 'customize_controls_print_styles', array( $this, 'add_styles' ) );
add_action( 'customize_controls_print_scripts', array( $this, 'add_scripts' ), 30 );
add_action( 'wp_enqueue_scripts', array( $this, 'add_frontend_scripts' ) );
add_action( 'admin_menu', array( $this, 'add_fse_customize_link' ) );
}
/**
@ -84,19 +83,6 @@ class WC_Shop_Customizer {
width: auto;
display: inline-block;
}
<?php
// For FSE themes hide the back button so we only surface WooCommerce options.
if ( function_exists( 'gutenberg_is_fse_theme' ) && gutenberg_is_fse_theme() ) {
?>
#sub-accordion-panel-woocommerce .customize-panel-back{
display: none;
}
#customize-controls #sub-accordion-panel-woocommerce .panel-meta.customize-info .accordion-section-title {
margin-left: 0;
}
<?php
}
?>
</style>
<?php
}
@ -265,29 +251,6 @@ class WC_Shop_Customizer {
<?php
}
/**
* For FSE themes add a "Customize WooCommerce" link to the Appearance menu.
*
* FSE themes hide the "Customize" link in the Appearance menu. In WooCommerce we have several options that can currently
* only be edited via the Customizer. For now, we are thus adding a new link for WooCommerce specific Customizer options.
*/
public function add_fse_customize_link() {
// Exit early if the FSE theme feature isn't present or the current theme is not a FSE theme.
if ( ! function_exists( 'gutenberg_is_fse_theme' ) || function_exists( 'gutenberg_is_fse_theme' ) && ! gutenberg_is_fse_theme() ) {
return;
}
// Add a link to the WooCommerce panel in the Customizer.
add_submenu_page(
'themes.php',
__( 'Customize WooCommerce', 'woocommerce' ),
__( 'Customize WooCommerce', 'woocommerce' ),
'edit_theme_options',
admin_url( 'customize.php?autofocus[panel]=woocommerce' )
);
}
/**
* Sanitize the shop page & category display setting.
*

View File

@ -256,6 +256,19 @@ if ( ! function_exists( 'is_lost_password_page' ) ) {
}
}
if ( ! function_exists( 'is_ajax' ) ) {
/**
* Is_ajax - Returns true when the page is loaded via ajax.
*
* @see wp_doing_ajax() for an equivalent function provided by WordPress since 4.7.0
* @return bool
*/
function is_ajax() {
return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : Constants::is_defined( 'DOING_AJAX' );
}
}
if ( ! function_exists( 'is_store_notice_showing' ) ) {
/**

View File

@ -1123,17 +1123,3 @@ function get_woocommerce_term_meta( $term_id, $key, $single = true ) {
wc_deprecated_function( 'get_woocommerce_term_meta', '3.6', 'get_term_meta' );
return function_exists( 'get_term_meta' ) ? get_term_meta( $term_id, $key, $single ) : get_metadata( 'woocommerce_term', $term_id, $key, $single );
}
if ( ! function_exists( 'is_ajax' ) ) {
/**
* Is_ajax - Returns true when the page is loaded via ajax.
*
* @deprecated 6.1.0
* @return bool
*/
function is_ajax() {
wc_deprecated_function( 'is_ajax', '6.1.0', 'wp_doing_ajax' );
return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : Constants::is_defined( 'DOING_AJAX' );
}
}

View File

@ -401,7 +401,7 @@ function _wc_term_recount( $terms, $taxonomy, $callback = true, $terms_are_term_
* @since 5.2
* @param bool
*/
if ( ! apply_filters( 'woocommerce_product_recount_terms', '__return_true' ) ) {
if ( ! apply_filters( 'woocommerce_product_recount_terms', true ) ) {
return;
}