diff --git a/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx index 0a46580c12..bd216a26ad 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogPage.test.tsx @@ -181,7 +181,7 @@ describe('CatalogPage', () => { { title: 'Bar', field: 'entity.bar' }, { title: 'Baz', field: 'entity.spec.lifecycle' }, ]; - const { getAllByRole } = await renderWrapped( + const { getByTestId, getAllByRole } = await renderWrapped( , ); @@ -189,12 +189,14 @@ describe('CatalogPage', () => { c => c.tagName === 'SPAN', ); const columnHeaderLabels = columnHeader.map(c => c.textContent); - expect(columnHeaderLabels).toEqual(['Foo', 'Bar', 'Baz', 'Actions']); }, 20_000); it('should render the default actions of an item in the grid', async () => { - const { findByTitle, findByText } = await renderWrapped(); + const { getByTestId, findByTitle, findByText } = await renderWrapped( + , + ); + fireEvent.click(getByTestId('user-picker-owned')); expect(await findByText(/Owned \(1\)/)).toBeInTheDocument(); expect(await findByTitle(/View/)).toBeInTheDocument(); expect(await findByTitle(/Edit/)).toBeInTheDocument(); @@ -221,9 +223,11 @@ describe('CatalogPage', () => { }, ]; - const { findByTitle, findByText } = await renderWrapped( + const { getByTestId, findByTitle, findByText } = await renderWrapped( , ); + fireEvent.click(getByTestId('user-picker-owned')); + expect(await findByText(/Owned \(1\)/)).toBeInTheDocument(); expect(await findByText(/Owned \(1\)/)).toBeInTheDocument(); expect(await findByTitle(/Foo Action/)).toBeInTheDocument(); expect(await findByTitle(/Bar Action/)).toBeInTheDocument(); @@ -235,6 +239,7 @@ describe('CatalogPage', () => { // https://github.com/mbrn/material-table/issues/1293 it('should render', async () => { const { findByText, getByTestId } = await renderWrapped(); + fireEvent.click(getByTestId('user-picker-owned')); await expect(findByText(/Owned \(1\)/)).resolves.toBeInTheDocument(); fireEvent.click(getByTestId('user-picker-all')); await expect(findByText(/All \(2\)/)).resolves.toBeInTheDocument(); @@ -250,7 +255,8 @@ describe('CatalogPage', () => { // this test is for fixing the bug after favoriting an entity, the matching // entities defaulting to "owned" filter and not based on the selected filter it('should render the correct entities filtered on the selected filter', async () => { - await renderWrapped(); + const { getByTestId } = await renderWrapped(); + fireEvent.click(getByTestId('user-picker-owned')); await expect(screen.findByText(/Owned \(1\)/)).resolves.toBeInTheDocument(); fireEvent.click(screen.getByTestId('user-picker-starred')); await expect(