Skip to content

Commit

Permalink
Add debug code to flaky field_data test (#15535)
Browse files Browse the repository at this point in the history
* Add debug code to flaky field_data test

* update helper to match new UI
  • Loading branch information
Bargs committed Mar 28, 2018
1 parent 26b28dc commit a89027b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
Expand Up @@ -30,7 +30,7 @@ <h3 class="euiTitle euiTitle--small">
</h3>
<div class="euiCodeBlock euiCodeBlock--light euiCodeBlock--fontSmall euiCodeBlock--paddingSmall">
<code class="euiCodeBlock__code">
<pre class="euiCodeBlock__pre">{{req.resp | json}}</pre>
<pre class="euiCodeBlock__pre" data-test-subj="visualizationEsResponseBody">{{req.resp | json}}</pre>
</code>
</div>
</div>
Expand Down
21 changes: 17 additions & 4 deletions test/functional/apps/discover/_field_data.js
Expand Up @@ -4,7 +4,8 @@ export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'header', 'discover']);
const log = getService('log');
const PageObjects = getPageObjects(['common', 'header', 'discover', 'visualize']);

describe('discover app', function describeIndexTests() {
before(async function () {
Expand Down Expand Up @@ -68,7 +69,7 @@ export default function ({ getService, getPageObjects }) {
});
});

it.skip('doc view should show oldest time first', function () {
it('doc view should show oldest time first', function () {
// Note: Could just check the timestamp, but might as well check that the whole doc is as expected.
const ExpectedDoc =
'September 22nd 2015, 23:50:13.253\ntype:apache index:logstash-2015.09.22 @timestamp:September 22nd 2015, 23:50:13.253'
Expand Down Expand Up @@ -114,8 +115,20 @@ export default function ({ getService, getPageObjects }) {
+ ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th'
+ ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000';
return PageObjects.discover.getDocTableIndex(1)
.then(function (rowData) {
expect(rowData).to.be(ExpectedDoc);
.then(async function (rowData) {
try {
expect(rowData).to.be(ExpectedDoc);
}
catch (e) {
const esResponse = JSON.parse(await PageObjects.visualize.getVisualizationResponse());
const rawActualDoc = esResponse.hits.hits.find(function (hit) {
return hit._id === 'AU_x3_g4GFA8no6QjkYX' && hit._index === 'logstash-2015.09.22';
});
log.info('Attemping to get more debug info on this flaky test. Ping @bargs if you see this fail');
log.info(JSON.stringify(rawActualDoc));
await PageObjects.visualize.closeSpyPanel();
throw e;
}
});
});

Expand Down
7 changes: 7 additions & 0 deletions test/functional/page_objects/visualize_page.js
Expand Up @@ -795,6 +795,13 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
return await testSubjects.getVisibleText('visualizationEsRequestBody');
}

async getVisualizationResponse() {
log.debug('getVisualizationResponse');
await this.openSpyPanel();
await testSubjects.click('spyModeSelect-response');
return await testSubjects.getVisibleText('visualizationEsResponseBody');
}

async getMapBounds() {
const request = await this.getVisualizationRequest();
const requestObject = JSON.parse(request);
Expand Down

0 comments on commit a89027b

Please sign in to comment.