mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Migrate all discover functional tests to use PageObjects.
This commit is contained in:
parent
007606e24a
commit
0a501b3b70
4 changed files with 82 additions and 79 deletions
|
@ -1,15 +1,14 @@
|
|||
|
||||
import expect from 'expect.js';
|
||||
|
||||
import {
|
||||
bdd,
|
||||
common,
|
||||
discoverPage,
|
||||
headerPage,
|
||||
scenarioManager,
|
||||
settingsPage,
|
||||
esClient,
|
||||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
var expect = require('expect.js');
|
||||
import PageObjects from '../../../support/page_objects';
|
||||
|
||||
bdd.describe('discover tab', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
|
@ -19,7 +18,7 @@ bdd.describe('discover tab', function describeIndexTests() {
|
|||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
PageObjects.common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
|
@ -27,46 +26,46 @@ bdd.describe('discover tab', function describeIndexTests() {
|
|||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
PageObjects.common.debug('discover');
|
||||
return PageObjects.common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
PageObjects.common.debug('setAbsoluteRange');
|
||||
return PageObjects.header.setAbsoluteRange(fromTime, toTime);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.describe('field data', function () {
|
||||
bdd.it('should initially be expanded', function () {
|
||||
common.saveScreenshot('Discover-sidebar-expanded');
|
||||
return discoverPage.getSidebarWidth()
|
||||
PageObjects.common.saveScreenshot('Discover-sidebar-expanded');
|
||||
return PageObjects.discover.getSidebarWidth()
|
||||
.then(function (width) {
|
||||
common.debug('expanded sidebar width = ' + width);
|
||||
PageObjects.common.debug('expanded sidebar width = ' + width);
|
||||
expect(width > 180).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should collapse when clicked', function () {
|
||||
return discoverPage.toggleSidebarCollapse()
|
||||
return PageObjects.discover.toggleSidebarCollapse()
|
||||
.then(function () {
|
||||
common.saveScreenshot('Discover-sidebar-collapsed');
|
||||
common.debug('discoverPage.getSidebarWidth()');
|
||||
return discoverPage.getSidebarWidth();
|
||||
PageObjects.common.saveScreenshot('Discover-sidebar-collapsed');
|
||||
PageObjects.common.debug('PageObjects.discover.getSidebarWidth()');
|
||||
return PageObjects.discover.getSidebarWidth();
|
||||
})
|
||||
.then(function (width) {
|
||||
common.debug('collapsed sidebar width = ' + width);
|
||||
PageObjects.common.debug('collapsed sidebar width = ' + width);
|
||||
expect(width < 20).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should expand when clicked', function () {
|
||||
return discoverPage.toggleSidebarCollapse()
|
||||
return PageObjects.discover.toggleSidebarCollapse()
|
||||
.then(function () {
|
||||
common.debug('discoverPage.getSidebarWidth()');
|
||||
return discoverPage.getSidebarWidth();
|
||||
PageObjects.common.debug('PageObjects.discover.getSidebarWidth()');
|
||||
return PageObjects.discover.getSidebarWidth();
|
||||
})
|
||||
.then(function (width) {
|
||||
common.debug('expanded sidebar width = ' + width);
|
||||
PageObjects.common.debug('expanded sidebar width = ' + width);
|
||||
expect(width > 180).to.be(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
import expect from 'expect.js';
|
||||
|
||||
import {
|
||||
bdd,
|
||||
common,
|
||||
discoverPage,
|
||||
headerPage,
|
||||
scenarioManager,
|
||||
settingsPage,
|
||||
esClient,
|
||||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
var expect = require('expect.js');
|
||||
import PageObjects from '../../../support/page_objects';
|
||||
|
||||
bdd.describe('discover app', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
|
@ -19,7 +18,7 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
PageObjects.common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
|
@ -27,12 +26,12 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
PageObjects.common.debug('discover');
|
||||
return PageObjects.common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
PageObjects.common.debug('setAbsoluteRange');
|
||||
return PageObjects.header.setAbsoluteRange(fromTime, toTime);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -44,12 +43,12 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
|
||||
bdd.it('search php should show the correct hit count', function () {
|
||||
var expectedHitCount = '445';
|
||||
return discoverPage.query('php')
|
||||
return PageObjects.discover.query('php')
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return PageObjects.discover.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
common.saveScreenshot('Discover-field-data');
|
||||
PageObjects.common.saveScreenshot('Discover-field-data');
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
|
@ -58,7 +57,7 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
|
||||
bdd.it('the search term should be highlighted in the field data', function () {
|
||||
// marks is the style that highlights the text in yellow
|
||||
return discoverPage.getMarks()
|
||||
return PageObjects.discover.getMarks()
|
||||
.then(function (marks) {
|
||||
expect(marks.length).to.be(50);
|
||||
expect(marks.indexOf('php')).to.be(0);
|
||||
|
@ -67,10 +66,10 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
|
||||
bdd.it('search _type:apache should show the correct hit count', function () {
|
||||
var expectedHitCount = '11,156';
|
||||
return discoverPage.query('_type:apache')
|
||||
return PageObjects.discover.query('_type:apache')
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getHitCount()
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return PageObjects.discover.getHitCount()
|
||||
.then(function compareData(hitCount) {
|
||||
expect(hitCount).to.be(expectedHitCount);
|
||||
});
|
||||
|
@ -80,7 +79,7 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
|
||||
bdd.it('doc view should show Time and _source columns', function () {
|
||||
var expectedHeader = 'Time _source';
|
||||
return discoverPage.getDocHeader()
|
||||
return PageObjects.discover.getDocHeader()
|
||||
.then(function (header) {
|
||||
expect(header).to.be(expectedHeader);
|
||||
});
|
||||
|
@ -131,7 +130,7 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
+ ' _type:apache _index:logstash-2015.09.22 _score: - relatedContent.article:modified_time:November 27th'
|
||||
+ ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th'
|
||||
+ ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000';
|
||||
return discoverPage.getDocTableIndex(1)
|
||||
return PageObjects.discover.getDocTableIndex(1)
|
||||
.then(function (rowData) {
|
||||
expect(rowData).to.be(ExpectedDoc);
|
||||
});
|
||||
|
@ -211,18 +210,18 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
+ ' 16:01:03.000 relatedContent.article:published_time:October 21st 2005, 01:10:25.000, March 5th 2006,'
|
||||
+ ' 01:03:42.000, December 13th 2006, 20:12:04.000, April 4th 2008, 23:00:00.000, April 25th 2008,'
|
||||
+ ' 14:26:41.000';
|
||||
return discoverPage.clickDocSortDown()
|
||||
return PageObjects.discover.clickDocSortDown()
|
||||
.then(function () {
|
||||
// we don't technically need this sleep here because the tryForTime will retry and the
|
||||
// results will match on the 2nd or 3rd attempt, but that debug output is huge in this
|
||||
// case and it can be avoided with just a few seconds sleep.
|
||||
return common.sleep(2000);
|
||||
return PageObjects.common.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return discoverPage.getDocTableIndex(1)
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return PageObjects.discover.getDocTableIndex(1)
|
||||
.then(function (rowData) {
|
||||
common.saveScreenshot('Discover-sort-down');
|
||||
PageObjects.common.saveScreenshot('Discover-sort-down');
|
||||
expect(rowData).to.be(ExpectedDoc);
|
||||
});
|
||||
});
|
||||
|
@ -233,16 +232,16 @@ bdd.describe('discover app', function describeIndexTests() {
|
|||
bdd.it('a bad syntax query should show an error message', function () {
|
||||
var expectedHitCount = '1011,156';
|
||||
var expectedError = 'Discover: Failed to parse query [xxx(yyy]';
|
||||
return discoverPage.query('xxx(yyy')
|
||||
return PageObjects.discover.query('xxx(yyy')
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
return PageObjects.header.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
common.saveScreenshot('Discover-syntax-error-toast');
|
||||
PageObjects.common.saveScreenshot('Discover-syntax-error-toast');
|
||||
expect(toastMessage).to.be(expectedError);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.clickToastOK();
|
||||
return PageObjects.header.clickToastOK();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
import expect from 'expect.js';
|
||||
|
||||
import {
|
||||
bdd,
|
||||
common,
|
||||
discoverPage,
|
||||
headerPage,
|
||||
settingsPage,
|
||||
scenarioManager,
|
||||
esClient,
|
||||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
var expect = require('expect.js');
|
||||
import PageObjects from '../../../support/page_objects';
|
||||
|
||||
bdd.describe('shared links', function describeIndexTests() {
|
||||
var baseUrl;
|
||||
|
@ -20,7 +19,7 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
var expectedToastMessage = /Share search: URL (selected\. Press Ctrl\+C to copy\.|copied to clipboard\.)/;
|
||||
|
||||
bdd.before(function () {
|
||||
baseUrl = common.getHostPort();
|
||||
baseUrl = PageObjects.common.getHostPort();
|
||||
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
@ -28,7 +27,7 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
.then(function loadkibanaIndexPattern() {
|
||||
common.debug('load kibana index with default index pattern');
|
||||
PageObjects.common.debug('load kibana index with default index pattern');
|
||||
return elasticDump.elasticLoad('visualize','.kibana');
|
||||
})
|
||||
// and load a set of makelogs data
|
||||
|
@ -36,17 +35,17 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('discover');
|
||||
return common.navigateToApp('discover');
|
||||
PageObjects.common.debug('discover');
|
||||
return PageObjects.common.navigateToApp('discover');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('setAbsoluteRange');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||
PageObjects.common.debug('setAbsoluteRange');
|
||||
return PageObjects.header.setAbsoluteRange(fromTime, toTime);
|
||||
})
|
||||
.then(function () {
|
||||
//After hiding the time picker, we need to wait for
|
||||
//the refresh button to hide before clicking the share button
|
||||
return common.sleep(1000);
|
||||
return PageObjects.common.sleep(1000);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -54,10 +53,10 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
bdd.describe('shared link', function () {
|
||||
bdd.it('should show "Share a link" caption', function () {
|
||||
var expectedCaption = 'Share a link';
|
||||
return discoverPage.clickShare()
|
||||
return PageObjects.discover.clickShare()
|
||||
.then(function () {
|
||||
common.saveScreenshot('Discover-share-link');
|
||||
return discoverPage.getShareCaption();
|
||||
PageObjects.common.saveScreenshot('Discover-share-link');
|
||||
return PageObjects.discover.getShareCaption();
|
||||
})
|
||||
.then(function (actualCaption) {
|
||||
expect(actualCaption).to.be(expectedCaption);
|
||||
|
@ -72,7 +71,7 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
+ '-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-'
|
||||
+ '*\',interval:auto,query:(query_string:(analyze_wildcard:!t,query'
|
||||
+ ':\'*\')),sort:!(\'@timestamp\',desc))';
|
||||
return discoverPage.getSharedUrl()
|
||||
return PageObjects.discover.getSharedUrl()
|
||||
.then(function (actualUrl) {
|
||||
// strip the timestamp out of each URL
|
||||
expect(actualUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'))
|
||||
|
@ -81,27 +80,27 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
});
|
||||
|
||||
bdd.it('should show toast message for copy to clipboard', function () {
|
||||
return discoverPage.clickCopyToClipboard()
|
||||
return PageObjects.discover.clickCopyToClipboard()
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
return PageObjects.header.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
common.saveScreenshot('Discover-copy-to-clipboard-toast');
|
||||
PageObjects.common.saveScreenshot('Discover-copy-to-clipboard-toast');
|
||||
expect(toastMessage).to.match(expectedToastMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
return PageObjects.header.waitForToastMessageGone();
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: verify clipboard contents
|
||||
bdd.it('shorten URL button should produce a short URL', function () {
|
||||
var re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$');
|
||||
return discoverPage.clickShortenUrl()
|
||||
return PageObjects.discover.clickShortenUrl()
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
common.saveScreenshot('Discover-shorten-url-button');
|
||||
return discoverPage.getShortenedUrl()
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
PageObjects.common.saveScreenshot('Discover-shorten-url-button');
|
||||
return PageObjects.discover.getShortenedUrl()
|
||||
.then(function (actualUrl) {
|
||||
expect(actualUrl).to.match(re);
|
||||
});
|
||||
|
@ -111,15 +110,15 @@ bdd.describe('shared links', function describeIndexTests() {
|
|||
|
||||
// NOTE: This test has to run immediately after the test above
|
||||
bdd.it('should show toast message for copy to clipboard', function () {
|
||||
return discoverPage.clickCopyToClipboard()
|
||||
return PageObjects.discover.clickCopyToClipboard()
|
||||
.then(function () {
|
||||
return headerPage.getToastMessage();
|
||||
return PageObjects.header.getToastMessage();
|
||||
})
|
||||
.then(function (toastMessage) {
|
||||
expect(toastMessage).to.match(expectedToastMessage);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.waitForToastMessageGone();
|
||||
return PageObjects.header.waitForToastMessageGone();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support';
|
||||
|
||||
import {
|
||||
bdd,
|
||||
remote,
|
||||
scenarioManager,
|
||||
defaultTimeout
|
||||
} from '../../../support';
|
||||
|
||||
import PageObjects from '../../../support/page_objects';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue