Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] magento/magento2#12396: Total Amount cart rule without tax #21845

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function __construct(
public function loadAttributeOptions()
{
$attributes = [
'base_subtotal_with_discount' => __('Subtotal (Excl. Tax)'),
'base_subtotal' => __('Subtotal'),
'total_qty' => __('Total Items Quantity'),
'weight' => __('Total Weight'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ class ConditionsElement extends SimpleElement
*/
protected $exception;

/**
* Condition option text selector.
*
* @var string
*/
private $conditionOptionTextSelector = '//option[normalize-space(text())="%s"]';

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -282,10 +289,16 @@ protected function addCondition($type, ElementInterface $context)
$count = 0;

do {
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();

try {
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($type);
$specificType = $newCondition->find(
sprintf($this->conditionOptionTextSelector, $type),
Locator::SELECTOR_XPATH
)->isPresent();
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
$condition = $specificType
? $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')
: $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
$condition->setValue($type);
$isSetType = true;
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
$isSetType = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Mtf\Client\Element;

/**
* @inheritdoc
*/
class SelectconditionElement extends SelectElement
{
/**
* @inheritdoc
*/
protected $optionByValue = './/option[normalize-space(.)=%s]';
}