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
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
param | mandatory | description |
---|
alias | M | alias of the component |
component | M | component object |
param | mandatory | description |
---|
alias | M | alias of the component |
selector | M | css selector of element |
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
param | mandatory | description |
---|
alias | M | alias of the component |
selector | M | css selector of element |
isCollection | M | isCollection flag |
param | mandatory | description |
---|
alias | M | alias of the component |
component | M | component object |
param | mandatory | description |
---|
alias | M | alias of the component |
selector | M | css selector of element |
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
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 |