mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[functionalTests] prevent test failure by retrying find call
This commit is contained in:
parent
e20afd9b46
commit
52dbb264d2
4 changed files with 31 additions and 30 deletions
|
@ -45,7 +45,10 @@ uiModules.get('apps/management')
|
|||
{
|
||||
markup: nameHtml,
|
||||
scope: childScope,
|
||||
value: field.displayName
|
||||
value: field.displayName,
|
||||
attr: {
|
||||
'data-test-subj': 'indexedFieldName'
|
||||
}
|
||||
},
|
||||
{
|
||||
markup: typeHtml,
|
||||
|
|
|
@ -52,6 +52,10 @@ module.directive('kbnRows', function ($compile, $rootScope, getAppState, Private
|
|||
} else {
|
||||
$cell.html(contents.markup);
|
||||
}
|
||||
|
||||
if (contents.attr) {
|
||||
$cell.attr(contents.attr);
|
||||
}
|
||||
} else {
|
||||
if (contents === '') {
|
||||
$cell.html(' ');
|
||||
|
|
|
@ -77,10 +77,10 @@ bdd.describe('index result field sort', function describeIndexTests() {
|
|||
});
|
||||
|
||||
bdd.describe('field list pagination', function () {
|
||||
var expectedDefaultPageSize = 25;
|
||||
var expectedFieldCount = 85;
|
||||
var expectedLastPageCount = 10;
|
||||
var pages = [1, 2, 3, 4];
|
||||
const EXPECTED_DEFAULT_PAGE_SIZE = 25;
|
||||
const EXPECTED_FIELD_COUNT = 85;
|
||||
const EXPECTED_LAST_PAGE_COUNT = 10;
|
||||
const LAST_PAGE_NUMBER = 4;
|
||||
|
||||
bdd.before(function () {
|
||||
return PageObjects.settings.navigateTo()
|
||||
|
@ -97,7 +97,7 @@ bdd.describe('index result field sort', function describeIndexTests() {
|
|||
return PageObjects.common.try(function () {
|
||||
return PageObjects.settings.getFieldsTabCount()
|
||||
.then(function (tabCount) {
|
||||
expect(tabCount).to.be('' + expectedFieldCount);
|
||||
expect(tabCount).to.be('' + EXPECTED_FIELD_COUNT);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -105,30 +105,22 @@ bdd.describe('index result field sort', function describeIndexTests() {
|
|||
bdd.it('should have correct default page size selected', function () {
|
||||
return PageObjects.settings.getPageSize()
|
||||
.then(function (pageSize) {
|
||||
expect(pageSize).to.be('' + expectedDefaultPageSize);
|
||||
expect(pageSize).to.be('' + EXPECTED_DEFAULT_PAGE_SIZE);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should have the correct number of rows per page', function () {
|
||||
var pageCount = Math.ceil(expectedFieldCount / expectedDefaultPageSize);
|
||||
var chain = pages.reduce(function (chain, val) {
|
||||
return chain.then(function () {
|
||||
return PageObjects.settings.goToPage(val)
|
||||
.then(function () {
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function () {
|
||||
return PageObjects.settings.getPageFieldCount();
|
||||
})
|
||||
.then(function (pageCount) {
|
||||
PageObjects.common.saveScreenshot('Settings-indices-paged');
|
||||
var expectedSize = (val < 4) ? expectedDefaultPageSize : expectedLastPageCount;
|
||||
expect(pageCount.length).to.be(expectedSize);
|
||||
});
|
||||
});
|
||||
}, Promise.resolve());
|
||||
bdd.it('should have the correct number of rows per page', async function () {
|
||||
for (let pageNum = 1; pageNum <= LAST_PAGE_NUMBER; pageNum += 1) {
|
||||
await PageObjects.settings.goToPage(pageNum);
|
||||
const pageFieldNames = await PageObjects.common.tryMethod(PageObjects.settings, 'getFieldNames');
|
||||
await PageObjects.common.saveScreenshot(`Settings-indexed-fields-page-${pageNum}`);
|
||||
|
||||
return chain.catch(PageObjects.common.createErrorHandler(this));
|
||||
if (pageNum === LAST_PAGE_NUMBER) {
|
||||
expect(pageFieldNames).to.have.length(EXPECTED_LAST_PAGE_COUNT);
|
||||
} else {
|
||||
expect(pageFieldNames).to.have.length(EXPECTED_DEFAULT_PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}); // end describe pagination
|
||||
}); // end index result field sort
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
import Bluebird from 'bluebird';
|
||||
import Bluebird, { map as mapAsync } from 'bluebird';
|
||||
|
||||
import {
|
||||
defaultFindTimeout,
|
||||
|
@ -231,9 +231,11 @@ export default class SettingsPage {
|
|||
});
|
||||
}
|
||||
|
||||
getPageFieldCount() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr td.ng-scope:nth-child(1) span.ng-binding');
|
||||
async getFieldNames() {
|
||||
const fieldNameCells = await PageObjects.common.findAllTestSubjects('editIndexPattern indexedFieldName');
|
||||
return await mapAsync(fieldNameCells, async cell => {
|
||||
return (await cell.getVisibleText()).trim();
|
||||
});
|
||||
}
|
||||
|
||||
goToPage(pageNum) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue