-
Notifications
You must be signed in to change notification settings - Fork 964
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
[TESTID-125,126,127,128,129] Saved Query Test Scope #9229
Merged
LDrago27
merged 44 commits into
opensearch-project:main
from
ArgusLi:discover-tests-saved-queries
Jan 28, 2025
Merged
Changes from 38 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
02bb7d4
add spec for old ui
ArgusLi af1352d
Add comment about cleaning up saved queries
ArgusLi d6a713b
Add data-test-subj for save query new ui
ArgusLi d6e0785
Add data-test-subj for save query button for new ui
ArgusLi a15bba2
Add data-test-subj for open query button in query management popover
ArgusLi 47fe9a7
Add new ui spec to test list saved queries
ArgusLi 49a9352
Fix DataSource url
ArgusLi 61112c8
Merge branch 'main' into testid-124-list-saved-queries
ArgusLi 00b3f60
Changeset file for PR #9166 created/updated
opensearch-changeset-bot[bot] edb8f9f
Address Justin's comments.
ArgusLi 4ae05a4
Remove final force.
ArgusLi b411dd0
Fix final force.
ArgusLi eeb0c63
Move utils to Suchit's suggested location, fix comments
ArgusLi 3c2b2ec
Rename specs, change cypress workflow to use new save query ui, merge…
ArgusLi 59de88e
Merge main
ArgusLi 6297366
fix import
ArgusLi bef2e77
Load query
ArgusLi 2cff1df
Complete load query popover and flyout
ArgusLi 2abb5de
Modularize view and load query popover and flyout
ArgusLi 454ac70
Complete valid Saved Queries shown across Visualize Pages
ArgusLi 4ecaf80
Complete Popover delete saved query
ArgusLi 1746c6f
Add data-test-subj for flyoutbody and delete button.
ArgusLi 58251de
Complete flyout delete saved query
ArgusLi 3bac756
Add data-test-subj for saveAsNewQueryCheckbox
ArgusLi 0d98d74
Complete Flyout Update Saved Query
ArgusLi 51e9ce3
Complete Flyout Save as New Saved Query
ArgusLi 7061a43
Complete Popout Save as New Saved Query
ArgusLi 45f8096
Changeset file for PR #9229 created/updated
opensearch-changeset-bot[bot] 4126d79
Merge remote-tracking branch 'origin/main' into discover-tests-saved-…
ArgusLi 965d16a
Fix merge
ArgusLi 71e935a
Merge remote-tracking branch 'origin/main' into discover-tests-saved-…
ArgusLi cc38990
Move data-test-subj changes to another PR.
ArgusLi a0e09b2
Remove savedQueriesNewUI
ArgusLi 00351f9
Address all comments.
ArgusLi 2ff0473
Merge branch 'main' into discover-tests-saved-queries
ArgusLi 7e80e64
Fix cypress command namespacing.
ArgusLi 2d2c081
Rename saved queries spec.
ArgusLi 57c2ade
Merge remote-tracking branch 'origin/main' into discover-tests-saved-…
ArgusLi 7e21348
Remove references to flyout
ArgusLi d193d64
Refactor tests to work with beforeEach and afterEach
ArgusLi f791b6e
Merge remote-tracking branch 'origin/main' into discover-tests-saved-…
ArgusLi bc5878a
Add force to click when loading saved query.
ArgusLi 863717d
Merge branch 'main' into discover-tests-saved-queries
ananzh b162b29
Fix test issue. Thank you @angle943 for finding a solution.
ArgusLi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test: | ||
- Add cypress integration test for the old and new UI view saved queries. ([#9229](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9229)) |
157 changes: 157 additions & 0 deletions
157
...opensearch_dashboards/opensearch_dashboards/apps/query_enhancements/saved_queries.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,157 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
INDEX_PATTERN_WITH_TIME, | ||
INDEX_WITH_TIME_1, | ||
INDEX_WITH_TIME_2, | ||
SECONDARY_ENGINE, | ||
} from '../../../../../utils/constants'; | ||
|
||
import { | ||
verifyDiscoverPageState, | ||
verifyQueryDoesNotExistInSavedQueries, | ||
setQueryConfigurations, | ||
updateAndVerifySavedQuery, | ||
SAVE_AS_NEW_QUERY_SUFFIX, | ||
validateSaveAsNewQueryMatchingNameHasError, | ||
} from '../../../../../utils/apps/query_enhancements/saved_queries'; | ||
|
||
import { | ||
getRandomizedWorkspaceName, | ||
getRandomizedDatasourceName, | ||
setDatePickerDatesAndSearchIfRelevant, | ||
generateAllTestConfigurations, | ||
} from '../../../../../utils/apps/query_enhancements/shared'; | ||
|
||
import { generateSavedTestConfiguration } from '../../../../../utils/apps/query_enhancements/saved'; | ||
|
||
const workspaceName = getRandomizedWorkspaceName(); | ||
const datasourceName = getRandomizedDatasourceName(); | ||
|
||
// This spec assumes data.savedQueriesNewUI.enabled is true. | ||
export const runSavedQueriesFlyoutUITests = () => { | ||
describe('saved queries flyout UI', () => { | ||
beforeEach(() => { | ||
// Load test data | ||
cy.setupTestData( | ||
SECONDARY_ENGINE.url, | ||
[ | ||
`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.mapping.json`, | ||
`cypress/fixtures/query_enhancements/data_logs_2/${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_2/${INDEX_WITH_TIME_2}.data.ndjson`, | ||
] | ||
); | ||
// Add data source | ||
cy.addDataSource({ | ||
name: datasourceName, | ||
url: SECONDARY_ENGINE.url, | ||
authType: 'no_auth', | ||
}); | ||
|
||
// Create workspace | ||
cy.deleteWorkspaceByName(workspaceName); | ||
cy.visit('/app/home'); | ||
cy.osd.createInitialWorkspaceWithDataSource(datasourceName, workspaceName); | ||
cy.createWorkspaceIndexPatterns({ | ||
workspaceName: workspaceName, | ||
indexPattern: INDEX_PATTERN_WITH_TIME.replace('*', ''), | ||
timefieldName: 'timestamp', | ||
dataSource: datasourceName, | ||
isEnhancement: true, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
// No need to explicitly delete all saved queries as deleting the workspace will delete associated saved queries | ||
cy.deleteWorkspaceByName(workspaceName); | ||
// // TODO: Modify deleteIndex to handle an array of index and remove hard code | ||
cy.deleteDataSourceByName(datasourceName); | ||
cy.deleteIndex(INDEX_WITH_TIME_1); | ||
cy.deleteIndex(INDEX_WITH_TIME_2); | ||
}); | ||
|
||
const testConfigurations = generateAllTestConfigurations(generateSavedTestConfiguration); | ||
|
||
describe('should create initial saved queries', () => { | ||
testConfigurations.forEach((config) => { | ||
it(`should create saved query: ${config.testName}`, () => { | ||
cy.navigateToWorkSpaceSpecificPage({ | ||
workspaceName, | ||
page: 'discover', | ||
isEnhancement: true, | ||
}); | ||
|
||
cy.setDataset(config.dataset, datasourceName, config.datasetType); | ||
|
||
cy.setQueryLanguage(config.language); | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
|
||
setQueryConfigurations(config); | ||
verifyDiscoverPageState(config); | ||
|
||
cy.saveQuery(config.saveName, ' ', true, true); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('should test loading, saving and deleting saved queries', () => { | ||
testConfigurations.forEach((config) => { | ||
it(`should load saved query: ${config.testName}`, () => { | ||
cy.getElementByTestId('discoverNewButton').click(); | ||
setDatePickerDatesAndSearchIfRelevant( | ||
config.language, | ||
'Aug 29, 2020 @ 00:00:00.000', | ||
'Aug 30, 2020 @ 00:00:00.000' | ||
); | ||
|
||
cy.loadSaveQuery(config.saveName); | ||
// wait for saved queries to load. | ||
cy.getElementByTestId('docTable').should('be.visible'); | ||
verifyDiscoverPageState(config); | ||
}); | ||
|
||
it(`should update the loaded saved query: ${config.testName}`, () => { | ||
updateAndVerifySavedQuery(config); | ||
}); | ||
|
||
const saveAsNewQueryName = config.testName + SAVE_AS_NEW_QUERY_SUFFIX; | ||
it(`should modify saved query: ${config.testName} and save as new query: ${saveAsNewQueryName}`, () => { | ||
if (config.filters) { | ||
cy.deleteAllFilters(); | ||
} | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
|
||
setQueryConfigurations(config); | ||
verifyDiscoverPageState(config); | ||
validateSaveAsNewQueryMatchingNameHasError(config.saveName); | ||
cy.updateSaveQuery(saveAsNewQueryName, true, true, true); | ||
|
||
cy.reload(); | ||
cy.loadSaveQuery(saveAsNewQueryName); | ||
// wait for saved query to load | ||
cy.getElementByTestId('docTable').should('be.visible'); | ||
verifyDiscoverPageState(config); | ||
}); | ||
|
||
it(`should delete the saved query: ${saveAsNewQueryName}`, () => { | ||
cy.navigateToWorkSpaceSpecificPage({ | ||
workspaceName, | ||
page: 'discover', | ||
isEnhancement: true, | ||
}); | ||
|
||
cy.deleteSaveQuery(saveAsNewQueryName); | ||
verifyQueryDoesNotExistInSavedQueries(saveAsNewQueryName); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
|
||
runSavedQueriesFlyoutUITests(); |
101 changes: 0 additions & 101 deletions
101
...rch_dashboards/opensearch_dashboards/apps/query_enhancements/saved_queries_flyout.spec.js
This file was deleted.
Oops, something went wrong.
100 changes: 0 additions & 100 deletions
100
...ch_dashboards/opensearch_dashboards/apps/query_enhancements/saved_queries_popover.spec.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
lets remove
flyout UI