Giter VIP home page Giter VIP logo

hackathon-casperjs's Introduction

Frontend tests on Magento with CasperJS

Introduction

The tests located in the tests directory work with a default Magento CE installation with sample data installed. The idea is that if you have a custom project you will duplicate those tests in a separate directory and make the necessary adjustments so that the tests pass with your custom theme, extensions and custom modifications.

If you develop new generic tests, please contribute them back to this project by either coming to a Magento Hackathon and requesting write access to this repository or by forking it and submitting a pull request.

Prerequisites

Howto run the tests

Just run the command below:

casperjs --pre=config.js test --url="http://my-store.com/" tests/

or for simple tests with default values

npm test --url="http://my-store.com/"

You just need to replace the http://my-store.com with your own store's URL.

If you don't have URL rewrites enabled, don't forget to add index.php to your URL.

Secure URL

If you want to set a different URL used for HTTPS please add the url like that:

--secure_url="https://my-store.com/"

Maybe you're using a self signed certificate. In this case add the following parameter:

--ignore-ssl-errors=yes

Admin URL

If you're using a different admin path, you can specify it like so:

--admin_url="https://my-store.com/index.php/secretpath/"

Debug

If you want a verbose mode, just add:

--verbose

Remote Debugging

Remote Debugging allows you to debug the testing script using the WebKit Inspector. This feature is only available for WebKit-based Browsers like Safari and Chrome.

You can easily remote debug the scripts using the command --remote-debugger-port=9000.

your@machine:/casperjs --pre=config.js --remote-debugger-port=9000 sample.js

It is up to you to choose any port of your choice. When running the remote debugger, it is important that you know your ip. My IP in this case is for example 192.168.162.134

your@machine:/srv/hackathon$ ifconfig
eth0      Link encap:Ethernet  Hardware Adresse
00:0c:29:53:ea:00    inet Adresse:192.168.162.134

Now open any webkit browser on your LOCAL machine and type in ip:port for example:

192.168.162.134:9000

The debugger can now be run by typing in the command __run() at the console after clicking the first link on the page.

Troubleshooting

If you get this error

CasperError: Can't find module underscore

you need to run

npm install

which will install the required node underscore module.

hackathon-casperjs's People

Contributors

jacquesbh avatar nickw108 avatar real34 avatar umax-atwix avatar rogyar avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.