Update functional tests to run faster and pass locally (#39557) (#39650)

* [shakespeare] adjust verification to pass in both headless/head runs

* [services/visualizations/pie_chart] speedup tests with timeout decrease

* [services/dashboard/expectations] speedup tests with timeout decrease
This commit is contained in:
Dmitry Lemeshko 2019-06-26 10:26:40 +03:00 committed by GitHub
parent 09f97ec67d
commit aec6d9e0c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View file

@ -68,7 +68,7 @@ export default function ({ getService, getPageObjects }) {
const data = await PageObjects.visualize.getBarChartData('Count');
log.debug('data=' + data);
log.debug('data.length=' + data.length);
expect(data).to.eql(expectedChartValues);
expect(data[0] - expectedChartValues[0]).to.be.lessThan(5);
});
});

View file

@ -26,6 +26,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
const find = getService('find');
const filterBar = getService('filterBar');
const PageObjects = getPageObjects(['dashboard', 'visualize']);
const findTimeout = 2500;
return new class DashboardExpect {
@ -48,7 +49,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async selectedLegendColorCount(color, expectedCount) {
log.debug(`DashboardExpect.selectedLegendColorCount(${color}, ${expectedCount})`);
await retry.try(async () => {
const selectedLegendColor = await testSubjects.findAll(`legendSelectedColor-${color}`);
const selectedLegendColor = await testSubjects.findAll(`legendSelectedColor-${color}`, findTimeout);
expect(selectedLegendColor.length).to.be(expectedCount);
});
}
@ -56,7 +57,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async docTableFieldCount(expectedCount) {
log.debug(`DashboardExpect.docTableFieldCount(${expectedCount})`);
await retry.try(async () => {
const docTableCells = await testSubjects.findAll('docTableField');
const docTableCells = await testSubjects.findAll('docTableField', findTimeout);
expect(docTableCells.length).to.be(expectedCount);
});
}
@ -64,7 +65,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async tsvbTimeSeriesLegendCount(expectedCount) {
log.debug(`DashboardExpect.tsvbTimeSeriesLegendCount(${expectedCount})`);
await retry.try(async () => {
const tsvbLegendItems = await testSubjects.findAll('tsvbLegendItem');
const tsvbLegendItems = await testSubjects.findAll('tsvbLegendItem', findTimeout);
expect(tsvbLegendItems.length).to.be(expectedCount);
});
}
@ -140,7 +141,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async timelionLegendCount(expectedCount) {
log.debug(`DashboardExpect.timelionLegendCount(${expectedCount})`);
await retry.try(async () => {
const flotLegendLabels = await testSubjects.findAll('flotLegendLabel');
const flotLegendLabels = await testSubjects.findAll('flotLegendLabel', findTimeout);
expect(flotLegendLabels.length).to.be(expectedCount);
});
}
@ -212,7 +213,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async savedSearchRowCount(expectedCount) {
log.debug(`DashboardExpect.savedSearchRowCount(${expectedCount})`);
await retry.try(async () => {
const savedSearchRows = await testSubjects.findAll('docTableExpandToggleColumn');
const savedSearchRows = await testSubjects.findAll('docTableExpandToggleColumn', findTimeout);
expect(savedSearchRows.length).to.be(expectedCount);
});
}
@ -220,8 +221,10 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async dataTableRowCount(expectedCount) {
log.debug(`DashboardExpect.dataTableRowCount(${expectedCount})`);
await retry.try(async () => {
const dataTableRows =
await find.allByCssSelector('[data-test-subj="paginated-table-body"] [data-cell-content]');
const dataTableRows = await find.allByCssSelector(
'[data-test-subj="paginated-table-body"] [data-cell-content]',
findTimeout
);
expect(dataTableRows.length).to.be(expectedCount);
});
}
@ -229,7 +232,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async seriesElementCount(expectedCount) {
log.debug(`DashboardExpect.seriesElementCount(${expectedCount})`);
await retry.try(async () => {
const seriesElements = await find.allByCssSelector('.series');
const seriesElements = await find.allByCssSelector('.series', findTimeout);
expect(seriesElements.length).to.be(expectedCount);
});
}
@ -245,7 +248,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async lineChartPointsCount(expectedCount) {
log.debug(`DashboardExpect.lineChartPointsCount(${expectedCount})`);
await retry.try(async () => {
const points = await find.allByCssSelector('.points');
const points = await find.allByCssSelector('.points', findTimeout);
expect(points.length).to.be(expectedCount);
});
}
@ -253,7 +256,7 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
async tsvbTableCellCount(expectedCount) {
log.debug(`DashboardExpect.tsvbTableCellCount(${expectedCount})`);
await retry.try(async () => {
const tableCells = await testSubjects.findAll('tvbTableVis__value');
const tableCells = await testSubjects.findAll('tvbTableVis__value', findTimeout);
expect(tableCells.length).to.be(expectedCount);
});
}

View file

@ -87,7 +87,7 @@ export function PieChartProvider({ getService }) {
async getPieSliceCount() {
log.debug('PieChart.getPieSliceCount');
return await retry.try(async () => {
const slices = await find.allByCssSelector('svg > g > g.arcs > path.slice');
const slices = await find.allByCssSelector('svg > g > g.arcs > path.slice', 2500);
return slices.length;
});
}