diff --git a/src/routes/settings/costModels/components/addPriceList.test.tsx b/src/routes/settings/costModels/components/addPriceList.test.tsx index db51486e6..79d93a41f 100644 --- a/src/routes/settings/costModels/components/addPriceList.test.tsx +++ b/src/routes/settings/costModels/components/addPriceList.test.tsx @@ -182,7 +182,7 @@ describe('add-a-new-rate', () => { expect(screen.queryByText(regExp(messages.priceListNumberRate))).toBeNull(); // making sure button is enabled - const createButton = screen.getByText(regExp(messages.createRate)); + const createButton = screen.getByRole('button', { name: regExp(messages.createRate)} ); expect(createButton.getAttribute('aria-disabled')).toBe('false'); await user.click(createButton); expect(submit).toHaveBeenCalled(); @@ -240,7 +240,7 @@ describe('add-a-new-rate', () => { expect(screen.getByText(regExp(messages.priceListPosNumberRate))).not.toBeNull(); // setting a valid rate - now form is valid and can be submitted - const createButton = screen.getByText(regExp(messages.createRate)); + const createButton = screen.getByRole('button', { name: regExp(messages.createRate)} ); expect(createButton.getAttribute('aria-disabled')).toBe('true'); await user.clear(tagRateInput); diff --git a/src/routes/settings/costModels/costModelsDetails/dialog.test.tsx b/src/routes/settings/costModels/costModelsDetails/dialog.test.tsx index 15ce3eb02..b7a239e5b 100644 --- a/src/routes/settings/costModels/costModelsDetails/dialog.test.tsx +++ b/src/routes/settings/costModels/costModelsDetails/dialog.test.tsx @@ -74,11 +74,11 @@ test('delete dialog open', async () => { }, }; renderUI(state); - expect(screen.queryAllByText(regExp(messages.costModelsDelete))).toHaveLength(2); + expect(screen.getAllByRole('button', { name: regExp(messages.costModelsDelete)})).toHaveLength(1); expect(screen.queryAllByText(/This action will delete/i)).toHaveLength(1); - expect(screen.queryAllByText(/The following sources are assigned to/i)).toHaveLength(0); - await act(async () => user.click(screen.getAllByText(regExp(messages.costModelsDelete))[1])); - expect(screen.getAllByText(regExp(messages.costModelsDelete))[1].getAttribute('disabled')).not.toBeNull(); + expect(screen.queryAllByText(/The following integrations are assigned to/i)).toHaveLength(0); + await act(async () => user.click(screen.getAllByRole('button', { name: regExp(messages.costModelsDelete)})[0])); + expect(screen.getAllByRole('button', { name: regExp(messages.costModelsDelete)})[0].getAttribute('disabled')).not.toBeNull(); }); test('delete dialog error', async () => {