oro_behat_extension:
  suites:
    OroPromotionBundle:
      contexts:
        - Oro\Bundle\TestFrameworkBundle\Tests\Behat\Context\OroMainContext
        - Oro\Bundle\CheckoutBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\ConfigBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\ShoppingListBundle\Tests\Behat\Context\ShoppingListContext
        - Oro\Bundle\DataGridBundle\Tests\Behat\Context\GridContext
        - Oro\Bundle\FormBundle\Tests\Behat\Context\FormContext
        - Oro\Bundle\PromotionBundle\Tests\Behat\Context\PromotionContext
        - Oro\Bundle\EmailBundle\Tests\Behat\Context\EmailContext
        - Oro\Bundle\ApplicationBundle\Tests\Behat\Context\CommerceMainContext
        - Oro\Bundle\ActivityListBundle\Tests\Behat\Context\ActivityContext
        - Oro\Bundle\CustomerBundle\Tests\Behat\Context\FrontendGridContext
        - Oro\Bundle\QueryDesignerBundle\Tests\Behat\Context\QueryDesignerContext
        - Oro\Bundle\FilterBundle\Tests\Behat\Context\FilterContext
        - Oro\Bundle\OrderBundle\Tests\Behat\Context\OrderContext
        - Oro\Bundle\ShippingBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\ShoppingListBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\WorkflowBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\SearchBundle\Tests\Behat\Context\SearchContext
        - Oro\Bundle\ImportExportBundle\Tests\Behat\Context\ImportExportContext
        - Oro\Bundle\SecurityBundle\Tests\Behat\Context\ACLContext
        - Oro\Bundle\UserBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\PayPalBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\PaymentBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\ProductBundle\Tests\Behat\Context\FeatureContext
        - Oro\Bundle\AttachmentBundle\Tests\Behat\Context\AttachmentImageContext
        - Oro\Bundle\ProductBundle\Tests\Behat\Context\QuickOrderFormContext
      paths:
        - '@OroPromotionBundle/Tests/Behat/Features'

  pages:
    All Coupons:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Page\AllCoupons
      route: 'oro_promotion_coupon_index'
    Promotion Create:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Page\PromotionCreate
      route: 'oro_promotion_create'
    Promotion Edit:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Page\PromotionEdit
      route: 'oro_promotion_update'
    Promotion View:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Page\PromotionView
      route: 'oro_promotion_view'

  elements:
    Promotion Form:
      selector: 'form[name="oro_promotion"]'
      class: Oro\Bundle\TestFrameworkBundle\Behat\Element\Form
      options:
        mapping:
          Name: 'oro_promotion[rule][name]'
          Discount Value: 'oro_promotion[discountConfiguration][options][amount_discount_value][value]'
          Discount Value (%): 'oro_promotion[discountConfiguration][options][percent_discount_value]'
          Activate At (first):
            type: 'css'
            locator: '.schedule-intervals [name$="[activeAt]"]:first-child'
          Deactivate At (first):
            type: 'css'
            locator: '.schedule-intervals [name$="[deactivateAt]"]:first-child'
          Storefront Labels: 'oro_promotion[labels][values][default]'
          Discount: 'oro_promotion[discountConfiguration][type]'
          Type: 'oro_promotion[discountConfiguration][options][discount_type]'
          Currency: 'oro_promotion[discountConfiguration][options][amount_discount_value][currency]'
          Unit Of Quantity: 'oro_promotion[discountConfiguration][options][discount_product_unit_code]'
          Expression: 'oro_promotion[rule][expression]'

    Coupon Form:
      selector: 'form[name="oro_promotion_coupon_type"]'
      class: Oro\Bundle\TestFrameworkBundle\Behat\Element\Form
      options:
        mapping:
          Coupon Code: 'oro_promotion_coupon_type[code]'
          Promotion:
            type: 'xpath'
            locator: '//div[contains(@id,"s2id_oro_promotion_coupon_type_promotion-uid")]//input'
          Enabled: 'oro_promotion_coupon_type[enabled]'
          Uses per Coupon: 'oro_promotion_coupon_type[usesPerCoupon]'
          Uses Per Person: 'oro_promotion_coupon_type[usesPerPerson]'
          Valid From: 'oro_promotion_coupon_type[validFrom]'
          Valid Until: 'oro_promotion_coupon_type[validUntil]'

    Generate Multiple Coupons Form:
      selector: 'form[name="oro_action_operation"]'
      class: Oro\Bundle\TestFrameworkBundle\Behat\Element\Form
      options:
        mapping:
          Promotion:
            type: 'xpath'
            locator: '//div[contains(@id,"s2id_oro_action_operation_couponGenerationOptions_promotion-uid")]//input'
          Valid From: "oro_action_operation[couponGenerationOptions][validFrom]"
          Valid Until: "oro_action_operation[couponGenerationOptions][validUntil]"

    Mass Coupon Edit Form:
      selector: 'form[name="oro_promotion_base_coupon_type"]'
      class: Oro\Bundle\TestFrameworkBundle\Behat\Element\Form
      options:
        mapping:
          Valid From: 'oro_promotion_base_coupon_type[validFrom]'
          Valid Until: 'oro_promotion_base_coupon_type[validUntil]'

    PromotionBackendOrder:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionBackendOrder
      selector: 'div.layout-content'

    PromotionBackendOrderLineItem:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionBackendOrderLineItem
      selector: 'tbody > tr.order-line-item'

    PromotionBackendLineItemDiscountTable:
      class: Oro\Bundle\TestFrameworkBundle\Behat\Element\Table
      selector: 'table.applied_discounts-result-grid'

    PromotionCheckoutStep:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionCheckoutStep
      selector: 'div.checkout__content-main'

    PromotionCheckoutStepLineItem:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionCheckoutStepLineItem
      selector: 'tbody.grid-body tr.grid-row'

    PromotionOrder:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionOrder
      selector: '.page-content'

    PromotionOrderLineItem:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionOrderLineItem
      selector: 'tr.grid-row'

    PromotionShoppingList:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionShoppingList
      selector: '.page-content'

    PromotionShoppingListLineItem:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionShoppingListLineItem
      selector: '.grid-row'

    PromotionOrderForm:
      class: Oro\Bundle\PromotionBundle\Tests\Behat\Element\PromotionOrderForm
      selector: "form[name='oro_order_type']"
      options:
        mapping:
          SKU1ProductQuantity: oro_order_type[lineItems][0][quantity]
          SKU2ProductQuantity: oro_order_type[lineItems][1][quantity]

    CouponCodePreview:
      selector: 'div#coupon-code-preview'

    Promotions Grid Button:
      selector: '.entity-select-btn'

    Assigned Coupons Grid:
      selector: 'div[data-page-component-name="promotion-coupons-assigned-to-promotion-grid"]'
      class: Oro\Bundle\DataGridBundle\Tests\Behat\Element\Grid

    Export Grid:
      selector:
        locator: '//div[contains(@id,"grid-promotion-coupons-assigned-to-promotion-grid")]//a/../../../../div[@class="extra-actions-panel"]'
        type: xpath

    CSV:
      selector:
        locator: '//div[contains(@id,"grid-promotion-coupons-assigned-to-promotion-grid")]//a[@title="CSV"]'
        type: xpath

    Promotions:
      class: Oro\Bundle\OrderBundle\Tests\Behat\Element\CollectionTable
      selector: 'div.oro-promotions-collection > table'

    Added Coupons:
      class: Oro\Bundle\TestFrameworkBundle\Behat\Element\Table
      selector: 'div.added-coupons-container table'

    Coupons Selection Button:
      selector: '.coupon-select .entity-select-btn'

    Coupons Selection:
      selector: 'div.ui-dialog div.oro-datagrid'
      class: Oro\Bundle\DataGridBundle\Tests\Behat\Element\Grid

    Close Coupons Selection:
      selector:
        type: xpath
        locator: '//span[@class="ui-dialog-title" and .//*[contains(text(), "Select Coupon Code")]]/following-sibling::div[@class="ui-dialog-titlebar-buttonpane"]/button[contains(@class,"ui-dialog-titlebar-close")]'

    Highlighted Suggestion:
      selector: '.select2-highlighted'

    Product:
      selector: '.order-line-item-type-product .select2-offscreen'
      class: Oro\Bundle\FormBundle\Tests\Behat\Element\Select2Entity

    Quantity:
      selector: '[data-name="field__quantity"]'

    Coupon Validation Error:
        selector: '.select-coupon-validation-container'

    Close Line Item Discount Promotion Details:
      selector:
        type: xpath
        locator: '//span[@class="ui-dialog-title" and .//*[contains(text(), "Line Item Discount Promotion")]]/following-sibling::div[@class="ui-dialog-titlebar-buttonpane"]/button[contains(@class,"ui-dialog-titlebar-close")]'

    CouponCodeInput:
      selector: 'input[data-role="coupon-code"]'

    IHaveACouponCode:
      selector: 'button[data-role="coupon-trigger"]:contains("I have a Coupon Code")'

    CouponsList:
      selector: 'ul.coupons-list'

    Coupon Delete Button:
      selector: 'button[data-role="remove-coupon"]'

    Fifth Promotion Change Active Button:
      selector: 'tr[data-role="applied-discount-table-row"]:nth-child(5) a[data-role="applied-promotion-change-active-button"]'

    FlatRateShippingMethod:
      selector: 'label:contains("Flat Rate:")'

    FlatRate2ShippingMethod:
      selector: 'label:contains("Flat Rate 2:")'
    BackendFlatRate2ShippingMethod:
      selector: 'label:contains("Flat Rate 2")'

    Restrictions:
      selector:
        type: xpath
        locator: '//label[contains(@class, "attribute-item__term") and text()[contains(.,"Restrictions")]]/following-sibling::div[contains(@class, "attribute-item__description")]'

    Apply Segment:
      selector:
        type: xpath
        locator: '//li[@data-criteria="condition-segment" and contains(., "Apply segment")]'

    Choose segment:
      selector: 'li[data-criteria="condition-segment"] input'
      class: Oro\Bundle\FormBundle\Tests\Behat\Element\Select2Entity

    Featured Products:
      selector: 'div.select2-drop-active div.select2-result-label:contains("Featured Products")'

    Product Segment SKU1:
      selector: 'div.select2-drop-active div.select2-result-label:contains("Product Segment SKU1")'

    Select2 results:
      selector: 'div.select2-drop-active ul.select2-results'
