-
Notifications
You must be signed in to change notification settings - Fork 919
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
[Discover 2.0 Testing] TestId-69: Filtering #9047
Closed
ArgusLi
wants to merge
29
commits into
opensearch-project:main
from
ArgusLi:testid-69-filtering-suite-expanded-table
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
2b6cce4
Update Cypress to v12 (#8926)
d-rowe fab8612
fix: support imports without extensions in cypress webpack build (#8993)
d-rowe 1d8ad94
Add utils to select a data source.
ArgusLi af1fd47
Add support for different languages when creating dataset. Filter Out…
ArgusLi a19ec29
Reformat to match OSD-functional-tests.
ArgusLi 9877480
Upgrade Cypress to v12 (#8995)
d-rowe ea46542
Complete test suite filter actions in table field.
ArgusLi aa22a2c
Address comments.
ArgusLi 72a6cb0
Reformat to use POM.
ArgusLi bd63276
Add support for expanded row filters.
ArgusLi 5bc51cc
Change constants to discussed constants.
ArgusLi 5c1a664
Refactor to use absolute dates, move the constants to the spec and us…
ArgusLi 8f80b00
Fix Buttons not detecting if disabled.
ArgusLi d079a1c
Add support for expanded table toggleColumnButton Checks.
ArgusLi 4b8d816
Add Exists Filter functionality.
ArgusLi f4b27c2
Remove conflicting Cypress config file.
ArgusLi d71b64b
Reorganize tests within spec to reduce code duplication. Make small c…
ArgusLi 3aec4ec
Remove reverted main changes.
ArgusLi d906614
Changeset file for PR #9047 created/updated
opensearch-changeset-bot[bot] ae8dae4
Address comments and fix test after rebasing.
ArgusLi 60ede88
Address comments and fix test after rebasing.
ArgusLi cad9a58
Remove files added by commit https://github.com/opensearch-project/Op…
ArgusLi 9589aed
sidebar.md
silva-qa c37777c
add helper and modify spec
silva-qa fca8e6a
fix imports
silva-qa b91eb09
fix more imports
silva-qa 004139f
Fix toggleDocTableRow helper function.
ArgusLi ab7a186
Refactor test framework to address review comment.
ArgusLi ad24614
Fix rebase.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 new Data Explorer UI's Filtering. ([#9047](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9047)) |
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
112 changes: 112 additions & 0 deletions
112
...-dashboards/opensearch-dashboards/apps/query_enhancements/field_display_filtering.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,112 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
import { | ||
DATASOURCE_NAME, | ||
DATASET_CONFIGS, | ||
INDEX_NAME, | ||
INDEX_PATTERN_NAME, | ||
SEARCH_ABSOLUTE_START_DATE, | ||
SEARCH_ABSOLUTE_END_DATE, | ||
} from './constants.js'; | ||
import * as dataExplorer from './helpers.js'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
|
||
function selectDataset(datasetType, language) { | ||
switch (datasetType) { | ||
case 'index': | ||
dataExplorer.selectIndexDataset(DATASOURCE_NAME, INDEX_NAME, language); | ||
break; | ||
case 'index_pattern': | ||
dataExplorer.selectIndexPatternDataset(INDEX_PATTERN_NAME, language); | ||
break; | ||
} | ||
} | ||
|
||
function setDateRange(datasetType, language) { | ||
switch (datasetType) { | ||
case 'index_pattern': | ||
if (language !== 'OpenSearch SQL') { | ||
cy.setSearchAbsoluteDateRange(SEARCH_ABSOLUTE_START_DATE, SEARCH_ABSOLUTE_END_DATE); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
function verifyTableFieldFilterActions(datasetType, language, shouldExist) { | ||
selectDataset(datasetType, language); | ||
setDateRange(datasetType, language); | ||
|
||
cy.getElementByTestId('discoverQueryHits').should('not.exist'); // To ensure it waits until a full table is loaded into the DOM, instead of a bug where table only has 1 hit. | ||
|
||
dataExplorer.verifyDocTableRowFilterForAndOutButton(0, shouldExist); | ||
|
||
if (shouldExist) { | ||
dataExplorer.verifyDocTableFilterAction(0, 'filterForValue', '10,000', '1', true); | ||
dataExplorer.verifyDocTableFilterAction(0, 'filterOutValue', '10,000', '9,999', false); | ||
} | ||
} | ||
|
||
function verifyExpandedTableFilterActions(datasetType, language, isEnabled) { | ||
selectDataset(datasetType, language); | ||
setDateRange(datasetType, language); | ||
|
||
cy.getElementByTestId('discoverQueryHits').should('not.exist'); // To ensure it waits until a full table is loaded into the DOM, instead of a bug where table only has 1 hit. | ||
dataExplorer.toggleDocTableRow(0); | ||
dataExplorer.verifyDocTableFirstExpandedFieldFirstRowFilterForFilterOutExistsFilterButtons( | ||
isEnabled | ||
); | ||
dataExplorer.verifyDocTableFirstExpandedFieldFirstRowToggleColumnButtonHasIntendedBehavior(); | ||
|
||
if (isEnabled) { | ||
dataExplorer.verifyDocTableFirstExpandedFieldFirstRowFilterForButtonFiltersCorrectField( | ||
0, | ||
0, | ||
'10,000', | ||
'1' | ||
); | ||
dataExplorer.verifyDocTableFirstExpandedFieldFirstRowFilterOutButtonFiltersCorrectField( | ||
0, | ||
0, | ||
'10,000', | ||
'9,999' | ||
); | ||
dataExplorer.verifyDocTableFirstExpandedFieldFirstRowExistsFilterButtonFiltersCorrectField( | ||
0, | ||
0, | ||
'10,000', | ||
'10,000' | ||
); | ||
} | ||
} | ||
|
||
describe('filter for value spec', () => { | ||
beforeEach(() => { | ||
cy.localLogin(Cypress.env('username'), Cypress.env('password')); | ||
miscUtils.visitPage('app/data-explorer/discover'); | ||
cy.getNewSearchButton().click(); | ||
}); | ||
|
||
const testCases = [ | ||
{ name: 'table field', verifyFn: verifyTableFieldFilterActions }, | ||
{ name: 'expanded table', verifyFn: verifyExpandedTableFilterActions }, | ||
]; | ||
|
||
testCases.forEach(({ name, verifyFn }) => { | ||
describe(`filter actions in ${name}`, () => { | ||
Object.entries(DATASET_CONFIGS).forEach(([type, config]) => { | ||
describe(`${type} dataset`, () => { | ||
config.languages.forEach(({ name: language, isEnabled }) => { | ||
it(`${language}`, () => { | ||
verifyFn(type, language, isEnabled); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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.
looks like this function
selectDataSet
does more than select dataset (ie it can also set the abs date range). I think the the setting the date range shouldn't be part of this function, as that can lead to confusionThere 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.
Makes sense to me to decouple and have the function do one function. I was trying to reduce the number of compares by 1, but that's needless optimization.