-
Notifications
You must be signed in to change notification settings - Fork 968
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into discover-new-sidebar
- Loading branch information
Showing
41 changed files
with
1,602 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
feat: | ||
- Vega visualization with ppl now supports reading time field ([#9152](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9152)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test: | ||
- [TESTID-64] Add cypress test for auto query updates when switch dataset ([#9322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9322)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
chore: | ||
- Update query editor loading UI ([#9344](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9344)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
...search_dashboards/opensearch_dashboards/apps/query_enhancements/advanced_settings.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
INDEX_WITH_TIME_1, | ||
INDEX_WITH_TIME_2, | ||
PATHS, | ||
DATASOURCE_NAME, | ||
DatasetTypes, | ||
} from '../../../../../utils/constants'; | ||
import { | ||
getRandomizedWorkspaceName, | ||
setDatePickerDatesAndSearchIfRelevant, | ||
generateBaseConfiguration, | ||
} from '../../../../../utils/apps/query_enhancements/shared'; | ||
import { prepareTestSuite } from '../../../../../utils/helpers'; | ||
import { generateQueryTestConfigurations } from '../../../../../utils/apps/query_enhancements/queries'; | ||
import { getDatasetName } from '../../../../../utils/apps/query_enhancements/autocomplete'; | ||
|
||
const workspaceName = getRandomizedWorkspaceName(); | ||
|
||
export const runAdvancedSettingsTests = () => { | ||
describe('discover autocomplete tests', () => { | ||
beforeEach(() => { | ||
cy.osd.setupTestData( | ||
PATHS.SECONDARY_ENGINE, | ||
[ | ||
`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.mapping.json`, | ||
`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_2}.mapping.json`, | ||
], | ||
[ | ||
`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.data.ndjson`, | ||
`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_2}.data.ndjson`, | ||
] | ||
); | ||
cy.osd.addDataSource({ | ||
name: DATASOURCE_NAME, | ||
url: PATHS.SECONDARY_ENGINE, | ||
authType: 'no_auth', | ||
}); | ||
cy.deleteWorkspaceByName(workspaceName); | ||
cy.visit('/app/home'); | ||
cy.osd.createInitialWorkspaceWithDataSource(DATASOURCE_NAME, workspaceName); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.deleteWorkspaceByName(workspaceName); | ||
cy.osd.deleteDataSourceByName(DATASOURCE_NAME); | ||
cy.osd.deleteIndex(INDEX_WITH_TIME_1); | ||
cy.osd.deleteIndex(INDEX_WITH_TIME_2); | ||
}); | ||
|
||
generateQueryTestConfigurations(generateBaseConfiguration).forEach((config) => { | ||
describe(`${config.testName}`, () => { | ||
beforeEach(() => { | ||
if (config.datasetType === DatasetTypes.INDEX_PATTERN.name) { | ||
cy.createWorkspaceIndexPatterns({ | ||
workspaceName: workspaceName, | ||
indexPattern: INDEX_WITH_TIME_1, | ||
timefieldName: 'timestamp', | ||
dataSource: DATASOURCE_NAME, | ||
isEnhancement: true, | ||
}); | ||
cy.createWorkspaceIndexPatterns({ | ||
workspaceName: workspaceName, | ||
indexPattern: INDEX_WITH_TIME_2, | ||
timefieldName: 'timestamp', | ||
dataSource: DATASOURCE_NAME, | ||
isEnhancement: true, | ||
}); | ||
} | ||
cy.navigateToWorkSpaceSpecificPage({ | ||
workspaceName: workspaceName, | ||
page: 'discover', | ||
isEnhancement: true, | ||
}); | ||
}); | ||
|
||
it('ignoreFilterIfFieldNotInIndex should affect filtered field', () => { | ||
// Default courier:ignoreFilterIfFieldNotInIndex should be false | ||
// This is to ensure the setting is not changed by other tests | ||
cy.setAdvancedSetting({ | ||
'courier:ignoreFilterIfFieldNotInIndex': false, | ||
}); | ||
// Get dataset names based on type | ||
const firstDataset = getDatasetName(INDEX_WITH_TIME_1, config.datasetType); | ||
const secondDataset = getDatasetName(INDEX_WITH_TIME_2, config.datasetType); | ||
cy.setDataset(firstDataset, DATASOURCE_NAME, config.datasetType); | ||
cy.setQueryLanguage(config.language); | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
|
||
// courier:ignoreFilterIfFieldNotInIndex is off | ||
cy.submitFilterFromDropDown('unique_category', 'is', 'Caching', true); | ||
cy.verifyHitCount(500); | ||
|
||
cy.setDataset(secondDataset, DATASOURCE_NAME, config.datasetType); | ||
cy.getElementByTestId('discoverNoResults').should('exist'); | ||
|
||
// Turn on courier:ignoreFilterIfFieldNotInIndex | ||
cy.setAdvancedSetting({ | ||
'courier:ignoreFilterIfFieldNotInIndex': true, | ||
}); | ||
cy.reload(); | ||
cy.getElementByTestId('discoverNoResults').should('not.exist'); | ||
cy.verifyHitCount('10,000'); | ||
cy.setAdvancedSetting({ | ||
'courier:ignoreFilterIfFieldNotInIndex': false, | ||
}); | ||
}); | ||
|
||
it('sampleSize should affect the number of hits', () => { | ||
// Default discover:sampleSize is 500 | ||
// This is to ensure the setting is not changed by other tests | ||
cy.setAdvancedSetting({ | ||
'discover:sampleSize': 500, | ||
}); | ||
// Setup | ||
cy.setDataset(config.dataset, DATASOURCE_NAME, config.datasetType); | ||
cy.setQueryLanguage(config.language); | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
|
||
// default discover:sampleSize is 500 | ||
// discover shows 50 hits per page by default | ||
cy.getElementByTestId('docTableField').should('have.length', 100); | ||
|
||
// Turn on courier:sampleSize | ||
cy.setAdvancedSetting({ | ||
'discover:sampleSize': 5, | ||
}); | ||
cy.reload(); | ||
// Should not affect total hits | ||
cy.verifyHitCount('10,000'); | ||
cy.getElementByTestId('docTableField').should('have.length', 10); | ||
cy.setAdvancedSetting({ | ||
'discover:sampleSize': 500, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
|
||
prepareTestSuite('Advanced Settings', runAdvancedSettingsTests); |
99 changes: 99 additions & 0 deletions
99
...earch_dashboards/opensearch_dashboards/apps/query_enhancements/autocomplete_query.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
INDEX_WITH_TIME_1, | ||
QueryLanguages, | ||
PATHS, | ||
DATASOURCE_NAME, | ||
DatasetTypes, | ||
} from '../../../../../utils/constants'; | ||
import { | ||
getRandomizedWorkspaceName, | ||
setDatePickerDatesAndSearchIfRelevant, | ||
} from '../../../../../utils/apps/query_enhancements/shared'; | ||
import { | ||
validateQueryResults, | ||
generateAutocompleteTestConfiguration, | ||
generateAutocompleteTestConfigurations, | ||
createOtherQueryUsingAutocomplete, | ||
createDQLQueryUsingAutocomplete, | ||
} from '../../../../../utils/apps/query_enhancements/autocomplete'; | ||
import { prepareTestSuite } from '../../../../../utils/helpers'; | ||
|
||
const workspaceName = getRandomizedWorkspaceName(); | ||
|
||
export const runAutocompleteTests = () => { | ||
describe('discover autocomplete tests', () => { | ||
beforeEach(() => { | ||
cy.osd.setupTestData( | ||
PATHS.SECONDARY_ENGINE, | ||
[`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.mapping.json`], | ||
[`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.data.ndjson`] | ||
); | ||
cy.osd.addDataSource({ | ||
name: DATASOURCE_NAME, | ||
url: PATHS.SECONDARY_ENGINE, | ||
authType: 'no_auth', | ||
}); | ||
cy.deleteWorkspaceByName(workspaceName); | ||
cy.visit('/app/home'); | ||
cy.osd.createInitialWorkspaceWithDataSource(DATASOURCE_NAME, workspaceName); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.deleteWorkspaceByName(workspaceName); | ||
cy.osd.deleteDataSourceByName(DATASOURCE_NAME); | ||
cy.osd.deleteIndex(INDEX_WITH_TIME_1); | ||
}); | ||
|
||
generateAutocompleteTestConfigurations(generateAutocompleteTestConfiguration).forEach( | ||
(config) => { | ||
describe(`${config.testName}`, () => { | ||
beforeEach(() => { | ||
if (config.datasetType === DatasetTypes.INDEX_PATTERN.name) { | ||
cy.createWorkspaceIndexPatterns({ | ||
workspaceName: workspaceName, | ||
indexPattern: INDEX_WITH_TIME_1, | ||
timefieldName: 'timestamp', | ||
dataSource: DATASOURCE_NAME, | ||
isEnhancement: true, | ||
}); | ||
} | ||
cy.navigateToWorkSpaceSpecificPage({ | ||
workspaceName: workspaceName, | ||
page: 'discover', | ||
isEnhancement: true, | ||
}); | ||
}); | ||
|
||
it('should show and select suggestions progressively', () => { | ||
// Setup | ||
cy.setDataset(config.dataset, DATASOURCE_NAME, config.datasetType); | ||
cy.setQueryLanguage(config.language); | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
cy.clearQueryEditor(); | ||
|
||
if (config.language === QueryLanguages.DQL.name) { | ||
createDQLQueryUsingAutocomplete(); | ||
} else { | ||
createOtherQueryUsingAutocomplete(config); | ||
} | ||
|
||
// Run the query | ||
cy.getElementByTestId('querySubmitButton').click(); | ||
cy.waitForLoader(true); | ||
cy.wait(1000); | ||
// Validate results meet our conditions | ||
validateQueryResults('bytes_transferred', 9500, '>'); | ||
validateQueryResults('category', 'Application'); | ||
}); | ||
}); | ||
} | ||
); | ||
}); | ||
}; | ||
|
||
prepareTestSuite('Autocomplete Query', runAutocompleteTests); |
Oops, something went wrong.