Skip to content

Commit

Permalink
refactoring of AdminCreateInvoiceTest
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaAPak committed Oct 4, 2020
1 parent 3e23510 commit 9ffcdc6
Showing 1 changed file with 31 additions and 62 deletions.
93 changes: 31 additions & 62 deletions app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,77 +18,46 @@
<testCaseId value="MAGETWO-72096"/>
<group value="sales"/>
</annotations>
<before>

<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="_defaultProduct" stepKey="createProduct">
<createData entity="_defaultProduct" stepKey="createSimpleProductApi">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="GuestCart" stepKey="createGuestCart"/>
<createData entity="SimpleCartItem" stepKey="addCartItem">
<requiredEntity createDataKey="createGuestCart"/>
<requiredEntity createDataKey="createSimpleProductApi"/>
</createData>
<createData entity="GuestAddressInformation" stepKey="addGuestOrderAddress">
<requiredEntity createDataKey="createGuestCart"/>
</createData>
<updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation">
<requiredEntity createDataKey="createGuestCart"/>
</updateData>
</before>

<after>
<actionGroup ref="logout" stepKey="adminLogout"/>
<deleteData createDataKey="createCategory" stepKey="deleteProduct1"/>
<deleteData createDataKey="createProduct" stepKey="deleteCategory1"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
</after>

<!-- todo: Create an order via the api instead of driving the browser -->
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
<click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/>
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/>
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/>
<waitForPageLoad stepKey="waitForPageLoad2"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/>
<selectOption selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/>
<fillField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/>
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
<!-- Checkout select Check/Money Order payment -->
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
<waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
<!-- end todo -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>

<amOnPage url="{{AdminOrderPage.url($createGuestCart.return$)}}" stepKey="navigateToOrderPage"/>

<actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/>

<actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId">
<argument name="orderId" value="$createGuestCart.return$"/>
</actionGroup>

<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoiceFromGrid"/>

<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/>
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
<fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum"/>
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/>
<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkIfOrderStatusIsPending">
<argument name="status" value="Processing"/>
</actionGroup>

<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoice"/>
<waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/>
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
<waitForPageLoad stepKey="waitForInvoiceToBeCreated"/>
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/>
<click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5" />
<see selector="{{AdminOrderDetailsInvoicesSection.content}}" userInput="{$grabOrderNumber}" stepKey="seeInvoice1"/>
<see selector="{{AdminOrderDetailsInvoicesSection.content}}" userInput="John Doe" stepKey="seeInvoice2"/>
<click selector="{{AdminOrderDetailsOrderViewSection.information}}" stepKey="clickInformation"/>
<waitForLoadingMaskToDisappear stepKey="waitForOrderInformationTabLoadingMask"/>
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus"/>
<amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask6" />
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridInitial"/>
<click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilters"/>
<fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum2"/>
<click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/>
<click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="clickInvoice2"/>
<see selector="{{AdminInvoiceDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus2"/>
</test>
</tests>

0 comments on commit 9ffcdc6

Please sign in to comment.