mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Implement functional test helpers (#10209)
Backports PR #8362 **Commit 1:** [functionalTests] implement common.tryMethod() helper * Original sha:69fb068d55
* Authored by spalger <email@spalger.com> on 2016-09-20T01:43:59Z **Commit 2:** [functionalTests] implement common.findAllTestSubjects() helper * Original sha:6b220cfc2b
* Authored by spalger <email@spalger.com> on 2016-09-20T01:44:48Z
This commit is contained in:
parent
01cf8ff3a5
commit
2de7cecaef
1 changed files with 13 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
import bluebird, {
|
||||
promisify
|
||||
promisify,
|
||||
filter as filterAsync
|
||||
} from 'bluebird';
|
||||
import fs from 'fs';
|
||||
import _ from 'lodash';
|
||||
|
@ -214,6 +215,10 @@ export default class Common {
|
|||
return Try.try(block);
|
||||
}
|
||||
|
||||
tryMethod(object, method, ...args) {
|
||||
return this.try(() => object[method](...args));
|
||||
}
|
||||
|
||||
log(...args) {
|
||||
Log.log(...args);
|
||||
}
|
||||
|
@ -265,4 +270,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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue