Skip to content

Commit 9ffcdc6

Browse files
committed
refactoring of AdminCreateInvoiceTest
1 parent 3e23510 commit 9ffcdc6

File tree

1 file changed

+31
-62
lines changed

1 file changed

+31
-62
lines changed

app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml

+31-62
Original file line numberDiff line numberDiff line change
@@ -18,77 +18,46 @@
1818
<testCaseId value="MAGETWO-72096"/>
1919
<group value="sales"/>
2020
</annotations>
21-
<before>
21+
22+
<before>
2223
<createData entity="_defaultCategory" stepKey="createCategory"/>
23-
<createData entity="_defaultProduct" stepKey="createProduct">
24+
<createData entity="_defaultProduct" stepKey="createSimpleProductApi">
2425
<requiredEntity createDataKey="createCategory"/>
2526
</createData>
27+
<createData entity="GuestCart" stepKey="createGuestCart"/>
28+
<createData entity="SimpleCartItem" stepKey="addCartItem">
29+
<requiredEntity createDataKey="createGuestCart"/>
30+
<requiredEntity createDataKey="createSimpleProductApi"/>
31+
</createData>
32+
<createData entity="GuestAddressInformation" stepKey="addGuestOrderAddress">
33+
<requiredEntity createDataKey="createGuestCart"/>
34+
</createData>
35+
<updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation">
36+
<requiredEntity createDataKey="createGuestCart"/>
37+
</updateData>
2638
</before>
39+
2740
<after>
28-
<actionGroup ref="logout" stepKey="adminLogout"/>
29-
<deleteData createDataKey="createCategory" stepKey="deleteProduct1"/>
30-
<deleteData createDataKey="createProduct" stepKey="deleteCategory1"/>
41+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
42+
<deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
3144
</after>
3245

33-
<!-- todo: Create an order via the api instead of driving the browser -->
34-
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
35-
<waitForPageLoad stepKey="waitForPageLoad1"/>
36-
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
37-
<click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/>
38-
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
39-
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/>
40-
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/>
41-
<waitForPageLoad stepKey="waitForPageLoad2"/>
42-
<fillField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
43-
<fillField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
44-
<fillField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
45-
<fillField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/>
46-
<fillField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/>
47-
<selectOption selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/>
48-
<fillField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/>
49-
<fillField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/>
50-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
51-
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
52-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/>
53-
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
54-
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
55-
<!-- Checkout select Check/Money Order payment -->
56-
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
57-
<waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
58-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
59-
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
60-
<!-- end todo -->
46+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>
47+
48+
<amOnPage url="{{AdminOrderPage.url($createGuestCart.return$)}}" stepKey="navigateToOrderPage"/>
49+
50+
<actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/>
51+
52+
<actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId">
53+
<argument name="orderId" value="$createGuestCart.return$"/>
54+
</actionGroup>
6155

62-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
56+
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoiceFromGrid"/>
6357

64-
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/>
65-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/>
66-
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
67-
<fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum"/>
68-
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/>
69-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/>
58+
<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkIfOrderStatusIsPending">
59+
<argument name="status" value="Processing"/>
60+
</actionGroup>
7061

71-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
72-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
73-
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoice"/>
74-
<waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/>
75-
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
76-
<waitForPageLoad stepKey="waitForInvoiceToBeCreated"/>
77-
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/>
78-
<click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/>
79-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5" />
80-
<see selector="{{AdminOrderDetailsInvoicesSection.content}}" userInput="{$grabOrderNumber}" stepKey="seeInvoice1"/>
81-
<see selector="{{AdminOrderDetailsInvoicesSection.content}}" userInput="John Doe" stepKey="seeInvoice2"/>
82-
<click selector="{{AdminOrderDetailsOrderViewSection.information}}" stepKey="clickInformation"/>
83-
<waitForLoadingMaskToDisappear stepKey="waitForOrderInformationTabLoadingMask"/>
84-
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus"/>
85-
<amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/>
86-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask6" />
87-
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridInitial"/>
88-
<click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilters"/>
89-
<fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum2"/>
90-
<click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/>
91-
<click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="clickInvoice2"/>
92-
<see selector="{{AdminInvoiceDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus2"/>
9362
</test>
9463
</tests>

0 commit comments

Comments
 (0)