kibana-123
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
72 lines (57 loc) • 2.12 kB
JavaScript
import Bluebird from 'bluebird';
import PageObjects from './';
import {
defaultFindTimeout,
} from '../';
async function getVisibleTextFromAceEditor(editor) {
const lines = await editor.findAllByClassName('ace_line_group');
const linesText = await Bluebird.map(lines, l => l.getVisibleText());
return linesText.join('\n');
}
export default class ConsolePage {
init(remote) {
this.remote = remote;
}
async getRequestEditor() {
return await PageObjects.common.findTestSubject('request-editor');
}
async getRequest() {
const requestEditor = await this.getRequestEditor();
return await getVisibleTextFromAceEditor(requestEditor);
}
async getResponse() {
const responseEditor = await PageObjects.common.findTestSubject('response-editor');
return await getVisibleTextFromAceEditor(responseEditor);
}
async clickPlay() {
const sendRequestButton = await PageObjects.common.findTestSubject('send-request-button');
await sendRequestButton.click();
}
async collapseHelp() {
const closeButton = await PageObjects.common.findTestSubject('help-close-button');
await closeButton.click();
}
async openSettings() {
const settingsButton = await PageObjects.common.findTestSubject('consoleSettingsButton');
await settingsButton.click();
}
async setFontSizeSetting(newSize) {
await this.openSettings();
// while the settings form opens/loads this may fail, so retry for a while
await PageObjects.common.try(async () => {
const fontSizeInput = await PageObjects.common.findTestSubject('setting-font-size-input');
await fontSizeInput.clearValue();
await fontSizeInput.click();
await fontSizeInput.type(String(newSize));
});
const saveButton = await PageObjects.common.findTestSubject('settings-save-button');
await saveButton.click();
}
async getFontSize(editor) {
const aceLine = await editor.findByClassName('ace_line');
return await aceLine.getComputedStyle('font-size');
}
async getRequestFontSize() {
return await this.getFontSize(await this.getRequestEditor());
}
}