Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for saved search creation and loading for query enhancement #9112

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/9112.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Add tests for saving search and loading it ([#9112](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9112))
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ export const DATASOURCE_NAME = 'query-cluster';
export const WORKSPACE_NAME = 'query-workspace';
export const START_TIME = 'Jan 1, 2020 @ 00:00:00.000';
export const END_TIME = 'Jan 1, 2024 @ 00:00:00.000';

export const INDEX_WITH_TIME_1 = 'data_logs_small_time_1';
export const INDEX_WITH_TIME_2 = 'data_logs_small_time_2';
export const INDEX_PATTERN_WITH_TIME = 'data_logs_small_time_*';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { WORKSPACE_NAME, DATASOURCE_NAME, START_TIME, END_TIME } from './constants';
import { BASE_PATH, SECONDARY_ENGINE } from '../../../../../utils/constants';
import { SECONDARY_ENGINE } from '../../../../../utils/constants';

describe('dataset selector', { scrollBehavior: false }, () => {
before(() => {
Expand Down Expand Up @@ -111,16 +111,15 @@ describe('dataset selector', { scrollBehavior: false }, () => {
it('create index pattern and select it', function () {
// Create and select index pattern for data_logs_small_time_1*
cy.createWorkspaceIndexPatterns({
url: `${BASE_PATH}`,
workspaceName: `${WORKSPACE_NAME}`,
workspaceName: WORKSPACE_NAME,
indexPattern: 'data_logs_small_time_1',
timefieldName: 'timestamp',
indexPatternHasTimefield: true,
dataSource: DATASOURCE_NAME,
isEnhancement: true,
});

cy.navigateToWorkSpaceHomePage(`${BASE_PATH}`, `${WORKSPACE_NAME}`);
cy.navigateToWorkSpaceHomePage(WORKSPACE_NAME);

cy.waitForLoader(true);
cy.getElementByTestId(`datasetSelectorButton`).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { WORKSPACE_NAME, DATASOURCE_NAME, START_TIME, END_TIME } from './constants';
import { BASE_PATH, SECONDARY_ENGINE } from '../../../../../utils/constants';
import { SECONDARY_ENGINE } from '../../../../../utils/constants';

describe('query enhancement queries', { scrollBehavior: false }, () => {
before(() => {
Expand All @@ -29,8 +29,7 @@ describe('query enhancement queries', { scrollBehavior: false }, () => {

// Create and select index pattern for data_logs_small_time_1*
cy.createWorkspaceIndexPatterns({
url: `${BASE_PATH}`,
workspaceName: `${WORKSPACE_NAME}`,
workspaceName: WORKSPACE_NAME,
indexPattern: 'data_logs_small_time_1',
timefieldName: 'timestamp',
indexPatternHasTimefield: true,
Expand All @@ -39,7 +38,7 @@ describe('query enhancement queries', { scrollBehavior: false }, () => {
});

// Go to workspace home
cy.navigateToWorkSpaceHomePage(`${BASE_PATH}`, `${WORKSPACE_NAME}`);
cy.navigateToWorkSpaceHomePage(WORKSPACE_NAME);
cy.setTopNavDate(START_TIME, END_TIME);
cy.waitForLoader(true);
});
Expand All @@ -55,7 +54,7 @@ describe('query enhancement queries', { scrollBehavior: false }, () => {
cy.setQueryLanguage('DQL');

const query = `_id:1`;
cy.setSingleLineQueryEditor(query);
cy.setQueryEditor(query);
cy.waitForLoader(true);
cy.waitForSearch();
cy.verifyHitCount(1);
Expand All @@ -69,7 +68,7 @@ describe('query enhancement queries', { scrollBehavior: false }, () => {
cy.setQueryLanguage('Lucene');

const query = `_id:1`;
cy.setSingleLineQueryEditor(query);
cy.setQueryEditor(query);
cy.waitForLoader(true);
cy.waitForSearch();
cy.verifyHitCount(1);
Expand Down
Loading
Loading