[FTR] Add pause/resume auto refresh to header page object (#16618) (#16629)

* [FTR] Add pause/resume auto refresh to header page object

* remove unecessary promise.resolve
This commit is contained in:
Tim Sullivan 2018-02-09 10:05:27 -07:00 committed by GitHub
parent 0e5137f456
commit 56b85f017b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View file

@ -4,6 +4,8 @@
aria-label="{{ timefilter.refreshInterval.pause ? 'Resume refreshing data' : 'Pause refreshing data' }}"
ng-click="toggleRefresh()"
ng-show="timefilter.isAutoRefreshSelectorEnabled && (timefilter.refreshInterval.value > 0)"
data-test-subj="globalTimepickerAutoRefreshButton"
data-test-subj-state="{{ timefilter.refreshInterval.pause ? 'inactive' : 'active' }}"
>
<span
class="kuiIcon"

View file

@ -169,6 +169,30 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
.findByLinkText(quickTime).click();
}
async getAutoRefreshState() {
return testSubjects.getAttribute('globalTimepickerAutoRefreshButton', 'data-test-subj-state');
}
// check if the auto refresh state is active and to pause it
async pauseAutoRefresh() {
let result = false;
if (await this.getAutoRefreshState() === 'active') {
await testSubjects.click('globalTimepickerAutoRefreshButton');
result = true;
}
return result;
}
// check if the auto refresh state is inactive and to resume it
async resumeAutoRefresh() {
let result = false;
if (await this.getAutoRefreshState() === 'inactive') {
await testSubjects.click('globalTimepickerAutoRefreshButton');
result = true;
}
return result;
}
async getToastMessage(findTimeout = defaultFindTimeout) {
const toastMessage =
await find.displayedByCssSelector('kbn-truncated.toast-message.ng-isolate-scope', findTimeout);