diff --git a/src/core_plugins/console/public/index.html b/src/core_plugins/console/public/index.html index b6bf037c7e8b0..cff0ddc4cb8e3 100644 --- a/src/core_plugins/console/public/index.html +++ b/src/core_plugins/console/public/index.html @@ -1,4 +1,4 @@ - +
@@ -6,7 +6,10 @@
    - + @@ -26,14 +29,14 @@
    -
    GET _search +
    GET _search { "query": { "match_all": {} } }
    -
    +
    {}
    diff --git a/src/core_plugins/console/public/src/directives/sense_navbar.html b/src/core_plugins/console/public/src/directives/sense_navbar.html index 7ae8db40405b7..1e812bf049f8f 100644 --- a/src/core_plugins/console/public/src/directives/sense_navbar.html +++ b/src/core_plugins/console/public/src/directives/sense_navbar.html @@ -1 +1 @@ - + diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav.html b/src/ui/public/kbn_top_nav/kbn_top_nav.html index 5a26efde52b3f..574e437c8ccc7 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav.html +++ b/src/ui/public/kbn_top_nav/kbn_top_nav.html @@ -20,7 +20,7 @@
    -
    - +
    +
    diff --git a/test/functional/apps/console/_console.js b/test/functional/apps/console/_console.js index 32881b4ebf3b8..e997cc43a2f1a 100644 --- a/test/functional/apps/console/_console.js +++ b/test/functional/apps/console/_console.js @@ -1,12 +1,22 @@ import expect from 'expect.js'; +import PageObjects from '../../../support/page_objects'; import { bdd, scenarioManager } from '../../../support'; -import PageObjects from '../../../support/page_objects'; +const DEFAULT_REQUEST = ` + +GET _search +{ + "query": { + "match_all": {} + } +} + +`.trim(); bdd.describe('console app', function describeIndexTests() { bdd.before(function () { @@ -15,15 +25,6 @@ bdd.describe('console app', function describeIndexTests() { }); bdd.it('should show the default request', function () { - var expectedRequest = [ - 'GET _search', - '{', - ' "query": {', - ' "match_all": {}', - ' }', - '}', - '' - ]; PageObjects.common.saveScreenshot('Console-help-expanded'); // collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled return PageObjects.console.collapseHelp() @@ -32,14 +33,15 @@ bdd.describe('console app', function describeIndexTests() { return PageObjects.common.try(function () { return PageObjects.console.getRequest() .then(function (actualRequest) { - expect(actualRequest).to.eql(expectedRequest); + expect(actualRequest.trim()).to.eql(DEFAULT_REQUEST); }); }); }); }); bdd.it('default request response should contain .kibana' , function () { - var expectedResponseContains = '"_index": ".kibana",'; + const expectedResponseContains = '"_index": ".kibana",'; + return PageObjects.console.clickPlay() .then(function () { PageObjects.common.saveScreenshot('Console-default-request'); diff --git a/test/server_config.js b/test/server_config.js index a462a525685b9..e49a567b7ee31 100644 --- a/test/server_config.js +++ b/test/server_config.js @@ -43,7 +43,8 @@ module.exports = { hash: '/management' }, console: { - pathname: 'app/console', + pathname: kibanaURL, + hash: '/dev_tools/console', } } }; diff --git a/test/support/page_objects/console_page.js b/test/support/page_objects/console_page.js index f896eebade953..033d833a96006 100644 --- a/test/support/page_objects/console_page.js +++ b/test/support/page_objects/console_page.js @@ -1,59 +1,38 @@ +import Bluebird from 'bluebird'; +import PageObjects from './'; import { defaultFindTimeout, } from '../'; -export default class ConsolePage { - - init(remote) { - this.remote = remote; - this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout); - } +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'); +} - getServer() { - return this.findTimeout - .findByCssSelector('#kibana-body > div.content > div > div') - .getVisibleText(); - } +export default class ConsolePage { + init() { - setServer(server) { - return this.findTimeout - .findByCssSelector('input[aria-label="Server Name"]') - .clearValue() - .type(server); } - getRequest() { - return this.findTimeout - .findAllByCssSelector('div.ace_line_group') - .then(function (editorData) { - - function getEditorData(line) { - return line.getVisibleText(); - } - - var getEditorDataPromises = editorData.map(getEditorData); - return Promise.all(getEditorDataPromises); - }); + async getRequest() { + const requestEditor = await PageObjects.common.findTestSubject('console request-editor'); + return await getVisibleTextFromAceEditor(requestEditor); } - getResponse() { - return this.findTimeout - .findByCssSelector('#output > div.ace_scroller > div') - .getVisibleText(); + async getResponse() { + const responseEditor = await PageObjects.common.findTestSubject('console response-editor'); + return await getVisibleTextFromAceEditor(responseEditor); } - clickPlay() { - return this.findTimeout - .findByCssSelector('#editor_actions > span.ng-scope > a > i') - .click(); + async clickPlay() { + const sendRequestButton = await PageObjects.common.findTestSubject('console send-request-button'); + await sendRequestButton.click(); } - collapseHelp() { - return this.findTimeout - .findByCssSelector('div.config-close.remove > i') - .click(); - + async collapseHelp() { + const closeButton = await PageObjects.common.findTestSubject('console top-nav config-close-button'); + await closeButton.click(); } - }