Skip to content

Commit 252effc

Browse files
authored
ENGCOM-4540: [Backport] #12396: Total Amount cart rule without tax #21845
2 parents 9629729 + 0240e81 commit 252effc

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

app/code/Magento/SalesRule/Model/Rule/Condition/Address.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function __construct(
5858
public function loadAttributeOptions()
5959
{
6060
$attributes = [
61+
'base_subtotal_with_discount' => __('Subtotal (Excl. Tax)'),
6162
'base_subtotal' => __('Subtotal'),
6263
'total_qty' => __('Total Items Quantity'),
6364
'weight' => __('Total Weight'),

dev/tests/functional/lib/Magento/Mtf/Client/Element/ConditionsElement.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ class ConditionsElement extends SimpleElement
195195
*/
196196
protected $exception;
197197

198+
/**
199+
* Condition option text selector.
200+
*
201+
* @var string
202+
*/
203+
private $conditionOptionTextSelector = '//option[normalize-space(text())="%s"]';
204+
198205
/**
199206
* @inheritdoc
200207
*/
@@ -282,10 +289,16 @@ protected function addCondition($type, ElementInterface $context)
282289
$count = 0;
283290

284291
do {
285-
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
286-
287292
try {
288-
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($type);
293+
$specificType = $newCondition->find(
294+
sprintf($this->conditionOptionTextSelector, $type),
295+
Locator::SELECTOR_XPATH
296+
)->isPresent();
297+
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
298+
$condition = $specificType
299+
? $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')
300+
: $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
301+
$condition->setValue($type);
289302
$isSetType = true;
290303
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
291304
$isSetType = false;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Mtf\Client\Element;
10+
11+
/**
12+
* @inheritdoc
13+
*/
14+
class SelectconditionElement extends SelectElement
15+
{
16+
/**
17+
* @inheritdoc
18+
*/
19+
protected $optionByValue = './/option[normalize-space(.)=%s]';
20+
}

0 commit comments

Comments
 (0)