Git Product home page Git Product logo

automatejs's Introduction

automate

Not really ready for prime time. Works well for us

Automated javascript testing. Esp for phonegap applications where you need to bundle integration tests with the app and test on an actual device.

Dependencies

  • Only npm support at this point. So you'll need something like browserify to bundle it into the browser.
  • requires jQuery

Has two components.

  • Server: a reporting server where test run information is logged
  • lib/automate.js is the runner code that needs to be bundled with the js app

Install

npm install automatejs

Server

Start the server using

node app.js 
//or
npm start

Automatejs client library

Create an instance of automate for each run. This creates a unique run id, used to submit reports to server

var Automate = require("automate"),
var automate = new Automate(serverUrl, nameOfTest);

Now use the various methods to say what all you need to do

automate.tap("#foo div");
automate.waitFor(300);
automate.tap("#bar span");

Add your asserts at any point. You can use any assert library, here I use chai.

automate.then(function() {
    expect($(".uiPageActive .subToolBar em").html()).to.contain.string("Philadelphia to SF");
});

Signal that you are done specifying your tests

automate.runAll(); //Runs each step one by one, and submits the report to server

API reference

Constructor

var automate = new Automate(automateSeverUrl, nameOfTest);
//example
var automate = new Automate("http://localhost:5000", "regression suite");

Methods

Tap

automate.tap(jQuerySelector);
//example
automate.tap("#foo");

fill a textbox or text input

automate.fill(selector, value);
//example
automate.fill("#loginUsername", "[email protected]");

select a drop down

automate.select(selector, value);
//example
automate.select("#environment", "production");

start/then: execute arbitrary piece of javascript at that time. Useful to add asserts. start and then are equivalent, just syntax sugar to indicate start of a test.

automate.start(function)
automate.then(function)
//example
automate.start(function(){
    expect($("#foo").val()).to.be(500);
});

waitFor: timeout or function

automate.waitFor(timeMilliSeconds);
automate.waitFor(fn)
fn: return true to indicate waitFor condition is met
//example
automate.waitFor(300);
automate.waitFor(function(){
	return ($("#foo").length === 1);
})

runAll: Signal that you are done specifying the test. Now run actions one by one. On each step, information will be logged in automate server. If there is an error in any step, it'll bail out.

automate.runAll()

module: Indicate start of a module. Once a module is set, any actions done like a tap are logged under that module. If none specified, all tests go into 'default' module. Module names should be unique, or reports will get messed up.

automate.module(moduleName)
//example
automate.module("login module")

License & Contribution

Automatejs is released under the Apache 2.0 license. Comments, bugs, pull requests, and other contributions are all welcomed! For questions please feel free to contact [email protected] or [email protected]

automatejs's People

Contributors

bharatpatil avatar indianburger avatar noobster avatar paulyi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automatejs's Issues

Tutorial

Hi, I have gone through readme however it is very unclear.
Can you please add some example for phonegap?

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.