Skip to content

Commit 4e02b53

Browse files
committed
Merge remote-tracking branch 'folks/checkout-ft' into folks-south
2 parents 8377cb7 + 1280387 commit 4e02b53

File tree

21 files changed

+355
-265
lines changed

21 files changed

+355
-265
lines changed

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/AbstractReview.php

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919
*/
2020
abstract class AbstractReview extends Block
2121
{
22-
/**
23-
* Continue checkout button.
24-
*
25-
* @var string
26-
*/
27-
protected $continueCheckoutButton = '#review-buttons-container button';
28-
2922
/**
3023
* Grand total search mask.
3124
*
@@ -151,7 +144,7 @@ public function __construct(SimpleElement $element, BlockFactory $blockFactory,
151144
*/
152145
public function getGrandTotal()
153146
{
154-
$grandTotal = $this->_rootElement->find($this->grandTotal, Locator::SELECTOR_CSS)->getText();
147+
$grandTotal = $this->_rootElement->find($this->grandTotal)->getText();
155148
return $this->escapeCurrency($grandTotal);
156149
}
157150

@@ -214,7 +207,7 @@ public function getItemSubInclTax($productName)
214207
*/
215208
public function getGrandTotalExclTax()
216209
{
217-
$grandTotal = $this->_rootElement->find($this->grandTotalExclTax, Locator::SELECTOR_CSS)->getText();
210+
$grandTotal = $this->_rootElement->find($this->grandTotalExclTax)->getText();
218211
return $this->escapeCurrency($grandTotal);
219212
}
220213

@@ -225,7 +218,7 @@ public function getGrandTotalExclTax()
225218
*/
226219
public function getGrandTotalInclTax()
227220
{
228-
$grandTotal = $this->_rootElement->find($this->grandTotalInclTax, Locator::SELECTOR_CSS)->getText();
221+
$grandTotal = $this->_rootElement->find($this->grandTotalInclTax)->getText();
229222
return $this->escapeCurrency($grandTotal);
230223
}
231224

@@ -236,7 +229,7 @@ public function getGrandTotalInclTax()
236229
*/
237230
public function getTax()
238231
{
239-
$tax = $this->_rootElement->find($this->tax, Locator::SELECTOR_CSS)->getText();
232+
$tax = $this->_rootElement->find($this->tax)->getText();
240233
return $this->escapeCurrency($tax);
241234
}
242235

@@ -247,7 +240,7 @@ public function getTax()
247240
*/
248241
public function getDiscount()
249242
{
250-
$discount = $this->_rootElement->find($this->discount, Locator::SELECTOR_CSS);
243+
$discount = $this->_rootElement->find($this->discount);
251244
return $discount->isVisible() ? $this->escapeCurrency($discount->getText()) : null;
252245
}
253246

@@ -258,7 +251,7 @@ public function getDiscount()
258251
*/
259252
public function getSubtotal()
260253
{
261-
$subTotal = $this->_rootElement->find($this->subtotal, Locator::SELECTOR_CSS)->getText();
254+
$subTotal = $this->_rootElement->find($this->subtotal)->getText();
262255
return $this->escapeCurrency($subTotal);
263256
}
264257

@@ -269,7 +262,7 @@ public function getSubtotal()
269262
*/
270263
public function getSubtotalExclTax()
271264
{
272-
$subTotal = $this->_rootElement->find($this->subtotalExclTax, Locator::SELECTOR_CSS)->getText();
265+
$subTotal = $this->_rootElement->find($this->subtotalExclTax)->getText();
273266
return $this->escapeCurrency($subTotal);
274267
}
275268

@@ -280,7 +273,7 @@ public function getSubtotalExclTax()
280273
*/
281274
public function getSubtotalInclTax()
282275
{
283-
$subTotal = $this->_rootElement->find($this->subtotalInclTax, Locator::SELECTOR_CSS)->getText();
276+
$subTotal = $this->_rootElement->find($this->subtotalInclTax)->getText();
284277
return $this->escapeCurrency($subTotal);
285278
}
286279

@@ -291,7 +284,7 @@ public function getSubtotalInclTax()
291284
*/
292285
public function getShippingInclTax()
293286
{
294-
$subTotal = $this->_rootElement->find($this->shippingInclTax, Locator::SELECTOR_CSS);
287+
$subTotal = $this->_rootElement->find($this->shippingInclTax);
295288
return $subTotal->isVisible() ? $this->escapeCurrency($subTotal->getText()) : null;
296289
}
297290

@@ -303,21 +296,10 @@ public function getShippingInclTax()
303296
public function getShippingExclTax()
304297
{
305298
$this->waitForElementVisible($this->shippingExclTax);
306-
$subTotal = $this->_rootElement->find($this->shippingExclTax, Locator::SELECTOR_CSS);
299+
$subTotal = $this->_rootElement->find($this->shippingExclTax);
307300
return $subTotal->isVisible() ? $this->escapeCurrency($subTotal->getText()) : null;
308301
}
309302

310-
/**
311-
* Place order.
312-
*
313-
* @return void
314-
*/
315-
public function placeOrder()
316-
{
317-
$this->_rootElement->find($this->continueCheckoutButton, Locator::SELECTOR_CSS)->click();
318-
$this->waitForElementNotVisible($this->waitElement);
319-
}
320-
321303
/**
322304
* Method that escapes currency symbols.
323305
*

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Billing.php

Lines changed: 0 additions & 76 deletions
This file was deleted.

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
use Magento\Mtf\Fixture\FixtureInterface;
1111

1212
/**
13-
* Class Login
14-
* One page checkout status login block
13+
* One page checkout status login block.
1514
*/
1615
class Login extends Form
1716
{
@@ -51,7 +50,7 @@ class Login extends Form
5150
protected $loadingMask = '.loading-mask';
5251

5352
/**
54-
* Select how to perform checkout whether guest or registered customer
53+
* Select how to perform checkout whether guest or registered customer.
5554
*
5655
* @param FixtureInterface $fixture
5756
* @return void
@@ -68,7 +67,7 @@ public function checkoutMethod(FixtureInterface $fixture)
6867
}
6968

7069
/**
71-
* Perform guest checkout
70+
* Perform guest checkout.
7271
*
7372
* @return void
7473
*/
@@ -79,7 +78,7 @@ public function guestCheckout()
7978
}
8079

8180
/**
82-
* Login customer during checkout
81+
* Login customer during checkout.
8382
*
8483
* @param FixtureInterface $customer
8584
* @return void
@@ -92,7 +91,7 @@ public function loginCustomer(FixtureInterface $customer)
9291
}
9392

9493
/**
95-
* Click continue on checkout method block
94+
* Click continue on checkout method block.
9695
*
9796
* @return void
9897
*/

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Methods.php renamed to dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,60 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\Checkout\Test\Block\Onepage\Payment;
7+
namespace Magento\Checkout\Test\Block\Onepage;
88

9-
use Magento\Mtf\Block\Form;
9+
use Magento\Mtf\Block\Block;
1010
use Magento\Payment\Test\Fixture\CreditCard;
1111

1212
/**
13-
* Class Methods
14-
* One page checkout status payment method block
15-
*
13+
* Checkout payment block.
1614
*/
17-
class Methods extends Form
15+
class Payment extends Block
1816
{
1917
/**
20-
* Payment method input selector
18+
* Payment method input selector.
2119
*
2220
* @var string
2321
*/
2422
protected $paymentMethodInput = '#p_method_%s';
2523

2624
/**
27-
* Labels for payment methods
25+
* Labels for payment methods.
2826
*
2927
* @var string
3028
*/
3129
protected $paymentMethodLabels = '[for^=p_method_]';
3230

3331
/**
34-
* Label for payment methods
32+
* Label for payment methods.
3533
*
3634
* @var string
3735
*/
38-
protected $paymentMethodLabel = '[for=p_method_%s]';
36+
protected $paymentMethodLabel = '[for=%s]';
3937

4038
/**
41-
* Continue checkout button
39+
* Wait element.
4240
*
4341
* @var string
4442
*/
45-
protected $continue = '#payment-buttons-container button';
43+
protected $waitElement = '.loading-mask';
4644

4745
/**
48-
* Wait element
46+
* Purchase order number selector.
4947
*
5048
* @var string
5149
*/
52-
protected $waitElement = '.loading-mask';
50+
protected $purchaseOrderNumber = '#po_number';
5351

5452
/**
55-
* Purchase order number selector
53+
* Selector for active payment method.
5654
*
5755
* @var string
5856
*/
59-
protected $purchaseOrderNumber = '#po_number';
57+
protected $activePaymentMethodSelector = '.payment-method._active';
6058

6159
/**
62-
* Select payment method
60+
* Select payment method.
6361
*
6462
* @param array $payment
6563
* @param CreditCard|null $creditCard
@@ -72,9 +70,8 @@ public function selectPaymentMethod(array $payment, CreditCard $creditCard = nul
7270
if ($paymentSelector->isVisible()) {
7371
$paymentSelector->click();
7472
} else {
75-
$paymentCount = count($this->_rootElement->getElements($this->paymentMethodLabels));
7673
$paymentSelector = $this->_rootElement->find(sprintf($this->paymentMethodLabel, $payment['method']));
77-
if ($paymentCount !== 1 && !$paymentSelector->isVisible()) {
74+
if (!$paymentSelector->isVisible()) {
7875
throw new \Exception('Such payment method is absent.');
7976
}
8077
}
@@ -92,20 +89,17 @@ public function selectPaymentMethod(array $payment, CreditCard $creditCard = nul
9289
}
9390

9491
/**
95-
* Press "Continue" button
92+
* Get selected payment method block.
9693
*
97-
* @return void
94+
* @return \Magento\Checkout\Test\Block\Onepage\Payment\Method
9895
*/
99-
public function clickContinue()
96+
public function getSelectedPaymentMethodBlock()
10097
{
101-
$this->_rootElement->find($this->continue)->click();
102-
$browser = $this->browser;
103-
$selector = $this->waitElement;
104-
$browser->waitUntil(
105-
function () use ($browser, $selector) {
106-
$element = $browser->find($selector);
107-
return $element->isVisible() == false ? true : null;
108-
}
98+
$element = $this->_rootElement->find($this->activePaymentMethodSelector);
99+
100+
return $this->blockFactory->create(
101+
'\Magento\Checkout\Test\Block\Onepage\Payment\Method',
102+
['element' => $element]
109103
);
110104
}
111105
}

0 commit comments

Comments
 (0)