Skip to content

Instantly share code, notes, and snippets.

@mhauri
Last active November 18, 2017 14:51
Show Gist options
  • Save mhauri/11402dbd9b5f5cb2a71a173a1643bc81 to your computer and use it in GitHub Desktop.
Save mhauri/11402dbd9b5f5cb2a71a173a1643bc81 to your computer and use it in GitHub Desktop.
MFTF - AdminCreateSimpleProductCest.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<cest name="AdminCreateSimpleProductCest">
<annotations>
<features value="Product Creation"/>
<stories value="Create a Simple Product via Admin"/>
</annotations>
<before>
<!-- create a category to use with the test -->
</before>
<test name="CreateSimpleProductViaAdmin">
<annotations>
<title value="You should be able to create a Simple Product in the admin back-end."/>
<description value="You should be able to create a Simple Product in the admin back-end."/>
<severity value="CRITICAL"/>
<testCaseId value="MAGETWO-23414"/>
<group value="product"/>
<env value="chrome"/>
<env value="headless"/>
</annotations>
<!-- http://devdocs.magento.com/guides/v2.0/mtf/mtf_quickstart/mtf_quickstart_magento.html -->
<amOnPage mergeKey="navigateToLoginPage" url="/{{_ENV.MAGENTO_BACKEND_NAME}}" />
<fillField mergeKey="fillUsername" selector="{{AdminLoginFormSection.username}}" userInput="{{_ENV.MAGENTO_ADMIN_USERNAME}}" />
<fillField mergeKey="fillPassword" selector="{{AdminLoginFormSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" />
<click mergeKey="clickSubmitButton" selector="{{AdminLoginFormSection.signIn}}" />
<seeInCurrentUrl mergeKey="seeThatWeAreOnTheDashboard" url="/{{_ENV.MAGENTO_BACKEND_NAME}}/dashboard" />
<!-- go to the product index page -->
<amOnPage mergeKey="navigateToProductPage" url="/{{_ENV.MAGENTO_BACKEND_NAME}}/catalog/product/index" />
<wait time="30" mergeKey="wait"/>
<seeInCurrentUrl mergeKey="seeThatWeAreOnTheProductPage" url="/{{_ENV.MAGENTO_BACKEND_NAME}}/catalog/product"/>
<!-- click on the add product toggle -->
<click mergeKey="clickAddProductToggleButton" selector="{{AdminProductGridActionSection.addProductToggle}}" />
<!-- click on add simple product -->
<click mergeKey="clickAddSimpleProductButton" selector="{{AdminProductGridActionSection.addSimpleProduct}}" />
<!-- fill in product name, sku, price, quantity -->
<fillField mergeKey="productName" selector="{{AdminProductFormSection.productName}}" userInput="Test Product" />
<fillField mergeKey="productSku" selector="{{AdminProductFormSection.productSku}}" userInput="test" />
<fillField mergeKey="productPrice" selector="{{AdminProductFormSection.productPrice}}" userInput="10" />
<fillField mergeKey="productQuantity" selector="{{AdminProductFormSection.productQuantity}}" userInput="100" />
<!-- select created cateogry name from dropdown -->
<!-- open seo section -->
<!-- fill product url key -->
<!-- click save button -->
<!-- validate save message and product information -->
<!-- Optional, Go to storefront category page, assert product visibility -->
<!-- Optional, Go to storefront product page, assert product visibility -->
</test>
<after>
<!-- delete created category -->
</after>
</cest>
</config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment