Skip to content

Commit

Permalink
5.x backport #9242 New scripted field tests (#9700)
Browse files Browse the repository at this point in the history
* new scripted field tests

* Final improvements on 12 new tests for 1 expression and 2 painless scripted fields

* Add try loops around testing first Discover doc

* Set timezone to UTC and adjusted data accordingly

* Added boolean and date Painless scripted field types

* Remove unused (non-working) methods

* Fix lint error

* Added several data-test-subj attributes and used them in the tests

* Reverting previous change to getBarChartData
  • Loading branch information
Lee Drengenberg authored Jan 2, 2017
1 parent b771d19 commit 4a58687
Show file tree
Hide file tree
Showing 11 changed files with 727 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
ng-click="toggleDisplay(field)"
ng-class="::field.display ? 'btn-danger' : 'btn-primary'"
ng-bind="::field.display ? 'remove' : 'add'"
class="btn btn-xs btn-primary discover-field-toggle" ></button>
class="btn btn-xs btn-primary discover-field-toggle" data-test-subj="fieldToggle-{{::field.name}}"></button>
</div>
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ <h5 ng-show="!field.details.error">Quick Count <kbn-info info="Top 5 values base
<div>
<span ng-show="field.filterable" class="pull-right">
<i aria-hidden="true" class="fa fa-search-minus pull-right discover-field-details-filter"
ng-click="updateFilterInQuery(field, bucket.value, '-')"></i>
ng-click="updateFilterInQuery(field, bucket.value, '-')" data-test-subj="minus-{{::field.name}}-{{::bucket.display}}"></i>
<i aria-hidden="true" class="fa fa-search-plus pull-right discover-field-details-filter"
ng-click="updateFilterInQuery(field, bucket.value, '+')"></i>
ng-click="updateFilterInQuery(field, bucket.value, '+')" data-test-subj="plus-{{::field.name}}-{{::bucket.display}}"></i>
</span>
<div css-truncate css-truncate-expandable="true" class="discover-field-details-value" title="{{::bucket.display}}">
{{::bucket.display}} <i ng-show="bucket.display === ''">Empty string</i>
Expand All @@ -45,7 +45,8 @@ <h5 ng-show="!field.details.error">Quick Count <kbn-info info="Top 5 values base
<a
ng-href="{{vizLocation(field)}}"
ng-show="field.visualizable"
class="sidebar-item-button primary">
class="sidebar-item-button primary"
data-test-subj="fieldVisualize-{{::field.name}}">
Visualize
<span class="discover-field-vis-warning" ng-show="warnings.length" tooltip="{{warnings.join(' ')}}">
( {{::warnings.length}} <ng-pluralize count="warnings.length" when="{'1':'warning', 'other':'warnings'}"></ng-pluralize> <i aria-hidden="true" class="fa fa-warning"></i> )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

<!-- tab list -->
<ul class="nav nav-tabs">
<li class="kbn-management-tab" ng-class="{ active: state.tab === editSection.index }" ng-repeat="editSection in editSections">
<a ng-click="changeTab(editSection)">
<li class="kbn-management-tab" ng-class="{ active: state.tab === editSection.index }" ng-repeat="editSection in editSections" data-test-subj="li-{{ editSection.index }}">
<a ng-click="changeTab(editSection)" data-test-subj="tab-{{ editSection.index }}" >
{{ editSection.title }}
<small>({{ editSection.count }})</small>
</a>
Expand Down
22 changes: 14 additions & 8 deletions src/ui/public/field_editor/field_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
required
placeholder="New Scripted Field"
input-focus
class="form-control">
class="form-control"
data-test-subj="editorFieldName">
</div>
<div ng-if="editor.creating && editor.indexPattern.fields.byName[editor.field.name]" class="hintbox">
<p>
Expand Down Expand Up @@ -41,7 +42,8 @@ <h4>
ng-model="editor.field.lang"
ng-options="lang as lang for lang in editor.scriptingLangs"
required
class="form-control">
class="form-control"
data-test-subj="editorFieldLang">
<option value="">-- Select Language --</option>
</select>
</div>
Expand All @@ -52,7 +54,8 @@ <h4>
ng-if="editor.field.scripted"
ng-model="editor.field.type"
ng-options="type as type for type in editor.fieldTypes"
class="form-control">
class="form-control"
data-test-subj="editorFieldType">
</select>
<input
ng-if="!editor.field.scripted"
Expand Down Expand Up @@ -81,7 +84,8 @@ <h4 class="hintbox-heading">
<select
ng-model="editor.selectedFormatId"
ng-options="format.id as format.title for format in editor.fieldFormatTypes"
class="form-control">
class="form-control"
data-test-subj="editorSelectedFormatId">
</select>
<fieldset
field-format-editor
Expand All @@ -98,22 +102,23 @@ <h4 class="hintbox-heading">
<input
ng-model="editor.field.count"
type="number"
class="form-control">
class="form-control"
data-test-subj=editorFieldCount>

<span class="input-group-btn">
<button
type="button"
ng-click="editor.field.count = editor.field.count + 1"
aria-label="Plus"
class="btn btn-default">
<i aria-hidden="true" class="fa fa-plus"></i>
<i aria-hidden="true" class="fa fa-plus" data-test-subj=editorFieldCountPlus></i>
</button>
<button
type="button"
ng-click="editor.field.count = editor.field.count - 1"
aria-label="Minus"
class="btn btn-default">
<i aria-hidden="true" class="fa fa-minus"></i>
<i aria-hidden="true" class="fa fa-minus" data-test-subj=editorFieldCountMinus></i>
</button>
</span>
</div>
Expand All @@ -122,7 +127,8 @@ <h4 class="hintbox-heading">
<div ng-if="editor.field.scripted">
<div class="form-group">
<label>Script</label>
<textarea required class="field-editor_script-input form-control text-monospace" ng-model="editor.field.script"></textarea>
<textarea required class="field-editor_script-input form-control text-monospace"
ng-model="editor.field.script" data-test-subj="editorFieldScript"></textarea>
</div>

<div class="form-group">
Expand Down
12 changes: 6 additions & 6 deletions src/ui/public/filter_bar/filter_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
<span ng-if="!filter.meta.alias">"{{ filter.meta.value }}"</span>
</div>
<div class="filter-actions">
<a class="action filter-toggle" ng-click="toggleFilter(filter)">
<a class="action filter-toggle" ng-click="toggleFilter(filter)" data-test-subj="disableFilter-{{ filter.meta.key }}">
<i ng-show="filter.meta.disabled" class="fa fa-fw fa-square-o disabled"></i>
<i ng-hide="filter.meta.disabled" class="fa fa-fw fa-check-square-o enabled"></i>
</a>
<a class="action filter-pin" ng-click="pinFilter(filter)">
<a class="action filter-pin" ng-click="pinFilter(filter)" data-test-subj="pinFilter-{{ filter.meta.key }}">
<i ng-show="filter.$state.store == 'globalState'" class="fa fa-fw fa-thumb-tack pinned"></i>
<i ng-hide="filter.$state.store == 'globalState'" class="fa fa-fw fa-thumb-tack fa-rotate-270 unpinned"></i>
</a>
<a class="action filter-invert" ng-click="invertFilter(filter)">
<a class="action filter-invert" ng-click="invertFilter(filter)" data-test-subj="invertFilter-{{ filter.meta.key }}">
<i ng-show="filter.meta.negate" class="fa fa-fw fa-search-plus negative"></i>
<i ng-hide="filter.meta.negate" class="fa fa-fw fa-search-minus positive"></i>
</a>
<a class="action filter-remove" ng-click="removeFilter(filter)">
<i class="fa fa-fw fa-trash"></i>
<i class="fa fa-fw fa-trash" data-test-subj="removeFilter-{{ filter.meta.key }}"></i>
</a>
<a class="action filter-edit" ng-click="startEditingFilter(filter)">
<i class="fa fa-fw fa-edit"></i>
Expand Down Expand Up @@ -73,7 +73,7 @@
<a ng-click="showFilterActions = !showFilterActions">
Actions
<i class="fa"
ng-class="{'fa-caret-down': showFilterActions, 'fa-caret-right': !showFilterActions}"></i>
ng-class="{'fa-caret-down': showFilterActions, 'fa-caret-right': !showFilterActions}" data-test-subj="showFilterActions"></i>
</a>
</div>
</div>
Expand Down Expand Up @@ -103,7 +103,7 @@
<div class="filter-description"><a ng-click="toggleAll()">Toggle</a></div>
</div>
<div class="filter-link">
<div class="filter-description"><a ng-click="removeAll()">Remove</a></div>
<div class="filter-description"><a ng-click="removeAll()" data-test-subj="removeAllFilters">Remove</a></div>
</div>
</div>
</div>
11 changes: 11 additions & 0 deletions test/functional/apps/management/_kibana_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,15 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
expect(advancedSetting).to.be('America/Phoenix');
});
});

bdd.after(function () {
return PageObjects.settings.clickKibanaSettings()
.then(function TestCallSetAdvancedSettingsForTimezone() {
PageObjects.common.saveScreenshot('Settings-advanced-tab');
PageObjects.common.debug('calling setAdvancedSetting');
return PageObjects.settings.setAdvancedSettings('dateFormat:tz', 'UTC');
});
});


});
Loading

0 comments on commit 4a58687

Please sign in to comment.