Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] update spy table headers when columns update #13224

Merged
merged 1 commit into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/ui/public/paginated_table/paginated_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
class="agg-table">
<div class="agg-table-paginated">
<table class="table table-condensed">
<thead>
<thead data-test-subj="paginated-table-header">
<tr>
<th
ng-repeat="col in ::columns"
ng-repeat="col in columns"
ng-click="paginatedTable.sortColumn($index)"
class="{{ col.class }}">
<span ng-bind="::col.title"></span>
Expand All @@ -25,7 +25,12 @@
</th>
</tr>
</thead>
<tbody kbn-rows="page" kbn-rows-min="paginatedTable.rowsToShow(perPage, page.length)"></tbody>
<tbody
data-test-subj="paginated-table-body"
kbn-rows="page"
kbn-rows-min="paginatedTable.rowsToShow(perPage, page.length)"
>
</tbody>
<tfoot ng-if="showTotal">
<tr>
<th ng-repeat="col in columns" class="numeric-value">{{col.total}}</th>
Expand Down
43 changes: 43 additions & 0 deletions test/functional/apps/visualize/_spy_panel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import expect from 'expect.js';

export default function ({ getService, getPageObjects }) {
const log = getService('log');
const PageObjects = getPageObjects(['common', 'visualize', 'header']);

describe('visualize app', function describeIndexTests() {
before(async function () {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.clickVerticalBarChart();
await PageObjects.visualize.clickNewSearch();

log.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
await PageObjects.visualize.clickGo();
await PageObjects.header.waitUntilLoadingHasFinished();
});

describe('spy panel tabel', function indexPatternCreation() {

it('should update table header when columns change', async function () {

await PageObjects.visualize.openSpyPanel();
let headers = await PageObjects.visualize.getDataTableHeaders();
expect(headers.trim()).to.equal('Count');

log.debug('Add Average Metric on machine.ram field');
await PageObjects.visualize.clickAddMetric();
await PageObjects.visualize.clickBucket('Y-Axis');
await PageObjects.visualize.selectAggregation('Average');
await PageObjects.visualize.selectField('machine.ram', 'metrics');
await PageObjects.visualize.clickGo();
await PageObjects.visualize.openSpyPanel();

headers = await PageObjects.visualize.getDataTableHeaders();
expect(headers.trim()).to.equal('Count Average machine.ram');
});
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/visualize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function ({ getService, loadTestFile }) {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC', 'defaultIndex': 'logstash-*' });
});

loadTestFile(require.resolve('./_spy_panel'));
loadTestFile(require.resolve('./_chart_types'));
loadTestFile(require.resolve('./_gauge_chart'));
loadTestFile(require.resolve('./_area_chart'));
Expand Down
8 changes: 7 additions & 1 deletion test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,16 @@ export function VisualizePageProvider({ getService, getPageObjects }) {

async getDataTableData() {
const dataTable = await retry.try(
async () => find.byCssSelector('table.table.table-condensed tbody', defaultFindTimeout * 2));
async () => testSubjects.find('paginated-table-body'));
return await dataTable.getVisibleText();
}

async getDataTableHeaders() {
const dataTableHeader = await retry.try(
async () => testSubjects.find('paginated-table-header'));
return await dataTableHeader.getVisibleText();
}

async getMarkdownData() {
const markdown = await retry.try(async () => find.byCssSelector('visualize.ng-isolate-scope'));
return await markdown.getVisibleText();
Expand Down