protractor-cucumber-boilerplate

* `gulp test --env dev --tags "@debug"`


License
MIT
Install
npm install protractor-cucumber-boilerplate@0.12.2

Documentation

How to run

  • gulp test --env dev --tags "@debug"

Page Objects

##Page Map

const AbstractPageMap = require("protractor-boilerplate").AbstractPageMap;
const LoginPage = require("./page/LoginPage");

class PageMap extends AbstractPageMap {

    constructor() {
        super();

        this.definePage("Login", "^.+))$", LoginPage);

    }

}

###Methods

  • definePage
param mandatory description
alias M alias of the page
regexp M regexp of URL to determine page
clazz M page class

##Page

const Page = require("protractor-boilerplate").AbstractPage;
const CustomComponent = require("./CustomComponent");

class CustomPage extends Page {

    constructor() {
        super();

        this.defineComponent("Custom Component", new CustomComponent());
        this.defineElement("Custom Element", "h3");
        this.defineCollection("Custom Collection", "h3.button");
    }

}

###Methods

  • defineComponent
param mandatory description
alias M alias of the component
component M component object
  • defineElement
param mandatory description
alias M alias of the component
selector M css selector of element
  • defineCollection
param mandatory description
alias M alias of the component
selector M css selector of element

##Component

const Component = require("protractor-boilerplate").Component;

class CustomComponent extends Component {

    constructor(alias = "Dashboard", selector = ".div", isCollection = false) {
        super(alias, selector, isCollection);

        this.defineComponent("Custom Component", new CustomComponent());
        this.defineElement("Custom Element", "h3");
        this.defineCollection("Custom Collection", "h3.button");
    }

}

###Methods

  • constructor
param mandatory description
alias M alias of the component
selector M css selector of element
isCollection M isCollection flag
  • defineComponent
param mandatory description
alias M alias of the component
component M component object
  • defineElement
param mandatory description
alias M alias of the component
selector M css selector of element
  • defineCollection
param mandatory description
alias M alias of the component
selector M css selector of element

Memory

##Memory

const Memory = require("protractor-boilerplate").Memory;

defineSupportCode(({setDefaultTimeout, When}) => {

    When(/^I remember "(.+)" value as "(.+)"$/, (alias, key) => {
        const page = State.getPage();

        return page.getElement(alias).getText()
            .then((text) => {
                Memory.setValue(key, text);
            })
    });
}

###Methods

  • setValue
param mandatory description
key M key of stored item
value M value of stored item
  • parseValue returns value by provided key, otherwise returns key
param mandatory description
value M a key or simple value