|
| 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="VerifyDisableDownloadableProductSamplesAreNotAccessibleTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Downloadable"/> |
| 14 | + <stories value="Downloadable product"/> |
| 15 | + <title value="Samples of Downloadable Products are not accessible, if product is disabled"/> |
| 16 | + <description value="Samples of Downloadable Products are not accessible, if product is disabled"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-15845"/> |
| 19 | + <useCaseId value="MC-14824"/> |
| 20 | + <group value="downloadable"/> |
| 21 | + <group value="catalog"/> |
| 22 | + </annotations> |
| 23 | + <before> |
| 24 | + <!-- Create category --> |
| 25 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 26 | + |
| 27 | + <!-- Create downloadable product --> |
| 28 | + <createData entity="DownloadableProductWithOneLink" stepKey="createProduct"> |
| 29 | + <requiredEntity createDataKey="createCategory"/> |
| 30 | + </createData> |
| 31 | + |
| 32 | + <!-- Add downloadable link --> |
| 33 | + <createData entity="downloadableLink1" stepKey="addDownloadableLink"> |
| 34 | + <requiredEntity createDataKey="createProduct"/> |
| 35 | + </createData> |
| 36 | + |
| 37 | + <!-- Add downloadable sample --> |
| 38 | + <createData entity="DownloadableSample" stepKey="addDownloadableSample"> |
| 39 | + <requiredEntity createDataKey="createProduct"/> |
| 40 | + </createData> |
| 41 | + </before> |
| 42 | + <after> |
| 43 | + <!-- Delete product --> |
| 44 | + <deleteData createDataKey="createProduct" stepKey="deleteDownloadableProduct"/> |
| 45 | + |
| 46 | + <!-- Delete category --> |
| 47 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 48 | + |
| 49 | + <!-- Admin logout --> |
| 50 | + <actionGroup ref="logout" stepKey="adminLogout"/> |
| 51 | + </after> |
| 52 | + |
| 53 | + <!-- Open Downloadable product from precondition on Storefront --> |
| 54 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> |
| 55 | + <argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/> |
| 56 | + </actionGroup> |
| 57 | + |
| 58 | + <!-- Sample url is accessible --> |
| 59 | + <actionGroup ref="AssertStorefrontSeeElementActionGroup" stepKey="seeDownloadableSample"> |
| 60 | + <argument name="selector" value="{{StorefrontDownloadableProductSection.downloadableSampleLabel(DownloadableSample.title)}}"/> |
| 61 | + </actionGroup> |
| 62 | + <click selector="{{StorefrontDownloadableProductSection.downloadableSampleLabel(DownloadableSample.title)}}" stepKey="clickDownloadableSample"/> |
| 63 | + |
| 64 | + <!-- Grab Sample id --> |
| 65 | + <switchToNextTab stepKey="switchToSampleTab"/> |
| 66 | + <grabFromCurrentUrl regex="~/sample_id/(\d+)/~" stepKey="grabDownloadableSampleId"/> |
| 67 | + <closeTab stepKey="closeSampleTab"/> |
| 68 | + |
| 69 | + <!-- Link Sample url is accessible --> |
| 70 | + <actionGroup ref="AssertStorefrontSeeElementActionGroup" stepKey="seeDownloadableLink"> |
| 71 | + <argument name="selector" value="{{StorefrontDownloadableProductSection.downloadableLinkLabel(downloadableLink1.title)}}"/> |
| 72 | + </actionGroup> |
| 73 | + <click selector="{{StorefrontDownloadableProductSection.downloadableLinkSampleByTitle(downloadableLink1.title)}}" stepKey="clickDownloadableLinkSample"/> |
| 74 | + |
| 75 | + <!-- Grab Link Sample id --> |
| 76 | + <switchToNextTab stepKey="switchToLinkSampleTab"/> |
| 77 | + <grabFromCurrentUrl regex="~/link_id/(\d+)/~" stepKey="grabDownloadableLinkId"/> |
| 78 | + <closeTab stepKey="closeLinkSampleTab"/> |
| 79 | + |
| 80 | + <!-- Login as admin --> |
| 81 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 82 | + |
| 83 | + <!-- Open Downloadable product from precondition --> |
| 84 | + <actionGroup ref="goToProductPageViaID" stepKey="openProductEditPage"> |
| 85 | + <argument name="productId" value="$createProduct.id$"/> |
| 86 | + </actionGroup> |
| 87 | + |
| 88 | + <!-- Change status of product to "Disable" and save it --> |
| 89 | + <actionGroup ref="AdminSetProductDisabled" stepKey="disableProduct"/> |
| 90 | + <actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/> |
| 91 | + |
| 92 | + <!-- Assert product is disable on Storefront --> |
| 93 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openProductPage"> |
| 94 | + <argument name="category" value="$createCategory$"/> |
| 95 | + </actionGroup> |
| 96 | + <see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/> |
| 97 | + |
| 98 | + <!-- Navigate to Link Sample url on Storefront --> |
| 99 | + <actionGroup ref="StorefrontOpenDownloadableLinkActionGroup" stepKey="openDownloadableLinkSample"> |
| 100 | + <argument name="linkId" value="{$grabDownloadableLinkId}"/> |
| 101 | + </actionGroup> |
| 102 | + |
| 103 | + <!-- Link Sample url is not accessible. You are redirected to Home Page --> |
| 104 | + <seeInCurrentUrl url="{{StorefrontHomePage.url}}" stepKey="seeRedirectToHomePage"/> |
| 105 | + |
| 106 | + <!-- Navigate to Sample url on Storefront --> |
| 107 | + <actionGroup ref="StorefrontOpenDownloadableSampleActionGroup" stepKey="openDownloadableSample"> |
| 108 | + <argument name="sampleId" value="{$grabDownloadableSampleId}"/> |
| 109 | + </actionGroup> |
| 110 | + |
| 111 | + <!-- Sample url is not accessible. You are redirected to Home Page --> |
| 112 | + <seeInCurrentUrl url="{{StorefrontHomePage.url}}" stepKey="seeHomePage"/> |
| 113 | + </test> |
| 114 | +</tests> |
0 commit comments