Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test support #11477

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ui/public/kbn_top_nav/kbn_top_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/notify/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/notify/partials/toaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
ng-class="action.getButtonClass()"
ng-click="action.callback()"
ng-bind="action.key"
data-test-subj="{{action.dataTestSubj}}"
></button>
</div>

Expand Down
9 changes: 5 additions & 4 deletions test/functional/page_objects/header_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 8 additions & 0 deletions test/functional/services/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down