Skip to content

Commit

Permalink
fixed flakey tests
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Jun 11, 2024
1 parent e22d6b4 commit 3dbe681
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 12 additions & 0 deletions public/components/Main/__snapshots__/main.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,8 @@ exports[`<Main /> spec click run button, and response is not ok 1`] = `
>
<span
class="euiButton__text euiButtonGroupButton__textShift"
data-text="SQL"
title="SQL"
>
<input
checked=""
Expand All @@ -995,6 +997,8 @@ exports[`<Main /> spec click run button, and response is not ok 1`] = `
>
<span
class="euiButton__text euiButtonGroupButton__textShift"
data-text="PPL"
title="PPL"
>
<input
class="euiScreenReaderOnly"
Expand Down Expand Up @@ -1407,6 +1411,8 @@ exports[`<Main /> spec click run button, and response is ok 1`] = `
>
<span
class="euiButton__text euiButtonGroupButton__textShift"
data-text="SQL"
title="SQL"
>
<input
checked=""
Expand All @@ -1431,6 +1437,8 @@ exports[`<Main /> spec click run button, and response is ok 1`] = `
>
<span
class="euiButton__text euiButtonGroupButton__textShift"
data-text="PPL"
title="PPL"
>
<input
class="euiScreenReaderOnly"
Expand Down Expand Up @@ -1843,6 +1851,8 @@ exports[`<Main /> spec click run button, response fills null and missing values
>
<span
class="euiButton__text euiButtonGroupButton__textShift"
data-text="SQL"
title="SQL"
>
<input
checked=""
Expand All @@ -1867,6 +1877,8 @@ exports[`<Main /> spec click run button, response fills null and missing values
>
<span
class="euiButton__text euiButtonGroupButton__textShift"
data-text="PPL"
title="PPL"
>
<input
class="euiScreenReaderOnly"
Expand Down
20 changes: 12 additions & 8 deletions public/components/Main/main.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ describe('<Main /> spec', () => {
<Main httpClient={client} setBreadcrumbs={setBreadcrumbsMock} />
);
const onRunButton = getByText('Run');
const pplbutton =getByTestId('PPL');
const sqlbutton = getByText('SQL');
waitFor(() => {
expect(pplbutton).toBeInTheDocument();
expect(sqlbutton).toBeInTheDocument();

Check failure on line 124 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `·`
fireEvent.click(sqlbutton);

Check failure on line 125 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `·`
});
const asyncTest = () => {
fireEvent.click(onRunButton);
Expand All @@ -138,9 +139,10 @@ describe('<Main /> spec', () => {
const { getByText ,getByTestId } = await render(

Check failure on line 139 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·,` with `,·`

Check failure on line 139 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

'getByTestId' is assigned a value but never used. Allowed unused vars must match /^_/u
<Main httpClient={client} setBreadcrumbs={setBreadcrumbsMock} />
);
const pplbutton = getByTestId('PPL');
const sqlbutton = getByText('SQL');
waitFor(() => {
expect(pplbutton).toBeInTheDocument();
expect(sqlbutton).toBeInTheDocument();

Check failure on line 144 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `·`
fireEvent.click(sqlbutton);

Check failure on line 145 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `·`
});
const onRunButton = getByText('Run');
const asyncTest = () => {
Expand Down Expand Up @@ -182,9 +184,10 @@ describe('<Main /> spec', () => {
const { getByText, getByTestId } = await render(

Check failure on line 184 in public/components/Main/main.test.tsx

View workflow job for this annotation

GitHub Actions / Lint

'getByTestId' is assigned a value but never used. Allowed unused vars must match /^_/u
<Main httpClient={client} setBreadcrumbs={setBreadcrumbsMock} />
);
const pplbutton = getByTestId("PPL");
const sqlbutton = getByText('SQL');
waitFor(() => {
expect(pplbutton).toBeInTheDocument();
expect(sqlbutton).toBeInTheDocument();
fireEvent.click(sqlbutton);
});
const onRunButton = getByText('Run');
const asyncTest = () => {
Expand All @@ -209,9 +212,10 @@ describe('<Main /> spec', () => {
const { getByText,getByTestId } = await render(
<Main httpClient={client} setBreadcrumbs={setBreadcrumbsMock} />
);
const pplbutton = getByTestId("PPL");
const sqlbutton = getByText('SQL');
waitFor(() => {
expect(pplbutton).toBeInTheDocument();
expect(sqlbutton).toBeInTheDocument();
fireEvent.click(sqlbutton);
});
const onTranslateButton = getByText('Explain');
const asyncTest = () => {
Expand Down

0 comments on commit 3dbe681

Please sign in to comment.