mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
test support (#11477)
* test support * Move custom find timeout logic into find service * Fix the error in tests by combining the calls. Seems to work locally like this.
This commit is contained in:
parent
993216c099
commit
536be5d5e0
5 changed files with 17 additions and 5 deletions
|
@ -28,7 +28,8 @@
|
|||
tooltip-popup-delay="400"
|
||||
tooltip-append-to-body="1"
|
||||
data-test-subj="{{menuItem.testId}}"
|
||||
></div>
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- Time-picker "menu item" -->
|
||||
<kbn-global-timepicker></kbn-global-timepicker>
|
||||
|
|
|
@ -121,6 +121,7 @@ function add(notif, cb) {
|
|||
notif.customActions = notif.customActions.map((action, index) => {
|
||||
return {
|
||||
key: action.text,
|
||||
dataTestSubj: action.dataTestSubj,
|
||||
callback: closeNotif(notif, action.callback, action.text),
|
||||
getButtonClass() {
|
||||
const buttonTypeClass = typeToButtonClassMap[notif.type];
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
ng-class="action.getButtonClass()"
|
||||
ng-click="action.callback()"
|
||||
ng-bind="action.key"
|
||||
data-test-subj="{{action.dataTestSubj}}"
|
||||
></button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
|
|||
const remote = getService('remote');
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const find = getService('find');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const PageObjects = getPageObjects(['common']);
|
||||
|
||||
|
@ -162,10 +163,10 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
|
|||
.findByLinkText(quickTime).click();
|
||||
}
|
||||
|
||||
async getToastMessage() {
|
||||
remote.setFindTimeout(defaultFindTimeout);
|
||||
return await remote.findDisplayedByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
|
||||
.getVisibleText();
|
||||
async getToastMessage(findTimeout = defaultFindTimeout) {
|
||||
const toastMessage =
|
||||
await find.displayedByCssSelector('kbn-truncated.toast-message.ng-isolate-scope', findTimeout);
|
||||
return toastMessage.getVisibleText();
|
||||
}
|
||||
|
||||
async waitForToastMessageGone() {
|
||||
|
|
|
@ -22,6 +22,14 @@ export function FindProvider({ getService }) {
|
|||
log.debug(`Found ${elements.length} for selector ${selector}`);
|
||||
return elements;
|
||||
}
|
||||
|
||||
async displayedByCssSelector(selector, timeout = defaultFindTimeout) {
|
||||
log.debug('in displayedByCssSelector: ' + selector);
|
||||
const remoteWithTimeout = remote.setFindTimeout(timeout);
|
||||
const element = await remoteWithTimeout.findDisplayedByCssSelector(selector);
|
||||
remoteWithTimeout.setFindTimeout(defaultFindTimeout);
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
return new Find();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue