forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pageObjects/console] update selectors to use test subjects
- Loading branch information
spalger
committed
Sep 13, 2016
1 parent
c25ac3c
commit a2d37fc
Showing
5 changed files
with
45 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/core_plugins/console/public/src/directives/sense_navbar.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<kbn-top-nav name="timelion" ng-if="sense" config="navbar.menu"></kbn-top-nav> | ||
<kbn-top-nav name="console" ng-if="sense" config="navbar.menu" data-test-subj="top-nav"></kbn-top-nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |