-
Notifications
You must be signed in to change notification settings - Fork 917
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
Re-enable dataset_selector.spec.js and queries.spec.js under workspace #9082
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test: | ||
- Re-enable dataset_selector.spec.js under workspace in ciGroup10 ([#9082](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9082)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,49 +2,65 @@ | |
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { | ||
MiscUtils, | ||
TestFixtureHandler, | ||
} from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
import { PATHS } from '../../../../../utils/constants'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
const testFixtureHandler = new TestFixtureHandler(cy, PATHS.ENGINE); | ||
import { WORKSPACE_NAME, DATASOURCE_NAME, START_TIME, END_TIME } from './constants'; | ||
import { BASE_PATH, SECONDARY_ENGINE } from '../../../../../utils/constants'; | ||
|
||
describe.skip('query enhancement queries', { scrollBehavior: false }, () => { | ||
describe('query enhancement queries', { scrollBehavior: false }, () => { | ||
before(() => { | ||
testFixtureHandler.importJSONMapping('cypress/fixtures/timestamp/mappings.json.txt'); | ||
|
||
testFixtureHandler.importJSONDoc('cypress/fixtures/timestamp/data_with_index_pattern.json.txt'); | ||
|
||
// Go to the Discover page | ||
miscUtils.visitPage(`app/data-explorer/discover#/`); | ||
// Load test data | ||
cy.setupTestData( | ||
SECONDARY_ENGINE.url, | ||
['cypress/fixtures/query_enhancements/data-logs-1/data_logs_small_time_1.mapping.json'], | ||
['cypress/fixtures/query_enhancements/data-logs-1/data_logs_small_time_1.data.ndjson'] | ||
); | ||
|
||
cy.setAdvancedSetting({ | ||
defaultIndex: 'timestamp-*', | ||
// Add data source | ||
cy.addDataSource({ | ||
name: `${DATASOURCE_NAME}`, | ||
url: `${SECONDARY_ENGINE.url}`, | ||
authType: 'no_auth', | ||
}); | ||
|
||
// Go to the Discover page | ||
miscUtils.visitPage( | ||
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2018-09-19T13:31:44.000Z',to:'2019-09-24T01:31:44.000Z'))` | ||
); | ||
|
||
cy.get(`[class~="datasetSelector__button"]`).click(); | ||
cy.get(`[data-test-subj="datasetOption-timestamp-*"]`).click(); | ||
// Create workspace and set up index pattern | ||
cy.deleteWorkspaceByName(`${WORKSPACE_NAME}`); | ||
cy.visit('/app/home'); | ||
cy.createInitialWorkspaceWithDataSource(`${DATASOURCE_NAME}`, `${WORKSPACE_NAME}`); | ||
|
||
// Create and select index pattern for data_logs_small_time_1* | ||
cy.createWorkspaceIndexPatterns({ | ||
url: `${BASE_PATH}`, | ||
workspaceName: `${WORKSPACE_NAME}`, | ||
indexPattern: 'data_logs_small_time_1', | ||
timefieldName: 'timestamp', | ||
indexPatternHasTimefield: true, | ||
dataSource: DATASOURCE_NAME, | ||
isEnhancement: true, | ||
}); | ||
|
||
// Go to workspace home | ||
cy.navigateToWorkSpaceHomePage(`${BASE_PATH}`, `${WORKSPACE_NAME}`); | ||
cy.setTopNavDate(START_TIME, END_TIME); | ||
cy.waitForLoader(true); | ||
cy.waitForSearch(); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteWorkspaceByName(`${WORKSPACE_NAME}`); | ||
cy.deleteDataSourceByName(`${DATASOURCE_NAME}`); | ||
cy.deleteIndex('data_logs_small_time_1'); | ||
}); | ||
|
||
describe('send queries', () => { | ||
it('with DQL', function () { | ||
cy.setQueryLanguage('DQL'); | ||
|
||
const query = `_id:1`; | ||
cy.setSingleLineQueryEditor(query); | ||
cy.waitForLoader(true); | ||
cy.waitForSearch(); | ||
cy.verifyHitCount(1); | ||
|
||
//query should persist across refresh | ||
// query should persist across refresh | ||
cy.reload(); | ||
cy.verifyHitCount(1); | ||
}); | ||
|
@@ -69,7 +85,7 @@ describe.skip('query enhancement queries', { scrollBehavior: false }, () => { | |
// default SQL query should be set | ||
cy.waitForLoader(true); | ||
cy.getElementByTestId(`osdQueryEditor__multiLine`).contains( | ||
`SELECT * FROM timestamp-* LIMIT 10` | ||
`SELECT * FROM data_logs_small_time_1* LIMIT 10` | ||
); | ||
cy.getElementByTestId(`queryResultCompleteMsg`).should('be.visible'); | ||
|
||
|
@@ -88,21 +104,16 @@ describe.skip('query enhancement queries', { scrollBehavior: false }, () => { | |
|
||
// default PPL query should be set | ||
cy.waitForLoader(true); | ||
cy.getElementByTestId(`osdQueryEditor__multiLine`).contains(`source = timestamp-*`); | ||
cy.getElementByTestId(`osdQueryEditor__multiLine`).contains( | ||
`source = data_logs_small_time_1*` | ||
); | ||
cy.waitForSearch(); | ||
cy.getElementByTestId(`queryResultCompleteMsg`).should('be.visible'); | ||
cy.get('[class="euiText euiText--small"]').then((text) => cy.log(text)); | ||
cy.verifyHitCount(4); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we delete verifying the hit count? If we delete verifying hit count, how are we ensuring the query is persisted across refresh? Feel like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure. I added cy.verifyHitCount('10,000'); |
||
|
||
//query should persist across refresh | ||
cy.reload(); | ||
cy.verifyHitCount(4); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteIndex('timestamp-nanos'); | ||
cy.deleteIndex('timestamp-milis'); | ||
cy.deleteSavedObject('index-pattern', 'index-pattern:timestamp-*'); | ||
cy.getElementByTestId(`queryResultCompleteMsg`).should('be.visible'); | ||
cy.verifyHitCount('10,000'); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we delete the test for testing the empty state? i think we do need to test when there is no index pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we moved it to a_check.spec.js