Skip to content

Commit 3dc8a07

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MPI-PR-2019-10-31
2 parents 1bd7bf3 + 67f525d commit 3dc8a07

File tree

76 files changed

+2367
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2367
-91
lines changed

app/code/Magento/Analytics/Test/Mftf/Data/UserRoleData.xml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="adminNoReportRole" type="user_role">
12+
<data key="all">0</data>
1213
<data key="rolename" unique="suffix">noreport</data>
1314
<data key="current_password">123123q</data>
1415
<array key="resource">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminUserIsInGridActionGroup">
12+
<arguments>
13+
<argument name="user" type="entity"/>
14+
</arguments>
15+
<click selector="{{AdminUserGridSection.resetButton}}" stepKey="resetGridFilter"/>
16+
<waitForPageLoad stepKey="waitForFiltersReset" time="15"/>
17+
<fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/>
18+
<click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch"/>
19+
<waitForPageLoad stepKey="waitForGridToLoad" time="15"/>
20+
<see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{user.username}}" stepKey="seeUser"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertUserRoleRestrictedAccessActionGroup">
12+
<see selector="{{AdminHeaderSection.pageHeading}}" userInput="Sorry, you need permissions to view this content." stepKey="seeErrorMessage"/>
13+
</actionGroup>
14+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Data/CookieConfigData.xml

+16
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,20 @@
2020
<data key="scope_code">base</data>
2121
<data key="value">''</data>
2222
</entity>
23+
<entity name="ChangeWebCookieLifetimeConfigData">
24+
<data key="path">web/cookie/cookie_lifetime</data>
25+
<data key="value">60</data>
26+
</entity>
27+
<entity name="DefaultWebCookieLifetimeConfigData">
28+
<data key="path">web/cookie/cookie_lifetime</data>
29+
<data key="value">3600</data>
30+
</entity>
31+
<entity name="ChangeAdminSecuritySessionLifetimeConfigData">
32+
<data key="path">admin/security/session_lifetime</data>
33+
<data key="value">60</data>
34+
</entity>
35+
<entity name="DefaultAdminSecuritySessionLifetimeConfigData">
36+
<data key="path">admin/security/session_lifetime</data>
37+
<data key="value">7200</data>
38+
</entity>
2339
</entities>

app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<element name="password" type="input" selector="#login"/>
1414
<element name="signIn" type="button" selector=".actions .action-primary" timeout="30"/>
1515
<element name="forgotPasswordLink" type="button" selector=".action-forgotpassword" timeout="10"/>
16+
<element name="loginBlock" type="block" selector=".adminhtml-auth-login"/>
1617
</section>
1718
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminExpireAdminSessionTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Admin Session Expire"/>
15+
<title value="Admin Session Expire"/>
16+
<description value="Admin Session Expire"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-14111"/>
19+
<group value="Backend"/>
20+
<group value="mtf_migrated"/>
21+
</annotations>
22+
<after>
23+
<!-- 4. Restore default configuration settings. -->
24+
<magentoCLI command="config:set {{DefaultAdminSecuritySessionLifetimeConfigData.path}} {{DefaultAdminSecuritySessionLifetimeConfigData.value}}" stepKey="setDefaultSessionLifetime"/>
25+
</after>
26+
<!-- 1. Apply configuration settings. -->
27+
<magentoCLI command="config:set {{ChangeAdminSecuritySessionLifetimeConfigData.path}} {{ChangeAdminSecuritySessionLifetimeConfigData.value}}" stepKey="changeCookieLifetime"/>
28+
29+
<!-- 2. Wait for session to expire. -->
30+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
31+
<wait time="60" stepKey="waitForSessionLifetime"/>
32+
<reloadPage stepKey="reloadPage"/>
33+
34+
<!-- 3. Perform asserts. -->
35+
<seeElement selector="{{AdminLoginFormSection.loginBlock}}" stepKey="assertAdminLoginPageIsAvailable"/>
36+
</test>
37+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminExpireCustomerSessionTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Customer Session Expire"/>
15+
<title value="Customer Session Expireon"/>
16+
<description value="Customer Session Expire"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-14110"/>
19+
<group value="Backend"/>
20+
<group value="mtf_migrated"/>
21+
</annotations>
22+
<after>
23+
<!-- 6. Restore default configuration settings. -->
24+
<magentoCLI command="config:set {{DefaultWebCookieLifetimeConfigData.path}} {{DefaultWebCookieLifetimeConfigData.value}}" stepKey="setDefaultCookieLifetime"/>
25+
<!-- Delete data -->
26+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
27+
<actionGroup ref="logout" stepKey="logout"/>
28+
</after>
29+
<!-- 1. Login to Admin. -->
30+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
31+
32+
<!-- 2. Create customer if needed. -->
33+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
34+
35+
<!-- 3. Apply configuration settings. -->
36+
<magentoCLI command="config:set {{ChangeWebCookieLifetimeConfigData.path}} {{ChangeWebCookieLifetimeConfigData.value}}" stepKey="changeCookieLifetime"/>
37+
38+
<!-- 4. Wait for session to expire. -->
39+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
40+
<argument name="Customer" value="$$createCustomer$$" />
41+
</actionGroup>
42+
<wait time="60" stepKey="waitForCookieLifetime"/>
43+
<reloadPage stepKey="reloadPage"/>
44+
45+
<!-- 5. Perform asserts. -->
46+
<seeElement selector="{{StorefrontPanelHeaderSection.customerLoginLink}}" stepKey="assertAuthorizationLinkIsVisibleOnStoreFront"/>
47+
</test>
48+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertAdminProductStockStatusActionGroup">
11+
<arguments>
12+
<argument name="productId" type="string"/>
13+
<argument name="stockStatus" type="string"/>
14+
</arguments>
15+
<amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="goToProductEditPage"/>
16+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
17+
<seeOptionIsSelected selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{stockStatus}}"
18+
stepKey="checkProductStatus"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<data key="name">Pursuit Lumaflex&#38;trade; Tone Band</data>
4040
<data key="sku" unique="suffix">x&#38;trade;</data>
4141
</entity>
42+
<entity name="SimpleProduct_25" type="product" extends="SimpleProduct2">
43+
<data key="quantity">25</data>
44+
<requiredEntity type="product_extension_attribute">EavStock25</requiredEntity>
45+
</entity>
4246
<entity name="ApiSimpleProductWithCustomPrice" type="product" extends="ApiSimpleProduct">
4347
<data key="price">100</data>
4448
</entity>

app/code/Magento/Catalog/Test/Mftf/Data/ProductExtensionAttributeData.xml

+3
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@
2626
<entity name="EavStock777" type="product_extension_attribute">
2727
<requiredEntity type="stock_item">Qty_777</requiredEntity>
2828
</entity>
29+
<entity name="EavStock25" type="product_extension_attribute">
30+
<requiredEntity type="stock_item">Qty_25</requiredEntity>
31+
</entity>
2932
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/StockItemData.xml

+4
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@
4040
<data key="qty">777</data>
4141
<data key="is_in_stock">true</data>
4242
</entity>
43+
<entity name="Qty_25" type="stock_item">
44+
<data key="qty">25</data>
45+
<data key="is_in_stock">true</data>
46+
</entity>
4347
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogGraphQl\Model\Resolver\Category;
9+
10+
use Magento\Catalog\Model\Category;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\GraphQl\Config\Element\Field;
13+
use Magento\Framework\GraphQl\Query\ResolverInterface;
14+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Store\Api\Data\StoreInterface;
16+
use Magento\Catalog\Helper\Category as CategoryHelper;
17+
18+
/**
19+
* Resolve data for category canonical URL
20+
*/
21+
class CanonicalUrl implements ResolverInterface
22+
{
23+
/** @var CategoryHelper */
24+
private $categoryHelper;
25+
26+
/**
27+
* CanonicalUrl constructor.
28+
* @param CategoryHelper $categoryHelper
29+
*/
30+
public function __construct(CategoryHelper $categoryHelper)
31+
{
32+
$this->categoryHelper = $categoryHelper;
33+
}
34+
35+
/**
36+
* @inheritdoc
37+
*/
38+
public function resolve(
39+
Field $field,
40+
$context,
41+
ResolveInfo $info,
42+
array $value = null,
43+
array $args = null
44+
) {
45+
if (!isset($value['model'])) {
46+
throw new LocalizedException(__('"model" value should be specified'));
47+
}
48+
49+
/* @var Category $category */
50+
$category = $value['model'];
51+
/** @var StoreInterface $store */
52+
$store = $context->getExtensionAttributes()->getStore();
53+
if ($this->categoryHelper->canUseCanonicalTag($store)) {
54+
$baseUrl = $category->getUrlInstance()->getBaseUrl();
55+
return str_replace($baseUrl, '', $category->getUrl());
56+
}
57+
return null;
58+
}
59+
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CanonicalUrl.php

+21-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@
1212
use Magento\Framework\GraphQl\Config\Element\Field;
1313
use Magento\Framework\GraphQl\Query\ResolverInterface;
1414
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Catalog\Helper\Product as ProductHelper;
16+
use Magento\Store\Api\Data\StoreInterface;
1517

1618
/**
1719
* Resolve data for product canonical URL
1820
*/
1921
class CanonicalUrl implements ResolverInterface
2022
{
23+
/** @var ProductHelper */
24+
private $productHelper;
25+
26+
/**
27+
* @param Product $productHelper
28+
*/
29+
public function __construct(ProductHelper $productHelper)
30+
{
31+
$this->productHelper = $productHelper;
32+
}
33+
2134
/**
2235
* @inheritdoc
2336
*/
@@ -32,10 +45,14 @@ public function resolve(
3245
throw new LocalizedException(__('"model" value should be specified'));
3346
}
3447

35-
/* @var $product Product */
48+
/* @var Product $product */
3649
$product = $value['model'];
37-
$url = $product->getUrlModel()->getUrl($product, ['_ignore_category' => true]);
38-
39-
return $url;
50+
/** @var StoreInterface $store */
51+
$store = $context->getExtensionAttributes()->getStore();
52+
if ($this->productHelper->canUseCanonicalTag($store)) {
53+
$product->getUrlModel()->getUrl($product, ['_ignore_category' => true]);
54+
return $product->getRequestPath();
55+
}
56+
return null;
4057
}
4158
}

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
109109
gift_message_available: String @doc(description: "Indicates whether a gift message is available.")
110110
manufacturer: Int @doc(description: "A number representing the product's manufacturer.")
111111
categories: [CategoryInterface] @doc(description: "The categories assigned to a product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Categories") @cache(cacheIdentity: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\CategoriesIdentity")
112-
canonical_url: String @doc(description: "Canonical URL.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\CanonicalUrl")
112+
canonical_url: String @doc(description: "Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Products' is enabled") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\CanonicalUrl")
113113
media_gallery: [MediaGalleryInterface] @doc(description: "An array of Media Gallery objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery")
114114
}
115115

@@ -223,6 +223,7 @@ interface CategoryInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model
223223
path_in_store: String @doc(description: "Category path in store.")
224224
url_key: String @doc(description: "The url key assigned to the category.")
225225
url_path: String @doc(description: "The url path assigned to the category.")
226+
canonical_url: String @doc(description: "Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Categories' is enabled") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\CanonicalUrl")
226227
position: Int @doc(description: "The position of the category relative to other categories at the same level in tree.")
227228
level: Int @doc(description: "Indicates the depth of the category within the tree.")
228229
created_at: String @doc(description: "Timestamp indicating when the category was created.")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminOpenCmsPageActionGroup">
11+
<arguments>
12+
<argument name="page_id" type="string"/>
13+
</arguments>
14+
<amOnPage url="{{AdminCmsPageEditPage.url(page_id)}}" stepKey="openEditCmsPage"/>
15+
</actionGroup>
16+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
10+
<page name="AdminCmsPageEditPage" area="admin" url="/cms/page/edit/page_id/{{id}}" parameterized="true" module="Magento_Cms">
11+
<section name="CmsNewPagePageActionsSection"/>
12+
<section name="CmsNewPagePageBasicFieldsSection"/>
13+
<section name="CmsNewPagePageContentSection"/>
14+
<section name="CmsNewPagePageSeoSection"/>
15+
</page>
16+
</pages>

app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Block.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getData(string $blockIdentifier): array
5656
);
5757
}
5858

59-
$renderedContent = $this->widgetFilter->filter($block->getContent());
59+
$renderedContent = $this->widgetFilter->filterDirective($block->getContent());
6060

6161
$blockData = [
6262
BlockInterface::BLOCK_ID => $block->getId(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontCustomerReorderButtonNotVisibleActionGroup">
11+
<dontSeeElement selector="{{StorefrontCustomerOrderViewSection.reorder}}" stepKey="assertNotVisibleElement"/>
12+
</actionGroup>
13+
</actionGroups>

0 commit comments

Comments
 (0)