forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover 2.0 Testing] Create View List of Saved Queries Test (Test-I…
…d 124: View list of Saved query) (opensearch-project#9166) * add spec for old ui Signed-off-by: Argus Li <[email protected]> * Add comment about cleaning up saved queries Signed-off-by: Argus Li <[email protected]> * Add data-test-subj for save query new ui Signed-off-by: Argus Li <[email protected]> * Add data-test-subj for save query button for new ui Signed-off-by: Argus Li <[email protected]> * Add data-test-subj for open query button in query management popover Signed-off-by: Argus Li <[email protected]> * Add new ui spec to test list saved queries Signed-off-by: Argus Li <[email protected]> * Fix DataSource url Signed-off-by: Argus Li <[email protected]> * Changeset file for PR opensearch-project#9166 created/updated * Address Justin's comments. Signed-off-by: Argus Li <[email protected]> * Remove final force. Signed-off-by: Argus Li <[email protected]> * Fix final force. Signed-off-by: Argus Li <[email protected]> * Move utils to Suchit's suggested location, fix comments Signed-off-by: Argus Li <[email protected]> * Rename specs, change cypress workflow to use new save query ui, merge old ui and new ui commands Signed-off-by: Argus Li <[email protected]> * fix import Signed-off-by: Argus Li <[email protected]> --------- Signed-off-by: Argus Li <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5a290a4
commit 33f7ba6
Showing
12 changed files
with
433 additions
and
7 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 @@ | ||
test: | ||
- Add cypress integration test for the old and new UI view saved queries. ([#9166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9166)) |
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
104 changes: 104 additions & 0 deletions
104
...rch-dashboards/opensearch-dashboards/apps/query_enhancements/saved_queries_flyout.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,104 @@ | ||
/* | ||
* 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 { | ||
workspaceName, | ||
datasourceName, | ||
setSearchConfigurations, | ||
setDatePickerDatesAndSearchIfRelevant, | ||
verifyDiscoverPageState, | ||
} from '../../../../../utils/apps/query_enhancements/saved_search'; | ||
|
||
import { generateAllTestConfigurations } from '../../../../../utils/apps/query_enhancements/saved_queries'; | ||
|
||
// This spec assumes data.savedQueriesNewUI.enabled is true. | ||
|
||
export const runSavedQueriesFlyoutUITests = () => { | ||
describe('saved queries flyout UI', () => { | ||
before(() => { | ||
// 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.createInitialWorkspaceWithDataSource(datasourceName, workspaceName); | ||
cy.createWorkspaceIndexPatterns({ | ||
workspaceName: workspaceName, | ||
indexPattern: INDEX_PATTERN_WITH_TIME.replace('*', ''), | ||
timefieldName: 'timestamp', | ||
dataSource: datasourceName, | ||
isEnhancement: true, | ||
}); | ||
}); | ||
|
||
after(() => { | ||
// 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(); | ||
testConfigurations.forEach((config) => { | ||
it(`should successfully create a saved query for ${config.testName}`, () => { | ||
cy.navigateToWorkSpaceSpecificPage({ | ||
workspaceName, | ||
page: 'discover', | ||
isEnhancement: true, | ||
}); | ||
|
||
cy.setDataset(config.dataset, datasourceName, config.datasetType); | ||
|
||
cy.setQueryLanguage(config.language); | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
|
||
setSearchConfigurations(config); | ||
verifyDiscoverPageState(config); | ||
cy.saveQuery(config.saveName); | ||
}); | ||
}); | ||
|
||
it('should see all saved queries', () => { | ||
cy.getElementByTestId('saved-query-management-popover-button').click(); | ||
|
||
cy.getElementByTestId('saved-query-management-open-button').click(); | ||
|
||
testConfigurations.forEach((config) => { | ||
cy.getElementByTestId('euiFlyoutCloseButton') | ||
.parent() | ||
.contains(config.saveName) | ||
.should('exist'); | ||
}); | ||
}); | ||
}); | ||
}; | ||
|
||
runSavedQueriesFlyoutUITests(); |
102 changes: 102 additions & 0 deletions
102
...ch-dashboards/opensearch-dashboards/apps/query_enhancements/saved_queries_popover.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,102 @@ | ||
/* | ||
* 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 { | ||
workspaceName, | ||
datasourceName, | ||
setSearchConfigurations, | ||
setDatePickerDatesAndSearchIfRelevant, | ||
verifyDiscoverPageState, | ||
} from '../../../../../utils/apps/query_enhancements/saved_search'; | ||
|
||
import { generateAllTestConfigurations } from '../../../../../utils/apps/query_enhancements/saved_queries'; | ||
|
||
// This spec assumes data.savedQueriesNewUI.enabled is false. | ||
// These tests will not be run until the older legacy tests are migrated https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9166#discussion_r1913687440 | ||
|
||
export const runSavedQueriesPopoverUITests = () => { | ||
describe.skip('saved queries popover UI', () => { | ||
before(() => { | ||
// 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.createInitialWorkspaceWithDataSource(datasourceName, workspaceName); | ||
cy.createWorkspaceIndexPatterns({ | ||
workspaceName: workspaceName, | ||
indexPattern: INDEX_PATTERN_WITH_TIME.replace('*', ''), | ||
timefieldName: 'timestamp', | ||
dataSource: datasourceName, | ||
isEnhancement: true, | ||
}); | ||
}); | ||
|
||
after(() => { | ||
// 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(); | ||
testConfigurations.forEach((config) => { | ||
it(`should successfully create a saved query for ${config.testName}`, () => { | ||
cy.navigateToWorkSpaceSpecificPage({ | ||
workspaceName, | ||
page: 'discover', | ||
isEnhancement: true, | ||
}); | ||
|
||
cy.setDataset(config.dataset, datasourceName, config.datasetType); | ||
|
||
cy.setQueryLanguage(config.language); | ||
setDatePickerDatesAndSearchIfRelevant(config.language); | ||
|
||
setSearchConfigurations(config); | ||
verifyDiscoverPageState(config); | ||
cy.saveQuery(config.saveName, ' ', false); | ||
}); | ||
}); | ||
|
||
it('should see all saved queries', () => { | ||
cy.getElementByTestId('saved-query-management-popover-button').click(); | ||
|
||
testConfigurations.forEach((config) => { | ||
cy.getElementByTestId('saved-query-management-popover') | ||
.contains(config.saveName) | ||
.should('exist'); | ||
}); | ||
}); | ||
}); | ||
}; | ||
|
||
runSavedQueriesPopoverUITests(); |
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
File renamed without changes.
Oops, something went wrong.