mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
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:
parent
3b7cca2e2a
commit
a24dc1543b
1 changed files with 26 additions and 23 deletions
|
@ -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,29 +951,31 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
* cell values into arrays. Please use this function for newer tests.
|
||||
*/
|
||||
async getTableVisContent({ stripEmptyRows = true } = { }) {
|
||||
const container = await testSubjects.find('tableVis');
|
||||
const allTables = await testSubjects.findAllDescendant('paginated-table-body', container);
|
||||
return await retry.try(async () => {
|
||||
const container = await testSubjects.find('tableVis');
|
||||
const allTables = await testSubjects.findAllDescendant('paginated-table-body', container);
|
||||
|
||||
if (allTables.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const allData = await Promise.all(allTables.map(async (t) => {
|
||||
let data = await table.getDataFromElement(t);
|
||||
if (stripEmptyRows) {
|
||||
data = data.filter(row => row.length > 0 && row.some(cell => cell.trim().length > 0));
|
||||
if (allTables.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return data;
|
||||
}));
|
||||
|
||||
if (allTables.length === 1) {
|
||||
const allData = await Promise.all(allTables.map(async (t) => {
|
||||
let data = await table.getDataFromElement(t);
|
||||
if (stripEmptyRows) {
|
||||
data = data.filter(row => row.length > 0 && row.some(cell => cell.trim().length > 0));
|
||||
}
|
||||
return data;
|
||||
}));
|
||||
|
||||
if (allTables.length === 1) {
|
||||
// If there was only one table we return only the data for that table
|
||||
// This prevents an unnecessary array around that single table, which
|
||||
// is the case we have in most tests.
|
||||
return allData[0];
|
||||
}
|
||||
return allData[0];
|
||||
}
|
||||
|
||||
return allData;
|
||||
return allData;
|
||||
});
|
||||
}
|
||||
|
||||
async getInspectorTableData() {
|
||||
|
@ -1144,11 +1145,13 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
}
|
||||
|
||||
async filterOnTableCell(column, row) {
|
||||
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();
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue