Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
AssertTermRequireMessageOnMultishippingCheckout.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\Constraint\AbstractConstraint;
9 use Magento\Mtf\ObjectManager;
10 use Magento\Multishipping\Test\Page\MultishippingCheckoutOverview;
11 use Magento\Mtf\TestStep\TestStepFactory;
12 
17 class AssertTermRequireMessageOnMultishippingCheckout extends AbstractConstraint
18 {
19  /* tags */
20  const SEVERITY = 'high';
21  /* end tags */
22 
26  const NOTIFICATION_MESSAGE = 'This is a required field.';
27 
39  public function processAssert(
40  MultishippingCheckoutOverview $page,
41  TestStepFactory $stepFactory,
42  $products,
43  $payment,
44  $shipping
45  ) {
46  $customer = ['customer' => ['dataset' => 'johndoe_with_multiple_addresses']];
47  $customer = $stepFactory->create(\Magento\Customer\Test\TestStep\CreateCustomerStep::class, $customer)->run();
48  $products = $stepFactory->create(
49  \Magento\Catalog\Test\TestStep\CreateProductsStep::class,
50  ['products' => $products]
51  )->run();
52  $stepFactory->create(\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class, $customer)->run();
53  $stepFactory->create(\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep::class, $products)->run();
54  $stepFactory->create(\Magento\Multishipping\Test\TestStep\ProceedToMultipleAddressCheckoutStep::class)->run();
55  $stepFactory->create(
56  \Magento\Multishipping\Test\TestStep\FillCustomerAddressesStep::class,
57  array_merge($products, $customer)
58  )->run();
59  $stepFactory->create(
60  \Magento\Multishipping\Test\TestStep\FillShippingInformationStep::class,
61  array_merge(['shippingMethod' => $shipping], $customer)
62  )->run();
63  $stepFactory->create(
64  \Magento\Multishipping\Test\TestStep\SelectPaymentMethodStep::class,
65  ['payment' => $payment]
66  )->run();
67  $stepFactory->create(
68  \Magento\CheckoutAgreements\Test\TestStep\CheckTermOnMultishippingStep::class,
69  ['agreementValue' => 'No']
70  )->run();
71  $stepFactory->create(\Magento\Multishipping\Test\TestStep\PlaceOrderStep::class)->run();
72  \PHPUnit\Framework\Assert::assertEquals(
73  self::NOTIFICATION_MESSAGE,
74  $page->getAgreementReview()->getNotificationMassage(),
75  'Notification required message of Terms and Conditions is absent.'
76  );
77  $stepFactory->create(
78  \Magento\CheckoutAgreements\Test\TestStep\CheckTermOnMultishippingStep::class,
79  ['agreementValue' => 'Yes']
80  )->run();
81  $stepFactory->create(\Magento\Multishipping\Test\TestStep\PlaceOrderStep::class)->run();
82  }
83 
89  public function toString()
90  {
91  return 'Validation error message for terms and conditions checkbox is present on multishipping checkout.';
92  }
93 }
$customer
Definition: customers.php:11
$payment
Definition: order.php:17
$page
Definition: pages.php:8
processAssert(MultishippingCheckoutOverview $page, TestStepFactory $stepFactory, $products, $payment, $shipping)