Compare commits
12 Commits
fix/query-
...
feat/add-a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51e660d107 | ||
|
|
240740367b | ||
|
|
db82c507f7 | ||
|
|
8eb714969d | ||
|
|
0b31259fcd | ||
|
|
3463a52d8e | ||
|
|
91ee3e3a3e | ||
|
|
ccc7290d88 | ||
|
|
135eda87f1 | ||
|
|
e3e4cb5856 | ||
|
|
682c0db53d | ||
|
|
3d162dd992 |
@@ -22,7 +22,7 @@ const queryRangeURL = 'http://localhost/api/v3/query_range';
|
|||||||
jest.mock('react-router-dom', () => ({
|
jest.mock('react-router-dom', () => ({
|
||||||
...jest.requireActual('react-router-dom'),
|
...jest.requireActual('react-router-dom'),
|
||||||
useLocation: (): { pathname: string } => ({
|
useLocation: (): { pathname: string } => ({
|
||||||
pathname: `${ROUTES.LOGS_EXPLORER}`,
|
pathname: ROUTES.LOGS_EXPLORER,
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -100,6 +100,24 @@ const logsQueryServerRequest = (): void =>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const checkAutoRefreshButtonsPresent = async (
|
||||||
|
getByRole: (role: string, options?: any) => HTMLElement,
|
||||||
|
): Promise<void> => {
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(
|
||||||
|
getByRole('button', {
|
||||||
|
name: /sync/i,
|
||||||
|
}),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
getByRole('button', {
|
||||||
|
name: /caret-down/i,
|
||||||
|
}),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
describe('Logs Explorer Tests', () => {
|
describe('Logs Explorer Tests', () => {
|
||||||
test('Logs Explorer default view test without data', async () => {
|
test('Logs Explorer default view test without data', async () => {
|
||||||
const {
|
const {
|
||||||
@@ -260,4 +278,60 @@ describe('Logs Explorer Tests', () => {
|
|||||||
await fireEvent.click(histogramToggle);
|
await fireEvent.click(histogramToggle);
|
||||||
expect(queryByText(frequencyChartContent)).not.toBeInTheDocument();
|
expect(queryByText(frequencyChartContent)).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ panelType: PANEL_TYPES.LIST, viewName: 'list view' },
|
||||||
|
{ panelType: PANEL_TYPES.TIME_SERIES, viewName: 'time series view' },
|
||||||
|
{ panelType: PANEL_TYPES.TABLE, viewName: 'table view' },
|
||||||
|
])(
|
||||||
|
'check that auto refresh is present in $viewName',
|
||||||
|
async ({ panelType }) => {
|
||||||
|
const { getByRole } = render(
|
||||||
|
<QueryBuilderContext.Provider
|
||||||
|
value={{
|
||||||
|
isDefaultQuery: (): boolean => false,
|
||||||
|
currentQuery: {
|
||||||
|
...initialQueriesMap.logs,
|
||||||
|
builder: {
|
||||||
|
...initialQueriesMap.logs.builder,
|
||||||
|
queryData: [initialQueryBuilderFormValues],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setSupersetQuery: jest.fn(),
|
||||||
|
supersetQuery: initialQueriesMap.logs,
|
||||||
|
stagedQuery: initialQueriesMap.logs,
|
||||||
|
initialDataSource: null,
|
||||||
|
panelType,
|
||||||
|
isEnabledQuery: false,
|
||||||
|
lastUsedQuery: 0,
|
||||||
|
setLastUsedQuery: noop,
|
||||||
|
handleSetQueryData: noop,
|
||||||
|
handleSetFormulaData: noop,
|
||||||
|
handleSetQueryItemData: noop,
|
||||||
|
handleSetConfig: noop,
|
||||||
|
removeQueryBuilderEntityByIndex: noop,
|
||||||
|
removeQueryTypeItemByIndex: noop,
|
||||||
|
addNewBuilderQuery: noop,
|
||||||
|
cloneQuery: noop,
|
||||||
|
addNewFormula: noop,
|
||||||
|
addNewQueryItem: noop,
|
||||||
|
redirectWithQueryBuilderData: noop,
|
||||||
|
handleRunQuery: noop,
|
||||||
|
resetQuery: noop,
|
||||||
|
updateAllQueriesOperators: (): Query => initialQueriesMap.logs,
|
||||||
|
updateQueriesData: (): Query => initialQueriesMap.logs,
|
||||||
|
initQueryBuilderData: noop,
|
||||||
|
handleOnUnitsChange: noop,
|
||||||
|
isStagedQueryUpdated: (): boolean => false,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PreferenceContextProvider>
|
||||||
|
<LogsExplorer />
|
||||||
|
</PreferenceContextProvider>
|
||||||
|
</QueryBuilderContext.Provider>,
|
||||||
|
);
|
||||||
|
|
||||||
|
await checkAutoRefreshButtonsPresent(getByRole);
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ function LogsExplorer(): JSX.Element {
|
|||||||
)}
|
)}
|
||||||
<section className={cx('log-module-right-section')}>
|
<section className={cx('log-module-right-section')}>
|
||||||
<Toolbar
|
<Toolbar
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
leftActions={
|
leftActions={
|
||||||
<LeftToolbarActions
|
<LeftToolbarActions
|
||||||
showFilter={showFilters}
|
showFilter={showFilters}
|
||||||
|
|||||||
Reference in New Issue
Block a user