[pageObjects/visualize] use retry to avoid stale element references (#25973) (#26017)

Fixes https://github.com/elastic/kibana/issues/25892

This should address the flakiness observed in this issue by retrying if there is a stale element in the complex `PageObjects.visualize.filterOnTableCell()` method, and using `testSubjects.getVisibleText()` rather than calling `getVisibleText()` directly on the element without retrying.
This commit is contained in:
Spencer 2018-11-21 11:00:22 -08:00 committed by GitHub
parent 3b7cca2e2a
commit a24dc1543b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -942,8 +942,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
* If you are writing new tests, you should rather look into getTableVisContent method instead.
*/
async getTableVisData() {
const dataTable = await testSubjects.find('paginated-table-body');
return await dataTable.getVisibleText();
return await testSubjects.getVisibleText('paginated-table-body');
}
/**
@ -952,6 +951,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
* cell values into arrays. Please use this function for newer tests.
*/
async getTableVisContent({ stripEmptyRows = true } = { }) {
return await retry.try(async () => {
const container = await testSubjects.find('tableVis');
const allTables = await testSubjects.findAllDescendant('paginated-table-body', container);
@ -975,6 +975,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
}
return allData;
});
}
async getInspectorTableData() {
@ -1144,11 +1145,13 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
}
async filterOnTableCell(column, row) {
await retry.try(async () => {
const table = await testSubjects.find('tableVis');
const cell = await table.findByCssSelector(`tbody tr:nth-child(${row}) td:nth-child(${column})`);
await remote.moveMouseTo(cell);
const filterBtn = await testSubjects.findDescendant('filterForCellValue', cell);
await filterBtn.click();
});
}
async toggleLegend(show = true) {