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,55 @@
/**
* Property that checks if an OPTION element, or an INPUT element of type checkbox or radio button is currently selected.
*
* ```
* this.demoTest = function (browser) {
* browser.expect.element('#main').to.be.selected;
* browser.expect.element('#main').to.not.be.selected;
* browser.expect.element('#main').to.be.selected.before(100);
* };
* ```
*
* @method selected
* @display .selected
* @since v0.7
* @api expect
*/
var util = require('util');
var events = require('events');
var BaseAssertion = require('./_baseAssertion.js');
function SelectedAssertion() {
BaseAssertion.call(this);
this.message = 'Expected element <%s> to ' + (this.negate ? 'not be selected' : 'be selected');
this.start();
}
util.inherits(SelectedAssertion, BaseAssertion);
SelectedAssertion.prototype.executeCommand = function(callback) {
this.protocol.elementIdSelected(this.elementResult.ELEMENT, callback);
};
SelectedAssertion.prototype.elementFound = function() {
if (this.retries > 0 && this.negate) {
return;
}
this.passed = this.negate ? !this.resultValue : this.resultValue;
this.expected = this.negate ? 'not selected' : 'selected';
this.actual = this.resultValue ? 'selected' : 'not selected';
if (this.passed && this.waitForMs) {
this.elapsedTime = this.getElapsedTime();
this.messageParts.push(' - condition was met in ' + this.elapsedTime + 'ms');
}
};
SelectedAssertion.prototype.elementNotFound = function() {
this.passed = false;
this.expected = this.negate ? 'not selected' : 'selected';
this.actual = 'not found';
};
module.exports = SelectedAssertion;