Explore: Do not assert order of query history items when initializing from URL (#76806)
Assert initial state of the query history without requiring correct order.
This commit is contained in:
@@ -10,6 +10,15 @@ export const assertQueryHistoryExists = async (query: string, exploreId = 'left'
|
||||
expect(queryItem).toHaveTextContent(query);
|
||||
};
|
||||
|
||||
export const assertQueryHistoryContains = async (query: string, exploreId = 'left') => {
|
||||
const selector = withinExplore(exploreId);
|
||||
|
||||
await waitFor(() => {
|
||||
const containsQuery = selector.getAllByLabelText('Query text').map((e) => (e.textContent || '').includes(query));
|
||||
expect(containsQuery).toContain(true);
|
||||
});
|
||||
};
|
||||
|
||||
export const assertQueryHistory = async (expectedQueryTexts: string[], exploreId = 'left') => {
|
||||
const selector = withinExplore(exploreId);
|
||||
await waitFor(() => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
assertLoadMoreQueryHistoryNotVisible,
|
||||
assertQueryHistory,
|
||||
assertQueryHistoryComment,
|
||||
assertQueryHistoryContains,
|
||||
assertQueryHistoryElementsShown,
|
||||
assertQueryHistoryExists,
|
||||
assertQueryHistoryIsEmpty,
|
||||
@@ -163,8 +164,10 @@ describe('Explore: Query History', () => {
|
||||
});
|
||||
|
||||
it('initial state is in sync', async () => {
|
||||
await assertQueryHistory(['{"expr":"query #2"}', '{"expr":"query #1"}'], 'left');
|
||||
await assertQueryHistory(['{"expr":"query #2"}', '{"expr":"query #1"}'], 'right');
|
||||
await assertQueryHistoryContains('{"expr":"query #1"}', 'left');
|
||||
await assertQueryHistoryContains('{"expr":"query #2"}', 'left');
|
||||
await assertQueryHistoryContains('{"expr":"query #1"}', 'right');
|
||||
await assertQueryHistoryContains('{"expr":"query #2"}', 'right');
|
||||
});
|
||||
|
||||
it('starred queries are synced', async () => {
|
||||
|
||||
Reference in New Issue
Block a user