diff --git a/public/components/Main/__snapshots__/main.test.tsx.snap b/public/components/Main/__snapshots__/main.test.tsx.snap
index ec09cff..a0635e7 100644
--- a/public/components/Main/__snapshots__/main.test.tsx.snap
+++ b/public/components/Main/__snapshots__/main.test.tsx.snap
@@ -971,6 +971,8 @@ exports[` spec click run button, and response is not ok 1`] = `
>
spec click run button, and response is not ok 1`] = `
>
spec click run button, and response is ok 1`] = `
>
spec click run button, and response is ok 1`] = `
>
spec click run button, response fills null and missing values
>
spec click run button, response fills null and missing values
>
spec', () => {
});
expect(document.body.children[0]).toMatchSnapshot();
});
-
-
+
it('renders the component and checks if side tree is loaded', async () => {
const client = httpClientMock;
client.post = jest.fn().mockResolvedValue(mockHttpQuery);
@@ -115,13 +114,14 @@ describe(' spec', () => {
client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
client.post = jest.fn().mockResolvedValue(mockQueryResultJDBCResponse);
- const { getByText, getByTestId } = await render(
+ const { getByText } = await render(
);
const onRunButton = getByText('Run');
- const pplbutton =getByTestId('PPL');
+ const sqlbutton = getByText('SQL');
waitFor(() => {
- expect(pplbutton).toBeInTheDocument();
+ expect(sqlbutton).toBeInTheDocument();
+ fireEvent.click(sqlbutton);
});
const asyncTest = () => {
fireEvent.click(onRunButton);
@@ -135,12 +135,13 @@ describe(' spec', () => {
client.post = jest.fn().mockResolvedValue(mockResultWithNull);
client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- const { getByText ,getByTestId } = await render(
+ const { getByText } = await render(
);
- const pplbutton = getByTestId('PPL');
+ const sqlbutton = getByText('SQL');
waitFor(() => {
- expect(pplbutton).toBeInTheDocument();
+ expect(sqlbutton).toBeInTheDocument();
+ fireEvent.click(sqlbutton);
});
const onRunButton = getByText('Run');
const asyncTest = () => {
@@ -179,12 +180,13 @@ describe(' spec', () => {
});
client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- const { getByText, getByTestId } = await render(
+ const { getByText } = await render(
);
- const pplbutton = getByTestId("PPL");
+ const sqlbutton = getByText('SQL');
waitFor(() => {
- expect(pplbutton).toBeInTheDocument();
+ expect(sqlbutton).toBeInTheDocument();
+ fireEvent.click(sqlbutton);
});
const onRunButton = getByText('Run');
const asyncTest = () => {
@@ -206,12 +208,13 @@ describe(' spec', () => {
}
});
- const { getByText,getByTestId } = await render(
+ const { getByText } = await render(
);
- const pplbutton = getByTestId("PPL");
+ const sqlbutton = getByText('SQL');
waitFor(() => {
- expect(pplbutton).toBeInTheDocument();
+ expect(sqlbutton).toBeInTheDocument();
+ fireEvent.click(sqlbutton);
});
const onTranslateButton = getByText('Explain');
const asyncTest = () => {
@@ -238,4 +241,4 @@ describe(' spec', () => {
await asyncTest();
expect(document.body.children[0]).toMatchSnapshot();
});
-});
\ No newline at end of file
+});
diff --git a/release-notes/opensearch-query-workbench.release-notes-2.15.0.0.md b/release-notes/opensearch-query-workbench.release-notes-2.15.0.0.md
index c728de3..13adbe8 100644
--- a/release-notes/opensearch-query-workbench.release-notes-2.15.0.0.md
+++ b/release-notes/opensearch-query-workbench.release-notes-2.15.0.0.md
@@ -5,7 +5,7 @@ Compatible with OpenSearch and OpenSearch Dashboards 2.15.0
### Bug Fixes
- added fix for runAsync query without mds id ([#323](https://github.com/opensearch-project/dashboards-query-workbench/pull/323))
-
+- Flakey unit tests fix ([#339](https://github.com/opensearch-project/dashboards-query-workbench/pull/339))
### Maintenance