Skip to content

Commit 78a9a73

Browse files
committed
MAGETWO-91559: Static blocks with same ID appear in place of correct block
- Add automated test
1 parent 1f743bd commit 78a9a73

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
9+
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1010
<actionGroup name="navigateToCreatedCMSPage">
1111
<arguments>
1212
<argument name="CMSPage" defaultValue=""/>
@@ -44,4 +44,14 @@
4444
<waitForPageLoad stepKey="waitForPageLoad3"/>
4545
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection" />
4646
</actionGroup>
47+
<actionGroup name="DeleteCMSBlockActionGroup">
48+
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSPagesGrid"/>
49+
<waitForPageLoad stepKey="waitForPageLoad"/>
50+
<click selector="{{CmsPagesPageActionsSection.select(_defaultBlock.title)}}" stepKey="ClickOnSelect"/>
51+
<click selector="{{CmsPagesPageActionsSection.delete(_defaultBlock.title)}}" stepKey="ClickOnEdit"/>
52+
<waitForPageLoad stepKey="waitForPageLoad3"/>
53+
<click selector="{{CmsPagesPageActionsSection.deleteConfirm}}" stepKey="ClickToConfirm"/>
54+
<waitForPageLoad stepKey="waitForPageLoad4"/>
55+
<see userInput="You deleted the block." stepKey="VerifyBlockIsDeleted"/>
56+
</actionGroup>
4757
</actionGroups>

app/code/Magento/Cms/Test/Mftf/Section/CmsNewBlockBlockActionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<element name="saveAndDuplicate" type="button" selector="#save_and_duplicate" timeout="10"/>
1818
<element name="saveAndClose" type="button" selector="#save_and_close" timeout="10"/>
1919
<element name="expandSplitButton" type="button" selector="//button[@data-ui-id='save-button-dropdown']" timeout="10"/>
20+
<element name="back" type="button" selector="#back"/>
2021
</section>
2122
<section name="BlockWYSIWYGSection">
2223
<element name="ShowHideBtn" type="button" selector="#togglecms_block_form_content"/>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="CheckStaticBlocksTest">
12+
<annotations>
13+
<features value="Cms"/>
14+
<stories value="MAGETWO-91559 - Static blocks with same ID appear in place of correct block"/>
15+
<title value="Check static blocks: ID should be unique per Store View"/>
16+
<description value="Check static blocks: ID should be unique per Store View"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-94229"/>
19+
<group value="Cms"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
23+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="AdminCreateWebsite">
24+
<argument name="newWebsiteName" value="secondWebsite"/>
25+
<argument name="websiteCode" value="second_website"/>
26+
</actionGroup>
27+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="AdminCreateStore">
28+
<argument name="website" value="secondWebsite"/>
29+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
30+
<argument name="storeGroupCode" value="{{customStoreGroup.code}}"/>
31+
</actionGroup>
32+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="AdminCreateStoreView">
33+
<argument name="StoreGroup" value="customStoreGroup"/>
34+
<argument name="customStore" value="customStore"/>
35+
</actionGroup>
36+
</before>
37+
38+
<!--Go to Cms blocks page-->
39+
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSPagesGrid"/>
40+
<waitForPageLoad stepKey="waitForPageLoad1"/>
41+
<seeInCurrentUrl url="cms/block/" stepKey="VerifyPageIsOpened"/>
42+
<!--Click to create new block-->
43+
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock"/>
44+
<waitForPageLoad stepKey="waitForPageLoad2"/>
45+
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened"/>
46+
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/>
47+
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock"/>
48+
<waitForPageLoad stepKey="waitForPageLoad3"/>
49+
<see userInput="You saved the block." stepKey="VerifyBlockIsSaved"/>
50+
<!--Click to go back and add new block-->
51+
<click selector="{{BlockNewPagePageActionsSection.back}}" stepKey="ClickToGoBack"/>
52+
<waitForPageLoad stepKey="waitForPageLoad4"/>
53+
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock1"/>
54+
<waitForPageLoad stepKey="waitForPageLoad5"/>
55+
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened1"/>
56+
<!--Add new BLock with the same data-->
57+
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent1"/>
58+
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="Default Store View" stepKey="selectDefaultStoreView" />
59+
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="{{customStore.name}}" stepKey="selectSecondStoreView1" />
60+
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock1"/>
61+
<waitForPageLoad stepKey="waitForPageLoad6"/>
62+
<!--Verify that corresponding message is displayed-->
63+
<see userInput="A block identifier with the same properties already exists in the selected store." stepKey="VerifyBlockIsSaved1"/>
64+
65+
<after>
66+
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="DeleteCMSBlockActionGroup"/>
67+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite">
68+
<argument name="websiteName" value="secondWebsite"/>
69+
</actionGroup>
70+
</after>
71+
</test>
72+
</tests>

0 commit comments

Comments
 (0)