Menu Close
    Hire us Request quote Reading list Switch to dark mode

    How to Sign Up in Magento2 Using CasperJS

    Testing can be boring and time consuming task if you are performing same task multiple times. To make it easier have to use some tools. In Magento there are various “repetitive” tasks that need to be done after the first install like we need to create a test account, add product in cart order placement etc. CasperJs is the best tool to overcome this problem.

    CasperJS allows you to build full navigation scenarios using high-level functions and a straight forward interface to accomplish all sizes of tasks. CasperJS comes with a basic testing suite that allows you to run full featured tests without the overhead of a full browser.

    For the installation and basic CasperJs knowledge you can check here. Now we’ll proceed with the testing process. Here we’ll get to learn how we can register or signup a new customer using CasperJs into a magento2 store.

    The code procedure is as follows-
    Open home page of your Magento2 store, click on “Create an Account” link, open “Create New Customer Account” page to fill out the form, submit it, wait to be redirected to “My Account Dashboard and then get url of the dashboard page along with screenshot.

    Here we have used some Casperjs methods like-

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

    capture() method is user to capture the particular page and you can see the screenshots parallel to your script.

    fill() method is used to fill the forms.

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

    Now you have to run a command on your terminal-

    casperjs test your_file_name.js –url=http://your_magento_homepage

    Here, you can see the result on your terminal –

    After completing the test execution you can see the screenshots parallel to your script.



    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again