kibana/x-pack/test/functional/page_objects/monitoring_page.ts
Spencer bdafd27e19
[ts] migrate x-pack/test to composite ts project (#101441)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-06-08 12:54:05 -04:00

49 lines
1.6 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrService } from '../ftr_provider_context';
export class MonitoringPageObject extends FtrService {
private readonly common = this.ctx.getPageObject('common');
private readonly header = this.ctx.getPageObject('header');
private readonly testSubjects = this.ctx.getService('testSubjects');
async getAccessDeniedMessage() {
return this.testSubjects.getVisibleText('accessDeniedTitle');
}
async clickBreadcrumb(subj: string) {
return this.testSubjects.click(subj);
}
async assertTableNoData(subj: string) {
if (!(await this.testSubjects.exists(subj))) {
throw new Error('Expected to find the no data message');
}
}
async tableGetRows(subj: string) {
const table = await this.testSubjects.find(subj);
return table.findAllByTagName('tr');
}
async tableGetRowsFromContainer(subj: string) {
const table = await this.testSubjects.find(subj);
const tbody = await table.findByTagName('tbody');
return tbody.findAllByTagName('tr');
}
async tableSetFilter(subj: string, text: string) {
await this.testSubjects.setValue(subj, text);
await this.common.pressEnterKey();
await this.header.waitUntilLoadingHasFinished();
}
async tableClearFilter(subj: string) {
return await this.testSubjects.setValue(subj, ' \uE003'); // space and backspace to trigger onChange event
}
}