Skip to content

Commit

Permalink
Merge pull request magento#3854 from magento-arcticfoxes/2.3.1-qwerty-pr
Browse files Browse the repository at this point in the history
[2.3.1-qwerty] Sync with 2.3.1-release
  • Loading branch information
joanhe authored Mar 6, 2019
2 parents c099de8 + 9c27f61 commit 863e2bd
Show file tree
Hide file tree
Showing 25 changed files with 565 additions and 342 deletions.
7 changes: 7 additions & 0 deletions app/code/Magento/AuthorizenetAcceptjs/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<dev>
<js>
<minify_exclude>
<authorizenet_acceptjs>\.authorize\.net/v1/Accept</authorizenet_acceptjs>
</minify_exclude>
</js>
</dev>
<payment>
<authorizenet_acceptjs>
<active>0</active>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
*/

var config = {
map: {
'*': {
acceptjssandbox: 'https://jstest.authorize.net/v1/Accept.js',
acceptjs: 'https://js.authorize.net/v1/Accept.js'
shim: {
acceptjs: {
exports: 'Accept'
},
acceptjssandbox: {
exports: 'Accept'
}
},
paths: {
acceptjssandbox: 'https://jstest.authorize.net/v1/Accept',
acceptjs: 'https://js.authorize.net/v1/Accept'
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define([
dependency = 'acceptjssandbox';
}

require([dependency], function () {
require([dependency], function (accept) {
var $body = $('body');

/*
Expand All @@ -26,16 +26,7 @@ define([
* Dynamically-loading-Accept-js-E-WC-03-Accept-js-is-not-loaded/td-p/63283
*/
$body.on('handshake.acceptjs', function () {
/*
* Accept.js doesn't return the library when loading
* and requirejs "shim" can't be used because it only works with the "paths" config option
* and we can't use "paths" because require will try to load ".min.js" in production
* and that doesn't work because it doesn't exist
* and we can't add a query string to force a URL because accept.js will reject it
* and we can't include it locally because they check in the script before loading more scripts
* So, we use the global version as "shim" would
*/
deferred.resolve(window.Accept);
deferred.resolve(accept);
$body.off('handshake.acceptjs');
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@
<click selector="{{StoreFrontRemoveItemModalSection.ok}}" stepKey="confirmDelete"/>
<waitForPageLoad stepKey="waitForDeleteToFinish"/>
</actionGroup>

<!--Check that the minicart is empty-->
<actionGroup name="assertMiniCartEmpty">
<dontSeeElement selector="{{StorefrontMinicartSection.productCount}}" stepKey="dontSeeMinicartProductCount"/>
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="expandMinicart"/>
<see selector="{{StorefrontMinicartSection.minicartContent}}" userInput="You have no items in your shopping cart." stepKey="seeEmptyCartMessage"/>
</actionGroup>
</actionGroups>
25 changes: 15 additions & 10 deletions app/code/Magento/Config/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,24 +520,29 @@ public function setDataByPath($path, $value)
if ($path === '') {
throw new \UnexpectedValueException('Path must not be empty');
}

$pathParts = explode('/', $path);
$keyDepth = count($pathParts);
if ($keyDepth !== 3) {
if ($keyDepth < 3) {
throw new \UnexpectedValueException(
"Allowed depth of configuration is 3 (<section>/<group>/<field>). Your configuration depth is "
. $keyDepth . " for path '$path'"
'Minimal depth of configuration is 3. Your configuration depth is ' . $keyDepth
);
}

$section = array_shift($pathParts);
$data = [
'section' => $pathParts[0],
'groups' => [
$pathParts[1] => [
'fields' => [
$pathParts[2] => ['value' => $value],
],
],
'fields' => [
array_pop($pathParts) => ['value' => $value],
],
];
while ($pathParts) {
$data = [
'groups' => [
array_pop($pathParts) => $data,
],
];
}
$data['section'] = $section;
$this->addData($data);
}

Expand Down
74 changes: 54 additions & 20 deletions app/code/Magento/Config/Test/Unit/Model/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,59 @@ public function testSaveToCheckScopeDataSet()
$this->model->save();
}

public function testSetDataByPath()
/**
* @param string $path
* @param string $value
* @param string $section
* @param array $groups
* @dataProvider setDataByPathDataProvider
*/
public function testSetDataByPath(string $path, string $value, string $section, array $groups)
{
$value = 'value';
$path = '<section>/<group>/<field>';
$this->model->setDataByPath($path, $value);
$expected = [
'section' => '<section>',
'groups' => [
'<group>' => [
'fields' => [
'<field>' => ['value' => $value],
$this->assertEquals($section, $this->model->getData('section'));
$this->assertEquals($groups, $this->model->getData('groups'));
}

/**
* @return array
*/
public function setDataByPathDataProvider(): array
{
return [
'depth 3' => [
'a/b/c',
'value1',
'a',
[
'b' => [
'fields' => [
'c' => ['value' => 'value1'],
],
],
],
],
'depth 5' => [
'a/b/c/d/e',
'value1',
'a',
[
'b' => [
'groups' => [
'c' => [
'groups' => [
'd' => [
'fields' => [
'e' => ['value' => 'value1'],
],
],
],
],
],
],
],
],
];
$this->assertSame($expected, $this->model->getData());
}

/**
Expand All @@ -359,14 +396,13 @@ public function testSetDataByPathEmpty()

/**
* @param string $path
* @param string $expectedException
*
* @dataProvider setDataByPathWrongDepthDataProvider
*/
public function testSetDataByPathWrongDepth($path, $expectedException)
public function testSetDataByPathWrongDepth(string $path)
{
$expectedException = 'Allowed depth of configuration is 3 (<section>/<group>/<field>). ' . $expectedException;
$this->expectException('\UnexpectedValueException');
$currentDepth = count(explode('/', $path));
$expectedException = 'Minimal depth of configuration is 3. Your configuration depth is ' . $currentDepth;
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessage($expectedException);
$value = 'value';
$this->model->setDataByPath($path, $value);
Expand All @@ -375,13 +411,11 @@ public function testSetDataByPathWrongDepth($path, $expectedException)
/**
* @return array
*/
public function setDataByPathWrongDepthDataProvider()
public function setDataByPathWrongDepthDataProvider(): array
{
return [
'depth 2' => ['section/group', "Your configuration depth is 2 for path 'section/group'"],
'depth 1' => ['section', "Your configuration depth is 1 for path 'section'"],
'depth 4' => ['section/group/field/sub-field', "Your configuration depth is 4 for path"
. " 'section/group/field/sub-field'", ],
'depth 2' => ['section/group'],
'depth 1' => ['section'],
];
}
}
30 changes: 0 additions & 30 deletions app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
type Mutation {
addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
}

type ConfigurableProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "ConfigurableProduct defines basic features of a configurable product and its simple product variants") {
variants: [ConfigurableVariant] @doc(description: "An array of variants of products") @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\ConfigurableVariant")
Expand Down Expand Up @@ -38,30 +35,3 @@ type ConfigurableProductOptionsValues @doc(description: "ConfigurableProductOpti
store_label: String @doc(description: "The label of the product on the current store")
use_default_value: Boolean @doc(description: "Indicates whether to use the default_label")
}

input AddConfigurableProductsToCartInput {
cart_id: String!
cartItems: [ConfigurableProductCartItemInput!]!
}

type AddConfigurableProductsToCartOutput {
cart: Cart!
}

input ConfigurableProductCartItemInput {
data: CartItemDetailsInput!
variant_sku: String!
customizable_options:[CustomizableOptionInput!]
}

type ConfigurableCartItem implements CartItemInterface {
customizable_options: [SelectedCustomizableOption]!
configurable_options: [SelectedConfigurableOption!]!
}

type SelectedConfigurableOption {
id: Int!
option_label: String!
value_id: Int!
value_label: String!
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="OpenPayPalButtonCheckoutPage">
<click selector="{{PayPalExpressCheckoutConfigSection.configureBtn}}" stepKey="clickPayPalConfigureBtn"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab}}" stepKey="waitForAdvancedSettingTab"/>
<click selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab}}" stepKey="openAdvancedSettingTab"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.frontendExperienceSettingsTab}}" stepKey="waitForFrontendExperienceSettingsTab"/>
<click selector="{{PayPalAdvancedSettingConfigSection.frontendExperienceSettingsTab}}" stepKey="openFrontendExperienceSettingsTab"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.checkoutPageTab}}" stepKey="waitForCheckoutPageTab"/>
<click selector="{{PayPalAdvancedSettingConfigSection.checkoutPageTab}}" stepKey="openCheckoutPageTab"/>
<arguments>
<argument name="countryCode" type="string" defaultValue="us"/>
</arguments>
<click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/>
<click selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="openAdvancedSettingTab"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.frontendExperienceSettingsTab(countryCode)}}" stepKey="waitForFrontendExperienceSettingsTab"/>
<click selector="{{PayPalAdvancedSettingConfigSection.frontendExperienceSettingsTab(countryCode)}}" stepKey="openFrontendExperienceSettingsTab"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.checkoutPageTab(countryCode)}}" stepKey="waitForCheckoutPageTab"/>
<click selector="{{PayPalAdvancedSettingConfigSection.checkoutPageTab(countryCode)}}" stepKey="openCheckoutPageTab"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="EnablePayPalConfiguration">
<arguments>
<argument name="payPalConfigType"/>
<argument name="countryCode" type="string" defaultValue="us"/>
</arguments>
<waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/>
<conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/>
<waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/>
<click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn"/>
<waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/>
<selectOption selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableWPSExpressSolution"/>
<seeInPopup userInput="There is already another PayPal solution enabled. Enable this solution instead?" stepKey="seeAlertMessage"/>
<acceptPopup stepKey="acceptEnablePopUp"/>
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
<waitForPageLoad stepKey="waitForPageLoad2"/>
</actionGroup>
<actionGroup name="CheckEnableOptionPayPalConfiguration">
<arguments>
<argument name="payPalConfigType"/>
<argument name="enabledOption" type="string"/>
<argument name="countryCode" type="string" defaultValue="us"/>
</arguments>
<waitForElementVisible selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" stepKey="waitForOtherPayPalPaymentsSection"/>
<conditionalClick selector="{{OtherPayPalPaymentsConfigSection.expandTab(countryCode)}}" dependentSelector="{{OtherPayPalPaymentsConfigSection.expandedTab(countryCode)}}" visible="false" stepKey="clickOtherPayPalPaymentsSection"/>
<waitForElementVisible selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="waitForWPSExpressConfigureBtn"/>
<click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn1"/>
<waitForElementVisible selector="{{payPalConfigType.enableSolution(countryCode)}}" stepKey="waitForWPSExpressEnable"/>
<seeOptionIsSelected selector="{{payPalConfigType.enableSolution(countryCode)}}" userInput="{{enabledOption}}" stepKey="seeSelectedOption"/>
<click selector="{{payPalConfigType.configureBtn(countryCode)}}" stepKey="clickWPSExpressConfigureBtn2"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="ConfigPayPalExpressCheckout">
<arguments>
<argument name="credentials" defaultValue="_CREDS"/>
<argument name="countryCode" type="string" defaultValue="us"/>
</arguments>
<amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
<click selector="{{PayPalExpressCheckoutConfigSection.configureBtn}}" stepKey="clickPayPalConfigureBtn"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab}}" stepKey="waitForAdvancedSettingTab"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.email}}" userInput="{{_CREDS.paypal_express_email}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/>
<selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.username}}" userInput="{{_CREDS.paypal_express_api_username}}" stepKey="inputAPIUsername"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.password}}" userInput="{{_CREDS.paypal_express_api_password}}" stepKey="inputAPIPassword"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.signature}}" userInput="{{_CREDS.paypal_express_api_signature}}" stepKey="inputAPISignature"/>
<selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode}}" userInput="Yes" stepKey="enableSandboxMode"/>
<selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution}}" userInput="Yes" stepKey="enableSolution"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID}}" userInput="{{_CREDS.paypal_express_merchantID}}" stepKey="inputMerchantID"/>
<click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/>
<waitForElementVisible selector="{{PayPalAdvancedSettingConfigSection.advancedSettingTab(countryCode)}}" stepKey="waitForAdvancedSettingTab"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.email(countryCode)}}" userInput="{{credentials.paypal_express_email}}" stepKey="inputEmailAssociatedWithPayPalMerchantAccount"/>
<selectOption selector ="{{PayPalExpressCheckoutConfigSection.apiMethod(countryCode)}}" userInput="API Signature" stepKey="inputAPIAuthenticationMethods"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.username(countryCode)}}" userInput="{{credentials.paypal_express_api_username}}" stepKey="inputAPIUsername"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.password(countryCode)}}" userInput="{{credentials.paypal_express_api_password}}" stepKey="inputAPIPassword"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.signature(countryCode)}}" userInput="{{credentials.paypal_express_api_signature}}" stepKey="inputAPISignature"/>
<selectOption selector ="{{PayPalExpressCheckoutConfigSection.sandboxMode(countryCode)}}" userInput="Yes" stepKey="enableSandboxMode"/>
<selectOption selector="{{PayPalExpressCheckoutConfigSection.enableSolution(countryCode)}}" userInput="Yes" stepKey="enableSolution"/>
<fillField selector ="{{PayPalExpressCheckoutConfigSection.merchantID(countryCode)}}" userInput="{{credentials.paypal_express_merchantID}}" stepKey="inputMerchantID"/>
<!--Save configuration-->
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
</actionGroup>
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Paypal/Test/Mftf/Data/PaypalData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<entity name="SampleUseProxy" type="use_proxy">
<data key="value">0</data>
</entity>
<entity name="SampleMerchantID" type="use_proxy">
<data key="value">someMerchantId</data>
</entity>

<!-- default configuration used to restore Magento config -->
<entity name="DefaultPayPalConfig" type="paypal_config_state">
Expand Down Expand Up @@ -89,4 +92,11 @@
<data key="silver">silver</data>
<data key="black">black</data>
</entity>
<entity name="SamplePaypalExpressConfig" type="paypal_express_config">
<data key="paypal_express_email">[email protected]</data>
<data key="paypal_express_api_username">myApiUsername.magento.com</data>
<data key="paypal_express_api_password">somePassword</data>
<data key="paypal_express_api_signature">someApiSignature</data>
<data key="paypal_express_merchantID">someMerchantId</data>
</entity>
</entities>
Loading

0 comments on commit 863e2bd

Please sign in to comment.