Merge branch 'advancedSettings' into testVisualize
This commit is contained in:
commit
41fb59c392
8 changed files with 105 additions and 28 deletions
|
@ -130,6 +130,7 @@
|
|||
"whatwg-fetch": "0.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@spalger/test-subj-selector": "0.2.1",
|
||||
"Nonsense": "0.1.2",
|
||||
"angular-mocks": "1.4.7",
|
||||
"auto-release-sinon": "1.0.3",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<div class="app-container">
|
||||
<nav class="navbar navbar-default navbar-static-top subnav">
|
||||
<nav class="navbar navbar-default navbar-static-top subnav" data-test-subj="settingsNav">
|
||||
<div class="container-fluid">
|
||||
<ul class="nav navbar-nav">
|
||||
<li ng-repeat="section in sections" ng-class="section.class">
|
||||
<a class="navbar-link" kbn-href="{{section.url}}">{{section.display}}</a>
|
||||
<a class="navbar-link" kbn-href="{{section.url}}" data-test-subj="{{section.name}}">{{section.display}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<tr ng-class="conf.value === undefined ? 'default' : 'custom'">
|
||||
<tr ng-class="conf.value === undefined ? 'default' : 'custom'" data-test-subj="advancedSetting {{conf.name}}" >
|
||||
<td class="name">
|
||||
<b>{{conf.name}}</b>
|
||||
<span class="smaller" ng-show="!conf.isCustom && conf.value !== undefined">
|
||||
|
@ -59,12 +59,13 @@
|
|||
name="conf.name"
|
||||
ng-model="conf.unsavedValue"
|
||||
ng-options="option as option for option in conf.options"
|
||||
class="form-control">
|
||||
class="form-control"
|
||||
data-test-subj="selectInput">
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<!-- Setting display formats -->
|
||||
<span ng-if="!conf.editting">
|
||||
<span ng-if="!conf.editting" data-test-subj="currentValue">
|
||||
<span ng-show="(conf.normal || conf.json || conf.select)">{{conf.value || conf.defVal}}</span>
|
||||
<span ng-show="conf.array">{{(conf.value || conf.defVal).join(', ')}}</span>
|
||||
<span ng-show="conf.bool">{{conf.value === undefined ? conf.defVal : conf.value}}</span>
|
||||
|
@ -77,7 +78,8 @@
|
|||
ng-click="edit(conf)"
|
||||
class="btn btn-default"
|
||||
ng-disabled="conf.tooComplex"
|
||||
aria-label="Edit">
|
||||
aria-label="Edit"
|
||||
data-test-subj="editButton">
|
||||
<span class="sr-only">Edit</span>
|
||||
<i aria-hidden="true" class="fa fa-pencil"></i>
|
||||
</button>
|
||||
|
@ -87,7 +89,8 @@
|
|||
ng-click="save(conf)"
|
||||
class="btn btn-success"
|
||||
ng-disabled="conf.loading || conf.tooComplex || forms.configEdit.$invalid"
|
||||
aria-label="Save">
|
||||
aria-label="Save"
|
||||
data-test-subj="saveButton">
|
||||
<span class="sr-only">Save</span>
|
||||
<i aria-hidden="true" ng-if="!conf.loading" class="fa fa-save"></i>
|
||||
<i aria-hidden="true" ng-if="conf.loading" class="fa fa-spinner"></i>
|
||||
|
@ -98,7 +101,8 @@
|
|||
ng-click="clear(conf)"
|
||||
ng-hide="conf.value === undefined"
|
||||
class="btn btn-danger"
|
||||
aria-label="Clear">
|
||||
aria-label="Clear"
|
||||
data-test-subj="clearButton">
|
||||
<span class="sr-only">Clear</span>
|
||||
<i aria-hidden="true" class="fa fa-trash-o"></i>
|
||||
</button>
|
||||
|
@ -107,7 +111,8 @@
|
|||
ng-if="conf.editting"
|
||||
ng-click="cancelEdit(conf)"
|
||||
class="btn btn-default"
|
||||
aria-label="Cancel edit">
|
||||
aria-label="Cancel edit"
|
||||
data-test-subj="cancelButton">
|
||||
<span class="sr-only">Cancel Edit</span>
|
||||
<i aria-hidden="true" class="fa fa-times"></i>
|
||||
</button>
|
||||
|
|
24
src/ui/public/jquery/findTestSubject.js
vendored
24
src/ui/public/jquery/findTestSubject.js
vendored
|
@ -1,3 +1,5 @@
|
|||
var testSubjSelector = require('@spalger/test-subj-selector');
|
||||
|
||||
module.exports = function bindToJquery($) {
|
||||
|
||||
/**
|
||||
|
@ -41,28 +43,12 @@ module.exports = function bindToJquery($) {
|
|||
*/
|
||||
$.fn.findTestSubject = findTestSubject;
|
||||
|
||||
function findTestSubject(/* ...subjectSelectors */) {
|
||||
var subjectSelectors = [].slice.apply(arguments);
|
||||
function findTestSubject(...subjectSelectors) {
|
||||
var $els = $();
|
||||
var $context = this;
|
||||
|
||||
subjectSelectors.forEach(function (subjectSelector) {
|
||||
var cssSelectors = [];
|
||||
var terms = subjectSelector
|
||||
.replace(/\s*&\s*/g, '&') // remove all whitespace around joins
|
||||
.split(/\s+/);
|
||||
|
||||
function termToCssSelector(term) {
|
||||
return term ? '[data-test-subj~="' + term + '"]' : '';
|
||||
}
|
||||
|
||||
while (terms.length) {
|
||||
var term = terms.shift();
|
||||
// split each term by joins/& and map to css selectors
|
||||
cssSelectors.push(term.split('&').map(termToCssSelector).join(''));
|
||||
}
|
||||
|
||||
$els = $els.add($context.find(cssSelectors.join(' ')));
|
||||
subjectSelectors.forEach(function (selector) {
|
||||
$els = $els.add($context.find(testSubjSelector(selector)));
|
||||
});
|
||||
|
||||
return $els;
|
||||
|
|
47
test/functional/apps/settings/_advanced_settings.js
Normal file
47
test/functional/apps/settings/_advanced_settings.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
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, scenarioManager) {
|
||||
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;
|
||||
|
||||
return scenarioManager.reload('emptyKibana')
|
||||
.then(function () {
|
||||
return settingsPage.navigateTo();
|
||||
});
|
||||
});
|
||||
|
||||
bdd.describe('index pattern creation', function indexPatternCreation() {
|
||||
bdd.before(function () {
|
||||
return settingsPage.createIndexPattern();
|
||||
});
|
||||
|
||||
bdd.it('should allow setting advanced settings', function () {
|
||||
return settingsPage.clickAdvancedTab()
|
||||
.then(function TestCallSetAdvancedSettingsForTimezone() {
|
||||
common.log('calling setAdvancedSetting');
|
||||
return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
|
||||
})
|
||||
.then(function GetAdvancedSetting() {
|
||||
return settingsPage.getAdvancedSettings('dateFormat:tz');
|
||||
})
|
||||
.then(function (advancedSetting) {
|
||||
expect(advancedSetting).to.be('America/Phoenix');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
|
@ -9,6 +9,7 @@ define(function (require) {
|
|||
var indexPatternCreateDeleteTest = require('./_index_pattern_create_delete');
|
||||
var indexPatternResultsSortTest = require('./_index_pattern_results_sort');
|
||||
var indexPatternPopularityTest = require('./_index_pattern_popularity');
|
||||
var advancedSettingsTest = require('./_advanced_settings');
|
||||
|
||||
bdd.describe('settings app', function () {
|
||||
var scenarioManager = new ScenarioManager(url.format(config.servers.elasticsearch));
|
||||
|
@ -30,6 +31,7 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
advancedSettingsTest(bdd, scenarioManager);
|
||||
initialStateTest(bdd, scenarioManager);
|
||||
creationChangesTest(bdd, scenarioManager);
|
||||
indexPatternCreateDeleteTest(bdd, scenarioManager);
|
||||
|
|
|
@ -3,6 +3,7 @@ define(function (require) {
|
|||
var config = require('intern').config;
|
||||
var Promise = require('bluebird');
|
||||
var moment = require('moment');
|
||||
var testSubjSelector = require('intern/dojo/node!@spalger/test-subj-selector');
|
||||
var getUrl = require('intern/dojo/node!../../utils/getUrl');
|
||||
var fs = require('intern/dojo/node!fs');
|
||||
var path = require('intern/dojo/node!path');
|
||||
|
@ -203,6 +204,11 @@ define(function (require) {
|
|||
.catch(function (err) {
|
||||
self.log('SCREENSHOT FAILED: ' + err);
|
||||
});
|
||||
},
|
||||
|
||||
findTestSubject: function findTestSubject(selector) {
|
||||
console.log('in findTestSubject: ' + selector);
|
||||
return this.remote.findByCssSelector(testSubjSelector(selector));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,36 @@ define(function (require) {
|
|||
SettingsPage.prototype = {
|
||||
constructor: SettingsPage,
|
||||
|
||||
clickAdvancedTab: function () {
|
||||
console.log('in clickAdvancedTab');
|
||||
return common.findTestSubject('settingsNav advanced').click();
|
||||
},
|
||||
|
||||
setAdvancedSettings: function setAdvancedSettings(propertyName, propertyValue) {
|
||||
var self = this;
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' editButton')
|
||||
.click()
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
})
|
||||
.then(function setAdvancedSettingsClickPropertyValue(selectList) {
|
||||
return self.remote.findByCssSelector('option[label="' + propertyValue + '"]')
|
||||
.click();
|
||||
})
|
||||
.then(function setAdvancedSettingsClickSaveButton() {
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' saveButton')
|
||||
.click();
|
||||
});
|
||||
},
|
||||
|
||||
getAdvancedSettings: function getAdvancedSettings(propertyName) {
|
||||
var self = this;
|
||||
console.log('in setAdvancedSettings');
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
|
||||
.getVisibleText();
|
||||
},
|
||||
|
||||
|
||||
navigateTo: function () {
|
||||
return common.navigateToApp('settings');
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue