Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    How To Place An Order In Magento2 Using CasperJs

    Manual testing is a boring task to do because in manual testing we perform the same task many times which is time-consuming. To overcome this problem, we can automate testing with the help CasperJs. CasperJs allows you to build full navigation scenarios using high-level functions and a straight forward interface to accomplish all sizes of tasks.

    In Magento there are various “repetitive” tasks to check such as customer registration process, customer log in to the account, adding different types of products to the shopping cart, checkout steps etc. These repetitive actions take a lot of time when we have done manually but now it can be done in few minutes by automation.

    For the customer sign-up click here. Now we’ll proceed with the testing process. Here we’ll learn how we can log in and place an order using CasperJs into a Magento2 store.

    The code procedure is as follows-

    Open home page of your Magento2 store, click on “Sign In” link, open “Customer Login” page to fill out the Email and Password, submit it, wait to be redirected to “My Account Dashboard” and then get url of the Dashboard page.

    Here we have used some CasperJs methods like-

    click() method is used to click a link and buttons.

    fill() method is used to fill the forms.

    getCurrentUrl() is used to get the current page url.

    echo() is used to print.

    getTitle() is used to get Title of tha page.

    wait() is used to wait for given amount of time.


    Now you have to run a command on your terminal-

    casperjs your_file_name.js 

    Here, you can see the result on your terminal –

    After running the script you will get the Order Number and Success message on terminal.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close