-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from w33ble/functional-tests-settings-bdd
Functional tests switched to bdd syntax
- Loading branch information
Showing
17 changed files
with
694 additions
and
664 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ target | |
.idea | ||
*.iml | ||
*.log | ||
screenshot*.png | ||
/esvm | ||
.htpasswd | ||
.eslintcache | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
define(function (require) { | ||
var Common = require('../../../support/pages/Common'); | ||
var SettingsPage = require('../../../support/pages/SettingsPage'); | ||
var expect = require('intern/dojo/node!expect.js'); | ||
|
||
return function (bdd) { | ||
bdd.describe('create button states', function () { | ||
var common; | ||
var settingsPage; | ||
|
||
bdd.before(function () { | ||
common = new Common(this.remote); | ||
settingsPage = new SettingsPage(this.remote); | ||
}); | ||
|
||
bdd.it('should not be initially enabled', function () { | ||
return settingsPage.getCreateButton().isEnabled() | ||
.then(function (enabled) { | ||
expect(enabled).to.not.be.ok(); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
bdd.it('should be enabled after selecting time field option', function () { | ||
// select a time field and check that Create button is enabled | ||
return settingsPage.selectTimeFieldOption('@timestamp') | ||
.then(function () { | ||
return settingsPage.getCreateButton().isEnabled() | ||
.then(function (enabled) { | ||
expect(enabled).to.be.ok(); | ||
}); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
}); | ||
}; | ||
}); |
109 changes: 109 additions & 0 deletions
109
test/functional/apps/settings/_index_pattern_create_delete.js
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
define(function (require) { | ||
var Common = require('../../../support/pages/Common'); | ||
var SettingsPage = require('../../../support/pages/SettingsPage'); | ||
var expect = require('intern/dojo/node!expect.js'); | ||
var Promise = require('bluebird'); | ||
|
||
return function (bdd) { | ||
bdd.describe('creating and deleting default index', function describeIndexTests() { | ||
var common; | ||
var settingsPage; | ||
var remote; | ||
|
||
bdd.before(function () { | ||
common = new Common(this.remote); | ||
settingsPage = new SettingsPage(this.remote); | ||
remote = this.remote; | ||
}); | ||
|
||
|
||
bdd.describe('index pattern creation', function indexPatternCreation() { | ||
bdd.beforeEach(function be() { | ||
return settingsPage.createIndex(); | ||
}); | ||
|
||
bdd.afterEach(function ae() { | ||
var expectedAlertText = 'Are you sure you want to remove this index pattern?'; | ||
return settingsPage.removeIndex() | ||
.then(function (alertText) { | ||
expect(alertText).to.be(expectedAlertText); | ||
}); | ||
}); | ||
|
||
bdd.it('should have index pattern in page header', function pageHeader() { | ||
return settingsPage.getIndexPageHeading().getVisibleText() | ||
.then(function (patternName) { | ||
expect(patternName).to.be('logstash-*'); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
bdd.it('should have index pattern in url', function url() { | ||
return common.tryForTime(5000, function () { | ||
return remote.getCurrentUrl() | ||
.then(function (currentUrl) { | ||
expect(currentUrl).to.contain('logstash-*'); | ||
}); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
bdd.it('should have expected table headers', function checkingHeader() { | ||
return settingsPage.getTableHeader() | ||
.then(function (headers) { | ||
var expectedHeaders = [ | ||
'name', | ||
'type', | ||
'format', | ||
'analyzed', | ||
'indexed', | ||
'controls' | ||
]; | ||
|
||
// 6 name type format analyzed indexed controls | ||
expect(headers.length).to.be(expectedHeaders.length); | ||
|
||
var comparedHeaders = headers.map(function compareHead(header, i) { | ||
return header.getVisibleText() | ||
.then(function (text) { | ||
expect(text).to.be(expectedHeaders[i]); | ||
}); | ||
}); | ||
|
||
return Promise.all(comparedHeaders); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
}); | ||
|
||
|
||
bdd.describe('index pattern deletion', function indexDelete() { | ||
|
||
bdd.beforeEach(function be() { | ||
return settingsPage.createIndex() | ||
.then(function () { | ||
return settingsPage.removeIndex(); | ||
}); | ||
}); | ||
|
||
bdd.it('should return to index pattern creation page', function returnToPage() { | ||
return common.tryForTime(5000, function () { | ||
return settingsPage.getCreateButton(); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
bdd.it('should remove index pattern from url', function indexNotInUrl() { | ||
return common.tryForTime(3000, function () { | ||
return remote.getCurrentUrl() | ||
.then(function (currentUrl) { | ||
expect(currentUrl).to.not.contain('logstash-*'); | ||
}); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
}); | ||
|
||
}); | ||
}; | ||
}); |
109 changes: 109 additions & 0 deletions
109
test/functional/apps/settings/_index_pattern_popularity.js
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
define(function (require) { | ||
var Common = require('../../../support/pages/Common'); | ||
var SettingsPage = require('../../../support/pages/SettingsPage'); | ||
var expect = require('intern/dojo/node!expect.js'); | ||
//var Promise = require('bluebird'); | ||
|
||
return function (bdd) { | ||
bdd.describe('index result popularity', function describeIndexTests() { | ||
var common; | ||
var settingsPage; | ||
var remote; | ||
|
||
bdd.before(function () { | ||
common = new Common(this.remote); | ||
settingsPage = new SettingsPage(this.remote); | ||
remote = this.remote; | ||
}); | ||
|
||
bdd.beforeEach(function be() { | ||
return settingsPage.createIndex(); | ||
}); | ||
|
||
bdd.afterEach(function ae() { | ||
return settingsPage.removeIndex(); | ||
}); | ||
|
||
bdd.describe('change popularity', function indexPatternCreation() { | ||
var fieldName = 'geo.coordinates'; | ||
|
||
// set the page size to All again, https://github.com/elastic/kibana/issues/5030 | ||
// TODO: remove this after #5030 is closed | ||
function fix5030() { | ||
return settingsPage.setPageSize('All') | ||
.then(function () { | ||
return common.sleep(1000); | ||
}); | ||
} | ||
|
||
bdd.beforeEach(function () { | ||
// increase Popularity of geo.coordinates | ||
return settingsPage.setPageSize('All') | ||
.then(function () { | ||
return common.sleep(1000); | ||
}) | ||
.then(function openControlsByName() { | ||
return settingsPage.openControlsByName(fieldName); | ||
}) | ||
.then(function increasePopularity() { | ||
return settingsPage.increasePopularity(); | ||
}); | ||
}); | ||
|
||
bdd.afterEach(function () { | ||
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value) | ||
return settingsPage.controlChangeCancel(); | ||
}); | ||
|
||
bdd.it('should update the popularity input', function () { | ||
return settingsPage.getPopularity() | ||
.then(function (popularity) { | ||
expect(popularity).to.be('1'); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
bdd.it('should be reset on cancel', function pageHeader() { | ||
// Cancel saving the popularity change | ||
|
||
return settingsPage.controlChangeCancel() | ||
.then(function () { | ||
return fix5030(); | ||
}) | ||
.then(function openControlsByName() { | ||
return settingsPage.openControlsByName(fieldName); | ||
}) | ||
// check that its 0 (previous increase was cancelled) | ||
.then(function getPopularity() { | ||
return settingsPage.getPopularity() | ||
}) | ||
.then(function (popularity) { | ||
expect(popularity).to.be('0'); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
bdd.it('can be saved', function pageHeader() { | ||
// Saving the popularity change | ||
return settingsPage.controlChangeSave() | ||
.then(function () { | ||
return fix5030(); | ||
}) | ||
.then(function openControlsByName() { | ||
return settingsPage.openControlsByName(fieldName); | ||
}) | ||
// check that its 0 (previous increase was cancelled) | ||
.then(function getPopularity() { | ||
return settingsPage.getPopularity(); | ||
}) | ||
.then(function (popularity) { | ||
expect(popularity).to.be('1'); | ||
}) | ||
.catch(common.handleError(this)); | ||
}); | ||
|
||
}); // end 'change popularity' | ||
|
||
}); // end index result popularity | ||
}; | ||
}); |
Oops, something went wrong.