Skip to content

WIP: [MFTF]: Refactoring of AdminCreateInvoiceTest #30334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 34 additions & 63 deletions app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCreateInvoiceTest">
<test name="AdminCreateInvoiceTest" deprecated="Use AdminInvoiceOrderTest instead">
<annotations>
<features value="Sales"/>
<stories value="Create an Invoice via the Admin"/>
Expand All @@ -18,77 +18,48 @@
<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"/>

<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder">
<argument name="entity_id" value="$createGuestCart.return$"/>
</actionGroup>

<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="checkIfOrderStatusIsProcessing">
<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>