refactor app directory structure and add tests

This commit is contained in:
s2
2016-11-10 16:27:26 +01:00
parent 204834ce28
commit dd88218c0e
1844 changed files with 263520 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
var PageUtils = require('./page-utils.js');
var CommandWrapper = require('./command-wrapper.js');
/**
* Class that all sections subclass from
*
* @param {Object} options Section options defined in page object
* @constructor
*/
function Section(options) {
this.parent = options.parent;
this.client = this.parent.client;
if(!options.selector) {
throw new Error('No selector property for section "' + options.name +
'" Instead found properties: ' + Object.keys(options));
}
this.name = options.name;
this.selector = options.selector;
this.locateStrategy = options.locateStrategy || 'css selector';
this.api = this.parent.api;
this.commandLoader = this.parent.commandLoader;
PageUtils
.createProps(this, options.props || {})
.createElements(this, options.elements || {})
.createSections(this, options.sections || {})
.addCommands(this, options.commands || []);
CommandWrapper.addWrappedCommands(this, this.commandLoader);
}
Section.prototype.toString = function() {
return 'Section[name=' + this.name + ']';
};
module.exports = Section;