StorefrontSalesRuleActionGroup.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. <!-- Apply Sales Rule Coupon to the cart -->
  11. <actionGroup name="StorefrontApplyCouponActionGroup">
  12. <arguments>
  13. <argument name="coupon"/>
  14. </arguments>
  15. <waitForElement selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" time="30" stepKey="waitForCouponHeader" />
  16. <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader" />
  17. <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField" />
  18. <fillField userInput="{{coupon.code}}" selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="fillCouponField"/>
  19. <click selector="{{StorefrontSalesRuleCartCouponSection.applyButton}}" stepKey="clickApplyButton"/>
  20. <waitForPageLoad stepKey="waitForPageLoad"/>
  21. </actionGroup>
  22. <!-- Cancel Sales Rule Coupon applied to the cart -->
  23. <actionGroup name="StorefrontCancelCouponActionGroup">
  24. <waitForElement selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" time="30" stepKey="waitForCouponHeader" />
  25. <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader" />
  26. <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField" />
  27. <click selector="{{StorefrontSalesRuleCartCouponSection.cancelButton}}" stepKey="clickCancelButton"/>
  28. </actionGroup>
  29. <!-- Check applied discount in cart summary -->
  30. <actionGroup name="StorefrontCheckCouponAppliedActionGroup">
  31. <arguments>
  32. <argument name="rule" />
  33. <argument name="discount" type="string" />
  34. </arguments>
  35. <waitForElementVisible selector="{{CheckoutCartSummarySection.discountTotal}}" stepKey="waitForDiscountTotal"/>
  36. <see userInput="{{rule.store_labels[1][store_label]}}" selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="assertDiscountLabel"/>
  37. <see userInput="-${{discount}}" selector="{{CheckoutCartSummarySection.discountTotal}}" stepKey="assertDiscountTotal"/>
  38. </actionGroup>
  39. <actionGroup name="VerifyDiscountAmount">
  40. <arguments>
  41. <argument name="productUrl" type="string"/>
  42. <argument name="quantity" type="string"/>
  43. <argument name="expectedDiscount" type="string"/>
  44. </arguments>
  45. <amOnPage url="{{productUrl}}" stepKey="goToProductPage"/>
  46. <waitForPageLoad stepKey="waitForProductPageLoad"/>
  47. <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/>
  48. <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/>
  49. <waitForPageLoad stepKey="waitForAddToCart"/>
  50. <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/>
  51. <waitForPageLoad stepKey="waitForCartPage"/>
  52. <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
  53. <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="{{expectedDiscount}}" stepKey="seeDiscountTotal"/>
  54. </actionGroup>
  55. </actionGroups>