merge trunk

This commit is contained in:
Ron Rennick 2021-04-09 17:08:17 -03:00
commit a517d88132
31 changed files with 467 additions and 76 deletions

View File

@ -0,0 +1,22 @@
name: 'Update contributor feedback labels on comment'
on: 'issue_comment'
jobs:
feedback:
if: |
github.actor != 'github-actions' &&
github.event.issue &&
github.event.issue.state == 'open' &&
contains(github.event.issue.labels.*.name, 'needs feedback')
runs-on: ubuntu-latest
steps:
- name: Add has feedback
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'has feedback'
- name: remove needs feedback
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'needs feedback'

View File

@ -1,33 +1,9 @@
== Changelog ==
= 5.2.0 RC 2 2021-04-06 =
= 5.2.0 2021-04-13 =
**WooCommerce**
* Update - WooCommerce Admin package 2.1.5. #29577
**WooCommerce Admin - 2.1.5**
* Tweak - Set international country feature flag off
= 5.2.0 RC 2021-03-30 =
**WooCommerce**
* Update - WooCommerce Admin package 2.1.4. #29520
* Fix - Don't remove existing coupons from order when an invalid REST API request for updating coupons is submitted. #29474
* Fix - Wrong logic for including or excluding the payments step in the list of completed tasks in the onboarding wizard. #29518
**WooCommerce Admin - 2.1.4**
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
= 5.2.0 beta 2021-03-23 =
**WooCommerce**
* Update - WooCommerce Blocks package 4.7.0. #29406
* Update - WooCommerce Admin package 2.1.3. #29283
* Add - Filter woocommerce_product_recount_terms to allow/prevent recounting of product terms. #29281
* Add - Result return array to the checkout_place_order_success callback to allow 3rd party to manipulate results. #29232
* Dev - Fix miscellaneous typos in docblocks. #29285
@ -66,11 +42,21 @@
* Fix - Invalid refund amount error on $0 refund when number of decimals is equal to 0. #27277
* Fix - "Sale" badge misaligned on products when displaying 1 item per row. #29425
* Fix - Revert a replacement of wp_redirect to wp_safe_redirect in WC_Checkout::process_order_payment that caused issues in the default PayPal interface. #29459
* Fix - Don't remove existing coupons from order when an invalid REST API request for updating coupons is submitted. #29474
* Fix - Wrong logic for including or excluding the payments step in the list of completed tasks in the onboarding wizard. #29518
* Fix - Error when loading the admin dashboard while the admin package was disabled. #29613
* Fix - "'' is not a valid country code" error when no billing/shipping country specified (e.g. when using PayPal checkout). #29606
* Fix - Sanitize tax class and display errors in admin while creating tax classes.
* Fix - Check if a verified product owner is required before placing a review.
* Fix - Make product name escaping consistent in the front-end.
* Tweak - Added the Mercado Pago logo into the assets/images folder in order to use it in the payments setup task. #29365
* Tweak - Update the contributor guidelines. #29150
* Tweak - Introduced phone number input validation. #27242
* Tweak - Escape short description.
* Update - WooCommerce Admin package 2.1.5. #29577
* Update - WooCommerce Blocks package 4.7.0. #29406
**WooCommerce Admin - 2.1.0 & 2.1.1 & 2.1.2 & 2.1.3**
**WooCommerce Admin - 2.1.0 & 2.1.1 & 2.1.2 & 2.1.3 & 2.1.4 & 2.1.5**
* Add - Add navigation intro modal. #6367
* Add - CES track settings tab on updating settings #6368
@ -97,6 +83,7 @@
* Fix - Add check for navigating being enabled. #6462
* Fix - Add customer name column to CSV export #6556
* Fix - Add guard to "Deactivate Plugin" note handlers to prevent fatal error. #6532
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
* Fix - Broken link anchors to online documentation. #6455
* Fix - Check if tax was successfully added before displaying notice #6229
* Fix - Correct a bug where the JP connection flow would not happen when installing JP in the OBW. #6521
@ -120,11 +107,12 @@
* Tweak - New Settings: Turn off in dev mode #6348
* Tweak - Order and styles updates to nav footer #6373
* Tweak - Remove categories without menu items #6329
* Tweak - Set international country feature flag off
* Tweak - Set `is_deleted` from the database when instantiating a `Note` #6322
* Tweak - Update inline documentation for navigation Screen class #6173
* Tweak - Updates to copy and punctuation to be more conversational and consistent. #6298
**WooCommerce Blocks - 4.5.0 & 4.6.0 & 4.7.0**
**WooCommerce Blocks - 4.5.0 & 4.6.0 & 4.7.0 & 4.7.1**
* Enhancement - Login links on the checkout should use the account page. ([3844](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3844))
* Enhancement - Prevent checkout linking to trashed terms and policy pages. ([3843](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3843))

View File

@ -534,7 +534,7 @@ return array(
'SO' => __( 'Sololá', 'woocommerce' ),
'SU' => __( 'Suchitepéquez', 'woocommerce' ),
'TO' => __( 'Totonicapán', 'woocommerce' ),
'ZA' => __( 'Zacapa', 'woocommerce' )
'ZA' => __( 'Zacapa', 'woocommerce' ),
),
'HK' => array( // Hong Kong states.
'HONG KONG' => __( 'Hong Kong Island', 'woocommerce' ),
@ -1296,7 +1296,28 @@ return array(
),
'PL' => array(),
'PR' => array(),
'PT' => array(),
'PT' => array( // Portugal states. Ref: https://github.com/unicode-org/cldr/blob/release-38-1/common/subdivisions/en.xml#L4139-L4159
'PT-01' => __( 'Aveiro', 'woocommerce' ),
'PT-02' => __( 'Beja', 'woocommerce' ),
'PT-03' => __( 'Braga', 'woocommerce' ),
'PT-04' => __( 'Bragança', 'woocommerce' ),
'PT-05' => __( 'Castelo Branco', 'woocommerce' ),
'PT-06' => __( 'Coimbra', 'woocommerce' ),
'PT-07' => __( 'Évora', 'woocommerce' ),
'PT-08' => __( 'Faro', 'woocommerce' ),
'PT-09' => __( 'Guarda', 'woocommerce' ),
'PT-10' => __( 'Leiria', 'woocommerce' ),
'PT-11' => __( 'Lisbon', 'woocommerce' ),
'PT-12' => __( 'Portalegre', 'woocommerce' ),
'PT-13' => __( 'Porto', 'woocommerce' ),
'PT-14' => __( 'Santarém', 'woocommerce' ),
'PT-15' => __( 'Setúbal', 'woocommerce' ),
'PT-16' => __( 'Viana do Castelo', 'woocommerce' ),
'PT-17' => __( 'Vila Real', 'woocommerce' ),
'PT-18' => __( 'Viseu', 'woocommerce' ),
'PT-20' => __( 'Azores', 'woocommerce' ),
'PT-30' => __( 'Madeira', 'woocommerce' ),
),
'PY' => array( // Paraguay states.
'PY-ASU' => __( 'Asunción', 'woocommerce' ),
'PY-1' => __( 'Concepción', 'woocommerce' ),

View File

@ -262,7 +262,9 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
// Gets order total from "pay for order" page.
if ( 0 < $order_id ) {
$order = wc_get_order( $order_id );
$total = (float) $order->get_total();
if ( $order ) {
$total = (float) $order->get_total();
}
// Gets order total from cart/checkout.
} elseif ( 0 < WC()->cart->total ) {

View File

@ -162,7 +162,9 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
* @return bool
*/
private function should_display_widget() {
return 'yes' !== get_option( 'woocommerce_task_list_complete' ) && 'yes' !== get_option( 'woocommerce_task_list_hidden' );
return WC()->is_wc_admin_active() &&
'yes' !== get_option( 'woocommerce_task_list_complete' ) &&
'yes' !== get_option( 'woocommerce_task_list_hidden' );
}
/**

View File

@ -63,6 +63,10 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
* @return bool
*/
private function should_display_widget() {
if ( ! WC()->is_wc_admin_active() ) {
return false;
}
$has_permission = current_user_can( 'view_woocommerce_reports' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'publish_shop_orders' );
$task_completed_or_hidden = 'yes' === get_option( 'woocommerce_task_list_complete' ) || 'yes' === get_option( 'woocommerce_task_list_hidden' );
return $task_completed_or_hidden && $has_permission;
@ -127,11 +131,11 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
$reports = new WC_Admin_Report();
$net_sales_link = 'admin.php?page=wc-reports&tab=orders&range=month';
$net_sales_link = 'admin.php?page=wc-reports&tab=orders&range=month';
$top_seller_link = 'admin.php?page=wc-reports&tab=orders&report=sales_by_product&range=month&product_ids=';
$report_data = $is_wc_admin_disabled ? $this->get_sales_report_data() : $this->get_wc_admin_performance_data();
$report_data = $is_wc_admin_disabled ? $this->get_sales_report_data() : $this->get_wc_admin_performance_data();
if ( ! $is_wc_admin_disabled ) {
$net_sales_link = 'admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period';
$net_sales_link = 'admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period';
$top_seller_link = 'admin.php?page=wc-admin&filter=single_product&path=%2Fanalytics%2Fproducts&products=';
}

View File

@ -810,7 +810,7 @@ class WC_AJAX {
if ( ! empty( $files ) ) {
foreach ( $files as $download_id => $file ) {
$inserted_id = wc_downloadable_file_permission( $download_id, $product_id, $order, $item->get_quantity(), $item );
$inserted_id = wc_downloadable_file_permission( $download_id, $product->get_id(), $order, $item->get_quantity(), $item );
if ( $inserted_id ) {
$download = new WC_Customer_Download( $inserted_id );
$loop ++;

View File

@ -747,7 +747,7 @@ class WC_Checkout {
$field_label = isset( $field['label'] ) ? $field['label'] : '';
if ( $validate_fieldset &&
( isset( $field['type'] ) && 'country' === $field['type'] ) &&
( isset( $field['type'] ) && 'country' === $field['type'] && '' !== $data[ $key ] ) &&
! WC()->countries->country_exists( $data[ $key ] ) ) {
/* translators: ISO 3166-1 alpha-2 country code */
$errors->add( $key . '_validation', sprintf( __( "'%s' is not a valid country code.", 'woocommerce' ), $data[ $key ] ) );

View File

@ -242,6 +242,27 @@ class WC_Customer extends WC_Legacy_Customer {
return $this->get_calculated_shipping();
}
/**
* Indicates if the customer has a non-empty shipping address.
*
* Note that this does not indicate if the customer's shipping address
* is complete, only that one or more fields are populated.
*
* @since 5.3.0
*
* @return bool
*/
public function has_shipping_address() {
foreach ( $this->get_shipping() as $address_field ) {
// Trim guards against a case where a subset of saved shipping address fields contain whitespace.
if ( strlen( trim( $address_field ) ) > 0 ) {
return true;
}
}
return false;
}
/**
* Get if customer is VAT exempt?
*

View File

@ -179,7 +179,7 @@ class WC_Order extends WC_Abstract_Order {
}
if ( $total_refunded && $display_refunded ) {
$formatted_total = '<del>' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_currency() ) ) . $tax_string . '</ins>';
$formatted_total = '<del aria-hidden="true">' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_currency() ) ) . $tax_string . '</ins>';
} else {
$formatted_total .= $tax_string;
}

View File

@ -126,12 +126,13 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
protected function set_defaults( &$customer ) {
try {
$default = wc_get_customer_default_location();
$has_shipping_address = $customer->has_shipping_address();
if ( ! $customer->get_billing_country() ) {
$customer->set_billing_country( $default['country'] );
}
if ( ! $customer->get_shipping_country() ) {
if ( ! $customer->get_shipping_country() && ! $has_shipping_address ) {
$customer->set_shipping_country( $customer->get_billing_country() );
}
@ -139,7 +140,7 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
$customer->set_billing_state( $default['state'] );
}
if ( ! $customer->get_shipping_state() ) {
if ( ! $customer->get_shipping_state() && ! $has_shipping_address ) {
$customer->set_shipping_state( $customer->get_billing_state() );
}

View File

@ -37,7 +37,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
$this->icon = apply_filters( 'woocommerce_bacs_icon', '' );
$this->has_fields = false;
$this->method_title = __( 'Direct bank transfer', 'woocommerce' );
$this->method_description = __( 'Take payments in person via BACS. More commonly known as direct bank/wire transfer', 'woocommerce' );
$this->method_description = __( 'Take payments in person via BACS. More commonly known as direct bank/wire transfer.', 'woocommerce' );
// Load the settings.
$this->init_form_fields();

View File

@ -132,7 +132,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
$order = wc_get_order( $order_id );
// Test if order needs shipping.
if ( 0 < count( $order->get_items() ) ) {
if ( $order && 0 < count( $order->get_items() ) ) {
foreach ( $order->get_items() as $item ) {
$_product = $item->get_product();
if ( $_product && $_product->needs_shipping() ) {

View File

@ -1265,7 +1265,7 @@ function wc_format_stock_quantity_for_display( $stock_quantity, $product ) {
* @return string
*/
function wc_format_sale_price( $regular_price, $sale_price ) {
$price = '<del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
$price = '<del aria-hidden="true">' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
return apply_filters( 'woocommerce_format_sale_price', $price, $regular_price, $sale_price );
}

View File

@ -252,7 +252,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
if ( '' === get_option( 'permalink_structure' ) ) {
$form_action = remove_query_arg( array( 'page', 'paged' ), add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
} else {
$form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( trailingslashit( $wp->request ) ) );
$form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( user_trailingslashit( $wp->request ) ) );
}
echo '<form method="get" action="' . esc_url( $form_action ) . '" class="woocommerce-widget-layered-nav-dropdown">';

View File

@ -4,7 +4,7 @@ Tags: e-commerce, store, sales, sell, woo, shop, cart, checkout, downloadable, d
Requires at least: 5.5
Tested up to: 5.7
Requires PHP: 7.0
Stable tag: 5.1.0
Stable tag: 5.2.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -160,34 +160,10 @@ WooCommerce comes with some sample data you can use to see how products look; im
== Changelog ==
= 5.2.0 RC 2 2021-04-06 =
= 5.2.0 2021-04-13 =
**WooCommerce**
* Update - WooCommerce Admin package 2.1.5. #29577
**WooCommerce Admin - 2.1.5**
* Tweak - Set international country feature flag off
= 5.2.0 RC 2021-03-30 =
**WooCommerce**
* Update - WooCommerce Admin package 2.1.4. #29520
* Fix - Don't remove existing coupons from order when an invalid REST API request for updating coupons is submitted. #29474
* Fix - Wrong logic for including or excluding the payments step in the list of completed tasks in the onboarding wizard. #29518
**WooCommerce Admin - 2.1.4**
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
= 5.2.0 beta 2021-03-23 =
**WooCommerce**
* Update - WooCommerce Blocks package 4.7.0. #29406
* Update - WooCommerce Admin package 2.1.3. #29283
* Add - Filter woocommerce_product_recount_terms to allow/prevent recounting of product terms. #29281
* Add - Result return array to the checkout_place_order_success callback to allow 3rd party to manipulate results. #29232
* Dev - Fix miscellaneous typos in docblocks. #29285
@ -224,13 +200,23 @@ WooCommerce comes with some sample data you can use to see how products look; im
* Fix - add validation of the posted country codes on checkout. #28849
* Fix - Correctly display pagination arrows on RTL languages. #28523
* Fix - Invalid refund amount error on $0 refund when number of decimals is equal to 0. #27277
* Fix - Revert a replacement of wp_redirect to wp_safe_redirect in WC_Checkout::process_order_payment that caused issues in the default PayPal interface. #29459
* Fix - "Sale" badge misaligned on products when displaying 1 item per row. #29425
* Fix - Revert a replacement of wp_redirect to wp_safe_redirect in WC_Checkout::process_order_payment that caused issues in the default PayPal interface. #29459
* Fix - Don't remove existing coupons from order when an invalid REST API request for updating coupons is submitted. #29474
* Fix - Wrong logic for including or excluding the payments step in the list of completed tasks in the onboarding wizard. #29518
* Fix - Error when loading the admin dashboard while the admin package was disabled. #29613
* Fix - "'' is not a valid country code" error when no billing/shipping country specified (e.g. when using PayPal checkout). #29606
* Fix - Sanitize tax class and display errors in admin while creating tax classes.
* Fix - Check if a verified product owner is required before placing a review.
* Fix - Make product name escaping consistent in the front-end.
* Tweak - Added the Mercado Pago logo into the assets/images folder in order to use it in the payments setup task. #29365
* Tweak - Update the contributor guidelines. #29150
* Tweak - Introduced phone number input validation. #27242
* Tweak - Escape short description.
* Update - WooCommerce Admin package 2.1.5. #29577
* Update - WooCommerce Blocks package 4.7.0. #29406
**WooCommerce Admin - 2.1.0 & 2.1.1 & 2.1.2 & 2.1.3**
**WooCommerce Admin - 2.1.0 & 2.1.1 & 2.1.2 & 2.1.3 & 2.1.4 & 2.1.5**
* Add - Add navigation intro modal. #6367
* Add - CES track settings tab on updating settings #6368
@ -257,6 +243,7 @@ WooCommerce comes with some sample data you can use to see how products look; im
* Fix - Add check for navigating being enabled. #6462
* Fix - Add customer name column to CSV export #6556
* Fix - Add guard to "Deactivate Plugin" note handlers to prevent fatal error. #6532
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
* Fix - Broken link anchors to online documentation. #6455
* Fix - Check if tax was successfully added before displaying notice #6229
* Fix - Correct a bug where the JP connection flow would not happen when installing JP in the OBW. #6521
@ -280,11 +267,12 @@ WooCommerce comes with some sample data you can use to see how products look; im
* Tweak - New Settings: Turn off in dev mode #6348
* Tweak - Order and styles updates to nav footer #6373
* Tweak - Remove categories without menu items #6329
* Tweak - Set international country feature flag off
* Tweak - Set `is_deleted` from the database when instantiating a `Note` #6322
* Tweak - Update inline documentation for navigation Screen class #6173
* Tweak - Updates to copy and punctuation to be more conversational and consistent. #6298
**WooCommerce Blocks - 4.5.0 & 4.6.0 & 4.7.0**
**WooCommerce Blocks - 4.5.0 & 4.6.0 & 4.7.0 & 4.7.1**
* Enhancement - Login links on the checkout should use the account page. ([3844](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3844))
* Enhancement - Prevent checkout linking to trashed terms and policy pages. ([3843](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3843))

View File

@ -12,7 +12,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 4.0.0
* @version 4.8.0
*/
defined( 'ABSPATH' ) || exit;

View File

@ -41,6 +41,7 @@
- Merchant order emails flow
- Merchant analytics page load tests
- Shopper Checkout Create Account
- Merchant import products via CSV
# 0.1.1

View File

@ -63,6 +63,7 @@ The functions to access the core tests are:
- `runUpdateGeneralSettingsTest` - Merchant can update general settings
- `runMerchantOrderEmailsTest` - Merchant can receive order emails and resend emails by Order Actions
- `runAnalyticsPageLoadsTest` - Merchant can load and see all pages in Analytics
- `runImportProductsTest` - Merchant can import products via CSV file
### Shopper

View File

@ -0,0 +1,26 @@
/**
* External dependencies
*/
const path = require( 'path' );
const getCoreTestsRoot = () => {
// Figure out where we're installed.
// Typically will be in node_modules/, but WooCommerce
// uses a local file path (tests/e2e/core-tests).
let coreTestsPath = false;
const moduleDir = path.dirname( require.resolve( '@woocommerce/e2e-core-tests' ) );
if ( -1 < moduleDir.indexOf( 'node_modules' ) ) {
coreTestsPath = moduleDir.split( 'node_modules' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'tests/e2e/core-tests' ) ) {
coreTestsPath = moduleDir.split( 'tests/e2e/core-tests' )[ 0 ];
}
return {
appRoot: coreTestsPath,
packageRoot: moduleDir,
};
};
module.exports = getCoreTestsRoot;

View File

@ -40,6 +40,7 @@ const runMerchantOrdersCustomerPaymentPage = require( './merchant/wp-admin-order
const runMerchantOrderEmailsTest = require( './merchant/wp-admin-order-emails.test' );
const runOrderSearchingTest = require( './merchant/wp-admin-order-searching.test' );
const runAnalyticsPageLoadsTest = require( './merchant/wp-admin-analytics-page-loads.test' );
const runImportProductsTest = require( './merchant/wp-admin-product-import-csv.test' );
// REST API tests
const runExternalProductAPITest = require( './api/external-product.test' );
@ -70,6 +71,7 @@ const runShopperTests = () => {
};
const runMerchantTests = () => {
runImportProductsTest();
runOrderSearchingTest();
runAddNewShippingZoneTest();
runCreateCouponTest();
@ -137,6 +139,7 @@ module.exports = {
runApiTests,
runAnalyticsPageLoadsTest,
runCheckoutCreateAccountTest,
runImportProductsTest,
runCheckoutLoginAccountTest,
runMyAccountCreateAccountTest,
};

View File

@ -0,0 +1,132 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/
const {
merchant,
setCheckbox,
moveAllItemsToTrash
} = require( '@woocommerce/e2e-utils' );
const getCoreTestsRoot = require( '../../core-tests-root' );
/**
* External dependencies
*/
const {
it,
describe,
beforeAll,
} = require( '@jest/globals' );
const path = require( 'path' );
const coreTestsPath = getCoreTestsRoot();
const filePath = path.resolve( coreTestsPath.appRoot, 'sample-data/sample_products.csv' );
const filePathOverride = path.resolve( coreTestsPath.packageRoot, 'test-data/sample_products_override.csv' );
const productNames = ["V-Neck T-Shirt", "Hoodie", "Hoodie with Logo", "T-Shirt", "Beanie",
"Belt", "Cap", "Sunglasses", "Hoodie with Pocket", "Hoodie with Zipper", "Long Sleeve Tee", "Polo", "Album",
"Single", "T-Shirt with Logo", "Beanie with Logo", "Logo Collection", "WordPress Pennant"];
const productNamesOverride = ["V-Neck T-Shirt Override", "Hoodie Override", "Hoodie with Logo Override",
"T-Shirt Override", "Beanie Override", "Belt Override", "Cap Override", "Sunglasses Override",
"Hoodie with Pocket Override", "Hoodie with Zipper Override", "Long Sleeve Tee Override",
"Polo Override", "Album Override", "Single Override", "T-Shirt with Logo Override", "Beanie with Logo Override",
"Logo Collection Override", "WordPress Pennant Override"];
const productPricesOverride = ["$111.05", "$118.00", "$145.00", "$120.00", "$118.00", "$118.00", "$13.00", "$12.00",
"$115.00", "$120.00", "$125.00", "$145.00", "$145.00", "$135.00", "$190.00", "$118.00", "$116.00",
"$165.00", "$155.00", "$120.00", "$118.00", "$118.00", "$145.00", "$142.00", "$145.00", "$115.00", "$120.00"];
const errorMessage = 'Invalid file type. The importer supports CSV and TXT file formats.';
const runImportProductsTest = () => {
describe('Import Products from a CSV file', () => {
beforeAll(async () => {
await merchant.login();
await merchant.openAllProductsView();
await merchant.openImportProducts();
});
it('should show error message if you go without providing CSV file', async () => {
// Verify the error message if you go without providing CSV file
await Promise.all( [
page.click( 'button[value="Continue"]' ),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
]);
await page.waitForSelector('div.error');
await expect(page).toMatchElement('div.error > p', errorMessage);
});
it('can upload the CSV file and import products', async () => {
// Put the CSV products file and proceed further
const uploader = await page.$("input[type=file]");
await uploader.uploadFile(filePath);
await expect(page).toClick('button[value="Continue"]');
// Click on Run the importer
await page.waitForSelector('button[value="Run the importer"]');
await expect(page).toClick('button[value="Run the importer"]');
// Waiting for importer to finish
await page.waitForSelector('section.woocommerce-importer-done', {visible:true, timeout: 60000});
await page.waitForSelector('.woocommerce-importer-done');
await expect(page).toMatchElement('.woocommerce-importer-done', {text: 'Import complete!'});
});
it('can see and verify the uploaded products', async () => {
// Click on view products
await page.waitForSelector('div.wc-actions > a.button.button-primary');
await expect(page).toClick('div.wc-actions > a.button.button-primary');
// Gathering product names
await page.waitForSelector('a.row-title');
const productTitles = await page.$$eval('a.row-title',
elements => elements.map(item => item.innerHTML));
// Compare imported product names
expect(productTitles.sort()).toEqual(productNames.sort());
});
it('can override the existing products via CSV import', async () => {
await merchant.openImportProducts();
// Put the CSV Override products file, set checkbox and proceed further
const uploader = await page.$("input[type=file]");
await uploader.uploadFile(filePathOverride);
await setCheckbox('#woocommerce-importer-update-existing');
await expect(page).toClick('button[value="Continue"]');
// Click on Run the importer
await page.waitForSelector('button[value="Run the importer"]');
await expect(page).toClick('button[value="Run the importer"]');
// Waiting for importer to finish
await page.waitForSelector('section.woocommerce-importer-done', {visible:true, timeout: 60000});
await page.waitForSelector('.woocommerce-importer-done');
await expect(page).toMatchElement('.woocommerce-importer-done', {text: 'Import complete!'});
});
it('can see and verify the uploaded overrode products', async () => {
// Click on view products
await page.waitForSelector('div.wc-actions > a.button.button-primary');
await expect(page).toClick('div.wc-actions > a.button.button-primary');
// Gathering product names
await page.waitForSelector('a.row-title');
const productTitles = await page.$$eval('a.row-title',
elements => elements.map(item => item.innerHTML));
// Compare overriden product names
expect(productTitles.sort()).toEqual(productNamesOverride.sort());
// Gathering product prices
await page.waitForSelector('td.price.column-price');
const productPrices = await page.$$eval('.amount',
elements => elements.map(item => item.innerText));
// Compare overriden product prices
expect(productPrices.sort()).toEqual(productPricesOverride.sort());
// Move all imported products to trash
await moveAllItemsToTrash();
});
});
};
module.exports = runImportProductsTest;

View File

@ -0,0 +1,26 @@
ID,Type,SKU,Name,Published,"Is featured?","Visibility in catalog","Short description",Description,"Date sale price starts","Date sale price ends","Tax status","Tax class","In stock?",Stock,"Backorders allowed?","Sold individually?","Weight (lbs)","Length (in)","Width (in)","Height (in)","Allow customer reviews?","Purchase note","Sale price","Regular price",Categories,Tags,"Shipping class",Images,"Download limit","Download expiry days",Parent,"Grouped products",Upsells,Cross-sells,"External URL","Button text",Position,"Attribute 1 name","Attribute 1 value(s)","Attribute 1 visible","Attribute 1 global","Attribute 2 name","Attribute 2 value(s)","Attribute 2 visible","Attribute 2 global","Meta: _wpcom_is_markdown","Download 1 name","Download 1 URL","Download 2 name","Download 2 URL"
,variable,woo-vneck-tee,V-Neck T-Shirt Override,1,"1","visible","This is a variable product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".5","24","1","2","1",,,,Clothing > Tshirts,,,"https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-green-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-blue-1.jpg",,,,,,,,,0,"Color","Blue, Green, Red","1","1","Size","Large, Medium, Small","1","1","1",,,,
,variable,woo-hoodie,Hoodie Override,1,"0","visible","This is a variable product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","1.5","10","8","3","1",,,,Clothing > Hoodies,,,"https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-2.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg",,,,,,,,,0,"Color","Blue, Green, Red","1","1","Logo","Yes, No","1","0","1",,,,
,simple,woo-hoodie-with-logo,Hoodie with Logo Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","2","10","6","3","1",,,"145",Clothing > Hoodies,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg,,,,,,,,,0,"Color","Blue","1","1",,,,,"1",,,,
,simple,woo-tshirt,T-Shirt Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".8","8","6","1","1",,,"118",Clothing > Tshirts,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/tshirt-2.jpg,,,,,,,,,0,"Color","Gray","1","1",,,,,"1",,,,
,simple,woo-beanie,Beanie Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".2","4","5",".5","1",,"118","120",Clothing > Accessories,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-2.jpg,,,,,,,,,0,"Color","Red","1","1",,,,,"1",,,,
,simple,woo-belt,Belt Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","1.2","12","2","1.5","1",,"155","165",Clothing > Accessories,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/belt-2.jpg,,,,,,,,,0,,,,,,,,,"1",,,,
,simple,woo-cap,Cap Override,1,"1","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","0.6","8","6.5","4","1",,"116","118",Clothing > Accessories,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/cap-2.jpg,,,,,,,,,0,"Color","Yellow","1","1",,,,,"1",,,,
,simple,woo-sunglasses,Sunglasses Override,1,"1","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".2","4","1.4","1","1",,,"190",Clothing > Accessories,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/sunglasses-2.jpg,,,,,,,,,0,,,,,,,,,"1",,,,
,simple,woo-hoodie-with-pocket,Hoodie with Pocket Override,1,"1","hidden","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","3","10","8","2","1",,"135","145",Clothing > Hoodies,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-pocket-2.jpg,,,,,,,,,0,"Color","Gray","1","1",,,,,"1",,,,
,simple,woo-hoodie-with-zipper,Hoodie with Zipper Override,1,"1","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","2","8","6","2","1",,,"145",Clothing > Hoodies,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-zipper-2.jpg,,,,,,,,,0,,,,,,,,,"1",,,,
,simple,woo-long-sleeve-tee,Long Sleeve Tee Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0","1","7","5","1","1",,,"125",Clothing > Tshirts,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/long-sleeve-tee-2.jpg,,,,,,,,,0,"Color","Green","1","1",,,,,"1",,,,
,simple,woo-polo,Polo Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".8","6","5","1","1",,,"120",Clothing > Tshirts,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/polo-2.jpg,,,,,,,,,0,"Color","Blue","1","1",,,,,"1",,,,
,"simple, downloadable, virtual",woo-album,Album Override,1,"0","visible","This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"1",,,"115",Music,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/album-1.jpg,"1","1",,,,,,,0,,,,,,,,,"1","Single 1","https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg","Single 2","https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/album.jpg"
,"simple, downloadable, virtual",woo-single,Single Override,1,"0","visible","This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"1",,"12","13",Music,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/single-1.jpg,"1","1",,,,,,,0,,,,,,,,,"1","Single","https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg",,
,variation,woo-vneck-tee-red,V-Neck T-Shirt - Red Override,1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,,"120",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg,,,woo-vneck-tee,,,,,,0,"Color","Red",,"1","Size",,,"1",,,,,
,variation,woo-vneck-tee-green,V-Neck T-Shirt - Green Override,1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,,"120",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-green-1.jpg,,,woo-vneck-tee,,,,,,0,"Color","Green",,"1","Size",,,"1",,,,,
,variation,woo-vneck-tee-blue,V-Neck T-Shirt - Blue Override,1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,,"115",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-blue-1.jpg,,,woo-vneck-tee,,,,,,0,"Color","Blue",,"1","Size",,,"1",,,,,
,variation,woo-hoodie-red,"Hoodie - Red, No Override",1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,"142","145",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-2.jpg,,,woo-hoodie,,,,,,1,"Color","Red",,"1","Logo","No",,"0",,,,,
,variation,woo-hoodie-green,"Hoodie - Green, No Override",1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,,"145",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg,,,woo-hoodie,,,,,,2,"Color","Green",,"1","Logo","No",,"0",,,,,
,variation,woo-hoodie-blue,"Hoodie - Blue, No Override",1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,,"145",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg,,,woo-hoodie,,,,,,3,"Color","Blue",,"1","Logo","No",,"0",,,,,
,simple,Woo-tshirt-logo,T-Shirt with Logo Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".5","10","12",".5","1",,,"118",Clothing > Tshirts,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg,,,,,,,,,0,"Color","Gray","1","1",,,,,"1",,,,
,simple,Woo-beanie-logo,Beanie with Logo Override,1,"0","visible","This is a simple product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",".2","6","4","1","1",,"118","120",Clothing > Accessories,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-with-logo-1.jpg,,,,,,,,,0,"Color","Red","1","1",,,,,"1",,,,
,grouped,logo-collection,Logo Collection Override,1,"0","visible","This is a grouped product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",,,,,"1",,,,Clothing,,,"https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-with-logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg",,,,"woo-hoodie-with-logo, woo-tshirt, woo-beanie",,,,,0,,,,,,,,,"1",,,,
,external,wp-pennant,WordPress Pennant Override,1,"0","visible","This is an external product.","Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,"taxable",,"1",,"0","0",,,,,"1",,,"111.05",Decor,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/pennant-1.jpg,,,,,,,"https://mercantile.wordpress.org/product/wordpress-pennant/","Buy on the WordPress swag store!",0,,,,,,,,,"1",,,,
,variation,woo-hoodie-blue-logo,"Hoodie - Blue, Yes Override",1,"0","visible",,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,"taxable",,"1",,"0","0",,,,,"0",,,"145",,,,https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg,,,woo-hoodie,,,,,,0,"Color","Blue",,"1","Logo","Yes",,"0",,,,,
1 ID Type SKU Name Published Is featured? Visibility in catalog Short description Description Date sale price starts Date sale price ends Tax status Tax class In stock? Stock Backorders allowed? Sold individually? Weight (lbs) Length (in) Width (in) Height (in) Allow customer reviews? Purchase note Sale price Regular price Categories Tags Shipping class Images Download limit Download expiry days Parent Grouped products Upsells Cross-sells External URL Button text Position Attribute 1 name Attribute 1 value(s) Attribute 1 visible Attribute 1 global Attribute 2 name Attribute 2 value(s) Attribute 2 visible Attribute 2 global Meta: _wpcom_is_markdown Download 1 name Download 1 URL Download 2 name Download 2 URL
2 variable woo-vneck-tee V-Neck T-Shirt Override 1 1 visible This is a variable product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .5 24 1 2 1 Clothing > Tshirts https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-green-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-blue-1.jpg 0 Color Blue, Green, Red 1 1 Size Large, Medium, Small 1 1 1
3 variable woo-hoodie Hoodie Override 1 0 visible This is a variable product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 1.5 10 8 3 1 Clothing > Hoodies https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-2.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg 0 Color Blue, Green, Red 1 1 Logo Yes, No 1 0 1
4 simple woo-hoodie-with-logo Hoodie with Logo Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 2 10 6 3 1 145 Clothing > Hoodies https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg 0 Color Blue 1 1 1
5 simple woo-tshirt T-Shirt Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .8 8 6 1 1 118 Clothing > Tshirts https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/tshirt-2.jpg 0 Color Gray 1 1 1
6 simple woo-beanie Beanie Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .2 4 5 .5 1 118 120 Clothing > Accessories https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-2.jpg 0 Color Red 1 1 1
7 simple woo-belt Belt Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 1.2 12 2 1.5 1 155 165 Clothing > Accessories https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/belt-2.jpg 0 1
8 simple woo-cap Cap Override 1 1 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 0.6 8 6.5 4 1 116 118 Clothing > Accessories https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/cap-2.jpg 0 Color Yellow 1 1 1
9 simple woo-sunglasses Sunglasses Override 1 1 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .2 4 1.4 1 1 190 Clothing > Accessories https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/sunglasses-2.jpg 0 1
10 simple woo-hoodie-with-pocket Hoodie with Pocket Override 1 1 hidden This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 3 10 8 2 1 135 145 Clothing > Hoodies https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-pocket-2.jpg 0 Color Gray 1 1 1
11 simple woo-hoodie-with-zipper Hoodie with Zipper Override 1 1 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 2 8 6 2 1 145 Clothing > Hoodies https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-zipper-2.jpg 0 1
12 simple woo-long-sleeve-tee Long Sleeve Tee Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 1 7 5 1 1 125 Clothing > Tshirts https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/long-sleeve-tee-2.jpg 0 Color Green 1 1 1
13 simple woo-polo Polo Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .8 6 5 1 1 120 Clothing > Tshirts https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/polo-2.jpg 0 Color Blue 1 1 1
14 simple, downloadable, virtual woo-album Album Override 1 0 visible This is a simple, virtual product. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 1 115 Music https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/album-1.jpg 1 1 0 1 Single 1 https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg Single 2 https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/album.jpg
15 simple, downloadable, virtual woo-single Single Override 1 0 visible This is a simple, virtual product. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 1 12 13 Music https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/single-1.jpg 1 1 0 1 Single https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg
16 variation woo-vneck-tee-red V-Neck T-Shirt - Red Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 120 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vneck-tee-2.jpg woo-vneck-tee 0 Color Red 1 Size 1
17 variation woo-vneck-tee-green V-Neck T-Shirt - Green Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 120 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-green-1.jpg woo-vneck-tee 0 Color Green 1 Size 1
18 variation woo-vneck-tee-blue V-Neck T-Shirt - Blue Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 115 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/vnech-tee-blue-1.jpg woo-vneck-tee 0 Color Blue 1 Size 1
19 variation woo-hoodie-red Hoodie - Red, No Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 142 145 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-2.jpg woo-hoodie 1 Color Red 1 Logo No 0
20 variation woo-hoodie-green Hoodie - Green, No Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 145 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg woo-hoodie 2 Color Green 1 Logo No 0
21 variation woo-hoodie-blue Hoodie - Blue, No Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 145 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg woo-hoodie 3 Color Blue 1 Logo No 0
22 simple Woo-tshirt-logo T-Shirt with Logo Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .5 10 12 .5 1 118 Clothing > Tshirts https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg 0 Color Gray 1 1 1
23 simple Woo-beanie-logo Beanie with Logo Override 1 0 visible This is a simple product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 .2 6 4 1 1 118 120 Clothing > Accessories https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-with-logo-1.jpg 0 Color Red 1 1 1
24 grouped logo-collection Logo Collection Override 1 0 visible This is a grouped product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 1 Clothing https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-with-logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/t-shirt-with-logo-1.jpg, https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg woo-hoodie-with-logo, woo-tshirt, woo-beanie 0 1
25 external wp-pennant WordPress Pennant Override 1 0 visible This is an external product. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. taxable 1 0 0 1 111.05 Decor https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/pennant-1.jpg https://mercantile.wordpress.org/product/wordpress-pennant/ Buy on the WordPress swag store! 0 1
26 variation woo-hoodie-blue-logo Hoodie - Blue, Yes Override 1 0 visible Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa. taxable 1 0 0 0 145 https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-with-logo-2.jpg woo-hoodie 0 Color Blue 1 Logo Yes 0

View File

@ -0,0 +1,6 @@
/*
* Internal dependencies
*/
const { runImportProductsTest } = require( '@woocommerce/e2e-core-tests' );
runImportProductsTest();

View File

@ -55,6 +55,7 @@ describe( 'Cart page', () => {
| `openEmailLog` | | Open the WP Mail Log page |
| `openAnalyticsPage` | | Open any Analytics page |
| `openAllUsersView` | | Open the All Users page |
| `openImportProducts` | | Open the Import Products page |
### Shopper `shopper`

View File

@ -25,6 +25,7 @@ export const WP_ADMIN_ALL_ORDERS_VIEW = WP_ADMIN_POST_TYPE + 'shop_order';
export const WP_ADMIN_NEW_ORDER = WP_ADMIN_NEW_POST_TYPE + 'shop_order';
export const WP_ADMIN_ALL_PRODUCTS_VIEW = WP_ADMIN_POST_TYPE + 'product';
export const WP_ADMIN_NEW_PRODUCT = WP_ADMIN_NEW_POST_TYPE + 'product';
export const WP_ADMIN_IMPORT_PRODUCTS = WP_ADMIN_ALL_PRODUCTS_VIEW + '&page=product_importer';
/**
* WooCommerce settings pages.
* @type {string}

View File

@ -23,6 +23,7 @@ const {
WP_ADMIN_NEW_SHIPPING_ZONE,
WP_ADMIN_ANALYTICS_PAGES,
WP_ADMIN_ALL_USERS_VIEW,
WP_ADMIN_IMPORT_PRODUCTS,
IS_RETEST_MODE,
} = require( './constants' );
@ -199,6 +200,12 @@ const merchant = {
waitUntil: 'networkidle0',
} );
},
openImportProducts: async () => {
await page.goto( WP_ADMIN_IMPORT_PRODUCTS , {
waitUntil: 'networkidle0',
} );
},
};
module.exports = merchant;

View File

@ -926,7 +926,7 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case {
* @since 3.3.0
*/
public function test_wc_format_sale_price() {
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>5.00</bdi></span></ins>', wc_format_sale_price( '10', '5' ) );
$this->assertEquals( '<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>5.00</bdi></span></ins>', wc_format_sale_price( '10', '5' ) );
}
/**

View File

@ -259,11 +259,11 @@ class WC_Tests_Product_Data extends WC_Unit_Test_Case {
$product = wc_get_product( $product1_id );
$this->assertEquals( $product1_id, $product->get_id() );
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>7.00</bdi></span></ins>', $product->get_price_html() );
$this->assertEquals( '<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>10.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>7.00</bdi></span></ins>', $product->get_price_html() );
$product = wc_get_product( $product2_id );
$this->assertEquals( $product2_id, $product->get_id() );
$this->assertEquals( '<del><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>20.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>16.00</bdi></span></ins>', $product->get_price_html() );
$this->assertEquals( '<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>20.00</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">&pound;</span>16.00</bdi></span></ins>', $product->get_price_html() );
$product = wc_get_product( $product3_id );
$this->assertEquals( $product3_id, $product->get_id() );

View File

@ -93,6 +93,30 @@ class WC_Checkout_Test extends \WC_Unit_Test_Case {
$this->assertEmpty( $errors->get_error_message( 'shipping_country_validation' ) );
}
/**
* @testdox 'validate_posted_data' doesn't add errors for empty billing/shipping countries.
*
* @testWith [true]
* [false]
*
* @param bool $ship_to_different_address True to simulate shipping to a different address than the billing address.
*/
public function test_validate_posted_data_does_not_add_error_for_empty_country( $ship_to_different_address ) {
$_POST = array(
'billing_country' => '',
'shipping_country' => '',
'ship_to_different_address' => $ship_to_different_address,
);
$data = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Missing
$errors = new WP_Error();
$this->sut->validate_posted_data( $data, $errors );
$this->assertEmpty( $errors->get_error_message( 'billing_country_validation' ) );
$this->assertEmpty( $errors->get_error_message( 'shipping_country_validation' ) );
}
/**
* @testdox 'validate_checkout' adds a "We don't ship to country X" error but only if the country exists.
*

View File

@ -0,0 +1,114 @@
<?php
/**
* Tests relating to the WC_Customer_Data_Store_Session class.
*/
class WC_Customer_Data_Store_Session_Test extends WC_Unit_Test_Case {
/**
* Ensure that the country and state shipping address fields only inherit
* the corresponding billing address values if a shipping address is not set.
*
* @see https://github.com/woocommerce/woocommerce/issues/28759
* @dataProvider provide_customers_with_different_addresses
*
* @param WC_Customer $customer The customer object being tested.
* @param bool $states_should_match If the billing and shipping states should match.
* @param bool $countries_should_match If the billing and shipping countries should match.
*/
public function test_setting_default_address_fields( WC_Customer $customer, bool $states_should_match, bool $countries_should_match ) {
$session_data = new WC_Customer_Data_Store_Session();
$session_data->read( $customer );
if ( $states_should_match ) {
$this->assertEquals( $customer->get_shipping_state(), $customer->get_billing_state() );
} else {
$this->assertNotEquals( $customer->get_shipping_state(), $customer->get_billing_state() );
}
if ( $countries_should_match ) {
$this->assertEquals( $customer->get_shipping_country(), $customer->get_billing_country() );
} else {
$this->assertNotEquals( $customer->get_shipping_country(), $customer->get_billing_country() );
}
}
/**
* Customer objects with a mixture of billing and shipping addresses.
*
* Each inner dataset is organized as follows:
*
* [
* (WC_Customer) $customer_object,
* (bool) $states_should_match,
* (bool) $countries_should_match,
* ]
*
* @return array[]
*/
public function provide_customers_with_different_addresses() {
$has_billing_address_only = new WC_Customer();
$has_billing_address_only->set_email( 'wc-customer-test-01@test.user' );
$has_billing_address_only->set_billing_address( '1234 Quality Lane' );
$has_billing_address_only->set_billing_city( 'Testville' );
$has_billing_address_only->set_billing_country( 'US' );
$has_billing_address_only->set_billing_state( 'CA' );
$has_billing_address_only->set_billing_postcode( '90123' );
$has_billing_address_only->save();
$separate_billing_and_shipping_state_and_country = new WC_Customer();
$separate_billing_and_shipping_state_and_country->set_email( 'wc-customer-test-02@test.user' );
$separate_billing_and_shipping_state_and_country->set_billing_address( '4567 Scenario Street' );
$separate_billing_and_shipping_state_and_country->set_billing_city( 'Unitly' );
$separate_billing_and_shipping_state_and_country->set_billing_country( 'UK' );
$separate_billing_and_shipping_state_and_country->set_billing_state( 'Computershire' );
$separate_billing_and_shipping_state_and_country->set_billing_postcode( 'ZX1 2PQ' );
$separate_billing_and_shipping_state_and_country->set_shipping_address( '8901 Situation Court' );
$separate_billing_and_shipping_state_and_country->set_shipping_city( 'Endtoendly' );
$separate_billing_and_shipping_state_and_country->set_shipping_country( 'CA' );
$separate_billing_and_shipping_state_and_country->set_shipping_state( 'BC' );
$separate_billing_and_shipping_state_and_country->set_shipping_postcode( 'A1B 2C3' );
$separate_billing_and_shipping_state_and_country->save();
$separate_billing_state_same_country = new WC_Customer();
$separate_billing_state_same_country->set_email( 'wc-customer-test-03@test.user' );
$separate_billing_state_same_country->set_billing_address( '4567 Scenario Street' );
$separate_billing_state_same_country->set_billing_city( 'Unitly' );
$separate_billing_state_same_country->set_billing_country( 'UK' );
$separate_billing_state_same_country->set_billing_state( 'Computershire' );
$separate_billing_state_same_country->set_billing_postcode( 'ZX1 2PQ' );
$separate_billing_state_same_country->set_shipping_address( '8901 Situation Court' );
$separate_billing_state_same_country->set_shipping_city( 'Endtoendly' );
$separate_billing_state_same_country->set_shipping_country( 'UK' );
$separate_billing_state_same_country->set_shipping_state( 'Byteshire' );
$separate_billing_state_same_country->set_shipping_postcode( 'RS1 2TU' );
$separate_billing_state_same_country->save();
$shipping_address_is_effectively_empty = new WC_Customer();
$shipping_address_is_effectively_empty->set_email( 'wc-customer-test-04@test.user' );
$shipping_address_is_effectively_empty->set_shipping_address( ' ' );
$shipping_address_is_effectively_empty->save();
return array(
'has_billing_address_only' => array(
$has_billing_address_only,
true,
true,
),
'separate_billing_and_shipping_state_and_country' => array(
$separate_billing_and_shipping_state_and_country,
false,
false,
),
'separate_billing_state_same_country' => array(
$separate_billing_state_same_country,
false,
true,
),
'shipping_address_is_effectively_empty' => array(
$shipping_address_is_effectively_empty,
true,
true,
),
);
}
}