9 use Magento\Customer\Test\Fixture\Address;
11 use Magento\Customer\Test\Page\Adminhtml\CustomerIndex;
12 use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit;
13 use Magento\Mtf\TestCase\Injectable;
14 use Magento\Mtf\TestStep\TestStepFactory;
19 use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex;
20 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
187 TestStepFactory $stepFactory,
197 $this->stepFactory = $stepFactory;
224 array $shipping =
null,
228 $this->configData = $configData;
229 $this->stepFactory->create(
230 \
Magento\Config\Test\TestStep\SetupConfigurationStep::class,
231 [
'configData' => $this->configData]
235 \
Magento\Catalog\Test\TestStep\CreateProductsStep::class,
237 )->run()[
'products'];
240 $this->customerIndex->open();
241 $this->customerIndex->getCustomerGridBlock()->searchAndOpen([
'email' =>
$customer->getEmail()]);
242 $this->customerIndexEdit->getPageActionsBlock()->createOrder();
243 if ($this->orderCreateIndex->getStoreBlock()->isVisible()) {
244 $this->orderCreateIndex->getStoreBlock()->selectStoreView($this->store);
246 $this->stepFactory->create(
247 \
Magento\Sales\Test\TestStep\AddProductsStep::class,
250 $createBlock = $this->orderCreateIndex->getCreateBlock();
251 $this->assertItemsOrderedSectionContainsProducts->processAssert($this->orderCreateIndex,
$products);
252 $this->assertCustomerWishlistOnBackendIsEmpty->processAssert($this->orderCreateIndex);
253 $this->assertCartSectionIsEmptyOnBackendOrderPage->processAssert($this->orderCreateIndex);
255 $createBlock->getItemsBlock()->selectItemAction(
$product,
'Move to Wish List');
257 $createBlock->updateItems();
258 $this->assertItemsOrderedSectionContainsProducts->processAssert($this->orderCreateIndex, [
$products[1]]);
259 $this->assertProductsIsPresentInCustomerBackendWishlist
261 $this->assertCartSectionIsEmptyOnBackendOrderPage->processAssert($this->orderCreateIndex);
262 $this->orderCreateIndex->getSidebarWishlistBlock()->selectItemToAddToOrder(
$products[0], 1);
263 $this->orderCreateIndex->getSidebarWishlistBlock()->selectItemToAddToOrder(
$products[2], 1);
264 $this->orderCreateIndex->getBackendOrderSidebarBlock()->updateChangesClick();
265 $createBlock->waitOrderItemsGrid();
266 $this->assertItemsOrderedSectionContainsProducts->processAssert($this->orderCreateIndex,
$products);
267 $this->assertProductsIsPresentInCustomerBackendWishlist
269 $this->assertCartSectionIsEmptyOnBackendOrderPage->processAssert($this->orderCreateIndex);
271 $createBlock->getItemsBlock()->selectItemAction(
$product,
'Move to Shopping Cart');
273 $createBlock->updateItems();
274 $this->assertItemsOrderedSectionOnBackendOrderIsEmpty->processAssert($this->orderCreateIndex);
275 $this->assertProductsIsPresentInCustomerBackendWishlist
277 $this->assertCartSectionWithProductsOnBackendOrderPage->processAssert($this->orderCreateIndex,
$products);
279 $this->orderCreateIndex->getBackendOrderSidebarBlock()->selectItemToAddToOrder(
$product);
281 $this->orderCreateIndex->getBackendOrderSidebarBlock()->updateChangesClick();
282 $createBlock->waitOrderItemsGrid();
283 $this->assertItemsOrderedSectionContainsProducts->processAssert(
284 $this->orderCreateIndex,
287 $this->assertProductsIsPresentInCustomerBackendWishlist
289 $this->assertCartSectionWithProductsOnBackendOrderPage->processAssert($this->orderCreateIndex, [
$products[1]]);
290 $this->stepFactory->create(
291 \
Magento\Sales\Test\TestStep\FillBillingAddressStep::class,
293 'orderCreateIndex' => $this->orderCreateIndex,
295 'setShippingAddress' =>
true 298 $this->stepFactory->create(
299 \
Magento\Sales\Test\TestStep\SelectPaymentMethodForOrderStep::class,
302 $this->stepFactory->create(
303 \
Magento\Sales\Test\TestStep\SelectShippingMethodForOrderStep::class,
304 [
'shipping' => $shipping]
306 $createBlock->submitOrder();
307 $orderId = trim($this->salesOrderView->getTitleBlock()->getTitle(),
'#');
309 'orderId' => $orderId,
311 'productsInCart' => [
324 $this->stepFactory->create(
325 \
Magento\Config\Test\TestStep\SetupConfigurationStep::class,
326 [
'configData' => $this->configData,
'rollback' =>
true]
test(Customer $customer, array $payment, Address $billingAddress, $configData=null, array $shipping=null, array $products=[])
$assertCartSectionWithProductsOnBackendOrderPage
__inject(TestStepFactory $stepFactory, CustomerIndex $customerIndex, CustomerIndexEdit $customerIndexEdit, Store $store, SalesOrderView $salesOrderView, OrderCreateIndex $orderCreateIndex, AssertItemsOrderedSectionContainsProducts $assertItemsOrderedSectionContainsProducts, AssertCustomerWishlistOnBackendIsEmpty $assertCustomerWishlistOnBackendIsEmpty, AssertCartSectionIsEmptyOnBackendOrderPage $assertCartSectionIsEmptyOnBackendOrderPage)
$assertItemsOrderedSectionContainsProducts
$assertItemsOrderedSectionOnBackendOrderIsEmpty
$assertCustomerWishlistOnBackendIsEmpty
__prepare(AssertItemsOrderedSectionOnBackendOrderIsEmpty $assertItemsOrderedSectionOnBackendOrderIsEmpty, AssertCartSectionWithProductsOnBackendOrderPage $assertCartSectionWithProductsOnBackendOrderPage, AssertProductsIsPresentInCustomerBackendWishlist $assertProductsIsPresentInCustomerBackendWishlist)
$assertProductsIsPresentInCustomerBackendWishlist
$assertCartSectionIsEmptyOnBackendOrderPage