Skip to content

Commit

Permalink
attempting to get tests to pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Feb 27, 2020
1 parent f6b2cee commit 78a7405
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('discover field chooser directives', function() {

describe('Field listing', function() {
it('should have Selected Fields, Fields and Popular Fields sections', function() {
const headers = $elem.find('.sidebar-list-header');
const headers = $elem.find('[data-test-subj="discover-sidebar-list-header"]');
expect(headers.length).to.be(3);
});

Expand Down Expand Up @@ -168,7 +168,9 @@ describe('discover field chooser directives', function() {
it('should show the popular fields header if there are popular fields', function() {
const section = getSections($elem);
expect(section.popular.hasClass('ng-hide')).to.be(false);
expect(section.popular.find('li:not(.sidebar-list-header)').length).to.be.above(0);
expect(
section.popular.find('li:not([data-test-subj="discover-sidebar-list-header"])').length
).to.be.above(0);
});

it('should not show the popular fields if there are not any', function() {
Expand All @@ -190,7 +192,9 @@ describe('discover field chooser directives', function() {

$scope.$digest();
expect(section.popular.hasClass('ng-hide')).to.be(true);
expect(section.popular.find('li:not(.sidebar-list-header)').length).to.be(0);
expect(
section.popular.find('li:not([data-test-subj="discover-sidebar-list-header"])').length
).to.be(0);
});

it('should move the field into selected when it is added to the columns array', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
flex-direction: column;
height: 100%;
overflow: hidden;

.sidebar-container {
background-color: transparent;
}
}

.dscApp__header {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import 'no_results';
@import 'histogram';
@import './collapsible_sidebar/index';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import 'depth';
@import 'collapsible_sidebar';
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const DiscoverGrid = React.memo(function DiscoverGridInner({
onAddColumn,
}: Props) {
const actionColumnId = 'uniqueString'; // TODO should be guaranteed unique...
const lowestPageSize = 50;
const lowestPageSize = 500;
const timeString = i18n.translate('kbn.discover.timeLabel', {
defaultMessage: 'Time',
});
Expand Down Expand Up @@ -338,7 +338,7 @@ export const DiscoverGrid = React.memo(function DiscoverGridInner({
...pagination,
onChangeItemsPerPage,
onChangePage,
pageSizeOptions: [lowestPageSize, 100, 500],
pageSizeOptions: [lowestPageSize],
}}
toolbarVisibility={{
showColumnSelector: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<section class="dscFieldChooser__section" aria-label="{{::'kbn.discover.fieldChooser.filter.indexAndFieldsSectionAriaLabel' | i18n: {defaultMessage: 'Index and fields'} }}">
<section
class="dscFieldChooser__section"
aria-label="{{::'kbn.discover.fieldChooser.filter.indexAndFieldsSectionAriaLabel' | i18n: {defaultMessage: 'Index and fields'} }}"
>
<div class="dscFieldChooser__sectionStatic">

<discover-index-pattern-select
selected-index-pattern="selectedIndexPattern"
set-index-pattern="setIndexPattern"
index-pattern-list="indexPatternList"
>
</discover-index-pattern-select>
<form>
<discover-field-search
on-change="setFilterValue"
value="filter.vals.name"
types="fieldTypes"
>
<discover-field-search on-change="setFilterValue" value="filter.vals.name" types="fieldTypes">
</discover-field-search>
</form>
</div>
Expand All @@ -25,6 +23,7 @@
tabindex="0"
i18n-id="kbn.discover.fieldChooser.filter.selectedFieldsTitle"
i18n-default-message="Selected fields"
data-test-subj="discover-sidebar-list-header"
></h3>
<ul class="dscFieldList dscFieldList--selected" aria-labelledby="selected_fields">
<discover-field
Expand All @@ -43,10 +42,11 @@
tabindex="0"
i18n-id="kbn.discover.fieldChooser.filter.availableFieldsTitle"
i18n-default-message="Available fields"
data-test-subj="discover-sidebar-list-header"
ng-if="fields.length"
></h3>
</div>
<div class="euiFlexGroup euiFlexGroup--gutterMedium" ng-if="fields.length">

<div class="euiFlexItem euiFlexItem--flexGrowZero">
<button
ng-click="$parent.showFields = !$parent.showFields"
Expand All @@ -65,7 +65,8 @@
<ul
ng-show="(popularFields | filter:filter.isFieldFilteredAndNotDisplayed).length > 0"
ng-class="{ 'hidden-sm': !showFields, 'hidden-xs': !showFields }"
class="dscFieldList dscFieldList--popular">
class="dscFieldList dscFieldList--popular"
>
<li>
<h6
i18n-id="kbn.discover.fieldChooser.filter.popularTitle"
Expand All @@ -85,7 +86,8 @@

<ul
ng-class="{ 'hidden-sm': !showFields, 'hidden-xs': !showFields }"
class="dscFieldList dscFieldList--unpopular">
class="dscFieldList dscFieldList--unpopular"
>
<discover-field
ng-repeat="field in unpopularFields | filter:filter.isFieldFilteredAndNotDisplayed"
field="field"
Expand All @@ -97,5 +99,4 @@
</discover-field>
</ul>
</div>

</section>
4 changes: 2 additions & 2 deletions test/functional/page_objects/discover_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
}

async getAllFieldNames() {
const items = await find.allByCssSelector('.sidebar-item');
const items = await find.allByCssSelector('.dscSidebarItem');
return await Promise.all(items.map(item => item.getVisibleText()));
}

async getSidebarWidth() {
const sidebar = await find.byCssSelector('.sidebar-list');
const sidebar = await find.byCssSelector('.dscFieldChooser__section');
return await sidebar.getAttribute('clientWidth');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ filter-bar,

/* hide unusable controls */
discover-app .dscTimechart,
discover-app .sidebar-container,
discover-app .kbnCollapsibleSidebar__collapseButton,
discover-app navbar[name=discover-search],
discover-app .discover-table-footer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ filter-bar,

/* hide unusable controls */
discover-app .dscTimechart,
discover-app .sidebar-container,
discover-app .kbnCollapsibleSidebar__collapseButton,
discover-app navbar[name="discover-search"],
discover-app .discover-table-footer {
Expand Down

0 comments on commit 78a7405

Please sign in to comment.