mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Discover] Fix saved search embeddable rendering (#140264)
* [Discover] fix rendering issue * [Discover] add functional test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
757ddcbbad
commit
c80de81964
3 changed files with 24 additions and 3 deletions
|
@ -484,6 +484,8 @@ export class SavedSearchEmbeddable
|
|||
ReactDOM.unmountComponentAtNode(this.node);
|
||||
}
|
||||
this.node = domNode;
|
||||
|
||||
this.renderReactComponent(this.node, this.searchProps!);
|
||||
}
|
||||
|
||||
private renderReactComponent(domNode: HTMLElement, searchProps: SearchProps) {
|
||||
|
|
|
@ -77,5 +77,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
|
||||
await dataGrid.checkCurrentRowsPerPageToBe(10);
|
||||
});
|
||||
|
||||
it('should render duplicate saved search embeddables', async () => {
|
||||
await PageObjects.dashboard.switchToEditMode();
|
||||
await addSearchEmbeddableToDashboard();
|
||||
const [firstGridCell, secondGridCell] = await dataGrid.getAllCellElements();
|
||||
const firstGridCellContent = await firstGridCell.getVisibleText();
|
||||
const secondGridCellContent = await secondGridCell.getVisibleText();
|
||||
|
||||
expect(firstGridCellContent).to.be.equal(secondGridCellContent);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -80,15 +80,24 @@ export class DataGridService extends FtrService {
|
|||
.map((cell) => $(cell).text());
|
||||
}
|
||||
|
||||
private getCellElementSelector(rowIndex: number = 0, columnIndex: number = 0) {
|
||||
return `[data-test-subj="euiDataGridBody"] [data-test-subj="dataGridRowCell"][data-gridcell-column-index="${columnIndex}"][data-gridcell-row-index="${rowIndex}"]`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a grid cell element by row & column indexes.
|
||||
* @param rowIndex data row index starting from 0 (0 means 1st row)
|
||||
* @param columnIndex column index starting from 0 (0 means 1st column)
|
||||
*/
|
||||
public async getCellElement(rowIndex: number = 0, columnIndex: number = 0) {
|
||||
return await this.find.byCssSelector(
|
||||
`[data-test-subj="euiDataGridBody"] [data-test-subj="dataGridRowCell"][data-gridcell-column-index="${columnIndex}"][data-gridcell-row-index="${rowIndex}"]`
|
||||
);
|
||||
return await this.find.byCssSelector(this.getCellElementSelector(rowIndex, columnIndex));
|
||||
}
|
||||
|
||||
/**
|
||||
* The same as getCellElement, but useful when multiple data grids are on the page.
|
||||
*/
|
||||
public async getAllCellElements(rowIndex: number = 0, columnIndex: number = 0) {
|
||||
return await this.find.allByCssSelector(this.getCellElementSelector(rowIndex, columnIndex));
|
||||
}
|
||||
|
||||
public async getDocCount(): Promise<number> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue