Skip to content

Latest commit

 

History

History
111 lines (68 loc) · 2.19 KB

HOWTO.md

File metadata and controls

111 lines (68 loc) · 2.19 KB

How to use?

First, you need to install the tool:

npm install
npm start&
./run_server.sh

Where to write my tests?

All the magic should start in a index.js:

import {elementPresent, elementNotPresent, value, trigger, setValue, waitForElementPresent} from '../common/api';

// Do the magic here! :D

var e = jQuery.Event("keydown");
e.which = 50; // # Some key code value
jsEsgrima("t1", trigger, {id:'#search', event: e, group:"search", function (){}},
    'search');

jsEsgrima("t2", trigger, {id:'#search', event: e, group:"search", function (){}},
    'search');

jsEsgrima("a1", waitForElementPresent, {id:"#searchBtnRes", timeout: 4000, group: "search",
        callBackResult: function (){}},
    'search');

jsEsgrima("t3", trigger, {id:'#search', event: e, group:"search", function (){}},
    'search');

jsEsgrima("t5", function(args){

        $("#search").html("Just a change in HTML");
        
        console.log(window);
        args.callBackResult();

    }, {id:'#search', callBackResult: function (){console.log("!t5")}, group:"search", function (){}},
    'search');


jsEsgrima("Look for the result", function() {
  it("contains spec with an expectation", function() {
    console.log("lol");
    expect(true).toBe(true);

  });
}, 'results');

How to configure?

Add a config.js with the following content:



import {EsgrimaInstance} from '../client/esgrima';

var jsEsgrimaGroups = {

    'search': function () {
        var search = document.getElementById("search");
        return search!==undefined;

    },
    'results' : function () {
        var results = document.getElementById("results");
        return results!==undefined;
    }
}

EsgrimaInstance.registerGroups(jsEsgrimaGroups);

export {jsEsgrimaGroups}


Dev mode

./node_modules/babel/bin/babel-node server/lib/webserver.js

Running the server:

TODO: fix it ! We still need to build the scripts. Moreover, in windows, the npm start still do not work!

$ ./jsEsgrima build
$ ./jsEsgrima serve

How to integrate in my application?

If you want to test, add it now.

<script src="http://localhost:9001/EsgrimaTestSet.js"/>
<script src="http://localhost:9001/EsgrimaClient.js"/>