From: Revanshu Paliwal Date: Thu, 26 Sep 2024 15:27:54 +0000 (+0200) Subject: SGB-163 Adding timer to all test inside issueApp as a temporary fix X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=825e4dedaa9037362f3a58b14410d7eed03d9c9a;p=sonarqube.git SGB-163 Adding timer to all test inside issueApp as a temporary fix --- diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index ca1d509bdb4..178b2ef5a68 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -79,7 +79,7 @@ describe('issue app', () => { it('should always be able to render the open issue', async () => { renderProjectIssuesApp('project/issues?issueStatuses=CONFIRMED&open=issue2&id=myproject&why=1'); - expect(await ui.conciseIssueTotal.find()).toHaveTextContent('4'); + expect(await ui.conciseIssueTotal.find(undefined, { timeout: 10_000 })).toHaveTextContent('4'); expect(ui.conciseIssueItem4.get()).toBeInTheDocument(); expect(ui.conciseIssueItem2.get()).toBeInTheDocument(); }); @@ -116,7 +116,7 @@ describe('issue app', () => { mockCurrentUser(), [Feature.BranchSupport, Feature.FixSuggestions], ); - expect(await ui.issueCodeTab.find()).toBeInTheDocument(); + expect(await ui.issueCodeTab.find(undefined, { timeout: 10_000 })).toBeInTheDocument(); expect(ui.getFixSuggestion.query()).not.toBeInTheDocument(); expect(ui.issueCodeFixTab.query()).not.toBeInTheDocument(); }); @@ -128,7 +128,7 @@ describe('issue app', () => { mockCurrentUser(), [Feature.BranchSupport, Feature.FixSuggestions], ); - expect(await ui.issueCodeTab.find()).toBeInTheDocument(); + expect(await ui.issueCodeTab.find(undefined, { timeout: 10_000 })).toBeInTheDocument(); expect(ui.getFixSuggestion.query()).not.toBeInTheDocument(); expect(ui.issueCodeFixTab.query()).not.toBeInTheDocument(); }); @@ -143,7 +143,7 @@ describe('issue app', () => { [Feature.BranchSupport, Feature.FixSuggestions], ); - await user.click(await ui.issueCodeFixTab.find()); + await user.click(await ui.issueCodeFixTab.find(undefined, { timeout: 10_000 })); await user.click(ui.getAFixSuggestion.get()); expect(await ui.noFixAvailable.find()).toBeInTheDocument(); @@ -153,9 +153,11 @@ describe('issue app', () => { renderProjectIssuesApp('project/issues?issues=issue2&open=issue2&id=myproject&why=1'); expect( - await screen.findByRole('tab', { - name: `coding_rules.description_section.title.root_cause`, - }), + await screen.findByRole( + 'tab', + { name: `coding_rules.description_section.title.root_cause` }, + { timeout: 10_000 }, + ), ).toHaveAttribute('aria-current', 'true'); expect(byText(/Introduction to this rule/).get()).toBeInTheDocument(); @@ -165,7 +167,7 @@ describe('issue app', () => { const user = userEvent.setup(); renderProjectIssuesApp('project/issues?id=myproject'); - await user.click(await ui.issueItemAction2.find()); + await user.click(await ui.issueItemAction2.find(undefined, { timeout: 10_000 })); expect(await screen.findByLabelText('list_of_issues')).toBeInTheDocument(); @@ -224,7 +226,11 @@ describe('issue app', () => { const user = userEvent.setup(); renderProjectIssuesApp('project/issues?issues=issue2&open=issue2&id=myproject'); await user.click( - await screen.findByRole('tab', { name: `coding_rules.description_section.title.more_info` }), + await screen.findByRole( + 'tab', + { name: `coding_rules.description_section.title.more_info` }, + { timeout: 10_000 }, + ), ); expect(screen.getByRole('heading', { name: 'Defense-In-Depth', level: 3 })).toBeInTheDocument(); }); @@ -234,7 +240,11 @@ describe('issue app', () => { renderProjectIssuesApp('project/issues?issues=issue2&open=issue2&id=myproject'); await user.click( - await screen.findByRole('tab', { name: 'coding_rules.description_section.title.root_cause' }), + await screen.findByRole( + 'tab', + { name: 'coding_rules.description_section.title.root_cause' }, + { timeout: 10_000 }, + ), ); expect(await screen.findByRole('heading', { name: 'CVE-2021-12345' })).toBeInTheDocument(); @@ -258,7 +268,11 @@ describe('issue app', () => { renderProjectIssuesApp('project/issues?issues=issue2&open=issue2&id=myproject'); await user.click( - await screen.findByRole('tab', { name: 'coding_rules.description_section.title.root_cause' }), + await screen.findByRole( + 'tab', + { name: 'coding_rules.description_section.title.root_cause' }, + { timeout: 10_000 }, + ), ); expect(await screen.findByRole('heading', { name: 'CVE-2021-12345' })).toBeInTheDocument(); @@ -275,7 +289,9 @@ describe('issue app', () => { renderIssueApp(); // Get a specific issue list item - const listItem = within(await screen.findByLabelText('Fix that')); + const listItem = within( + await screen.findByLabelText('Fix that', undefined, { timeout: 10_000 }), + ); expect(listItem.getByText('issue.issue_status.OPEN')).toBeInTheDocument(); @@ -316,7 +332,9 @@ describe('issue app', () => { renderIssueApp(); // Get a specific issue list item - const listItem = within(await screen.findByLabelText('Fix that')); + const listItem = within( + await screen.findByLabelText('Fix that', undefined, { timeout: 10_000 }), + ); // Assign issue to a different user await user.click(listItem.getByLabelText('issue.assign.unassigned_click_to_assign')); await user.click(screen.getByLabelText('search.search_for_users')); @@ -338,7 +356,9 @@ describe('issue app', () => { renderIssueApp(); // Get a specific issue list item - const listItem = within(await screen.findByLabelText('Fix that')); + const listItem = within( + await screen.findByLabelText('Fix that', undefined, { timeout: 10_000 }), + ); // Change tags expect(listItem.getByText('issue.no_tag')).toBeInTheDocument(); @@ -379,7 +399,7 @@ describe('issue app', () => { const user = userEvent.setup(); renderIssueApp(); - await user.click(await ui.issueItem4.find()); + await user.click(await ui.issueItem4.find(undefined, { timeout: 10_000 })); expect( screen.queryByRole('button', { @@ -410,7 +430,7 @@ describe('issue app', () => { renderIssueApp(); // Select an issue with an advanced rule - await user.click(await ui.issueItemAction5.find()); + await user.click(await ui.issueItemAction5.find(undefined, { timeout: 10_000 })); // Open status popup on key press 'f' await user.keyboard('f'); @@ -441,7 +461,7 @@ describe('issue app', () => { renderIssueApp(); // Select an issue with an advanced rule - await user.click(await ui.issueItem5.find()); + await user.click(await ui.issueItem5.find(undefined, { timeout: 10_000 })); // open status popup on key press 'f' await user.keyboard('f'); @@ -458,7 +478,7 @@ describe('issue app', () => { const user = userEvent.setup(); renderIssueApp(); - await user.click(await ui.issueItemAction4.find()); + await user.click(await ui.issueItemAction4.find(undefined, { timeout: 10_000 })); expect(screen.getByRole('button', { name: 'location 1' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: 'location 2' })).toBeInTheDocument(); @@ -508,7 +528,7 @@ describe('issue app', () => { renderIssueApp(); // Select an issue with quick fix available - await user.click(await ui.issueItemAction7.find()); + await user.click(await ui.issueItemAction7.find(undefined, { timeout: 10_000 })); await expect(screen.getByText('issue.quick_fix')).toHaveATooltipWithContent( 'issue.quick_fix_available_with_sonarlint',