Merge pull request #8362 from spalger/implement/functional-tests/helpers

Implement functional test helpers
This commit is contained in:
Spencer 2016-09-20 15:40:15 -07:00 committed by GitHub
commit e20afd9b46

View file

@ -1,6 +1,7 @@
import bluebird, {
promisify
promisify,
filter as filterAsync
} from 'bluebird';
import fs from 'fs';
import _ from 'lodash';
@ -254,6 +255,10 @@ export default class Common {
return Try.try(block);
}
tryMethod(object, method, ...args) {
return this.try(() => object[method](...args));
}
log(...args) {
Log.log(...args);
}
@ -305,4 +310,11 @@ export default class Common {
.findDisplayedByCssSelector(testSubjSelector(selector));
}
async findAllTestSubjects(selector) {
this.debug('in findAllTestSubjects: ' + testSubjSelector(selector));
const remote = this.remote.setFindTimeout(defaultFindTimeout);
const all = await remote.findAllByCssSelector(testSubjSelector(selector));
return await filterAsync(all, el => el.isDisplayed());
}
}