-
Notifications
You must be signed in to change notification settings - Fork 946
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-58,59] Inspect functionality for Discover and Visualizations #9292
[TESTID-58,59] Inspect functionality for Discover and Visualizations #9292
Conversation
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9292 +/- ##
=======================================
Coverage 61.70% 61.71%
=======================================
Files 3816 3816
Lines 91824 91829 +5
Branches 14542 14543 +1
=======================================
+ Hits 56664 56668 +4
Misses 31506 31506
- Partials 3654 3655 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
...rch_dashboards/opensearch_dashboards/apps/query_enhancements/field_display_filtering.spec.js
Outdated
Show resolved
Hide resolved
cy.intercept('POST', '**/search/*').as('docTablePostRequest'); | ||
|
||
cy.getElementByTestId('docTable').get('tbody tr').should('have.length.above', 3); // To ensure it waits until a full table is loaded into the DOM, instead of a bug where table only has 1 hit. | ||
docTable.toggleDocTableRow(0); |
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 this toggleDocTableRow is to // To ensure it waits until a full table is loaded into the DOM, instead of a bug where table only has 1 hit.
?
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.
The comment is for cy.getElementByTestId('docTable').get('tbody tr').should('have.length.above', 3);
. I can move the comment above the line instead if it makes it more legible?
* Toggle expansion of row rowNumber of Doc Table. | ||
* @param {number} rowNumber rowNumber of Doc Table starts at 0 for row 1. | ||
*/ | ||
export const toggleDocTableRow = (rowNumber) => { |
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.
nit: maybe call it expandDocTableRow is more straightforward?
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.
I would prefer that name, but it can also shrink the tableRow, so I think toggle is a better word.
]; | ||
|
||
/** | ||
* Gets Date and returns string of date in format Jan 24, 2025 @ 16:20:08.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.
should add example for input and output
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.
should not Jan 24, 2025 @ 16:20:08.000 in overall description. we can use it as example as line 24. check my comment for formatValue and add more details.
} | ||
|
||
/** | ||
* Format value to the corresponding string expected in the UI. |
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.
* Format value to the corresponding string expected in the UI. | |
/** | |
* Formats values for UI display by: | |
* - Adding thousand separators to numbers using locale settings | |
* - Converting SQL/PPL datetime strings (YYYY-MM-DD HH:MM:SS.SSS) to formatted dates | |
* - Passing through other values unchanged | |
* @param {string|number} value - The value to format | |
* @returns {string} The formatted value | |
* @example | |
* formatValue(1000) // "1,000" | |
* formatValue("2025-01-24 16:20:08.000") // "Jan 24, 2025 @ 16:20:08.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.
nit: It would be great if you could have separate functions for number, string and date, like formatNumber, formatString and formatDate. Then in the formatValue you call them. I think in sharing or some other tests, we also need to format date. So it would be great to have separate format helpers.
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.
I have separated it and moved all format functions into shared.js.
}; | ||
|
||
/** | ||
* Flatten the object in the format e.g. { |
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.
* Flatten the object in the format e.g. { | |
/** | |
* Recursively flattens a nested object structure into dot notation and formats all values | |
* @param {object} obj - Object to be flattened | |
* @param {string} [parentKey] - Key prefix for nested properties | |
* @param {object} [properties={}] - Accumulator for flattened properties | |
* @returns {object} Flattened object with formatted values | |
* @example | |
* const input = { | |
* FlightNum: "SYS76NQ", | |
* DestLocation: { lat: "38.94449997", lon: "-77.45580292" } | |
* }; | |
* flattenObjectAndFormatValues(input) | |
* // Returns: { | |
* // FlightNum: "SYS76NQ", | |
* // "DestLocation.lat": "38.94449997", | |
* // "DestLocation.lon": "-77.45580292" | |
* // } | |
*/ |
better to have both input and output and don't put the example in the overall discription
}; | ||
|
||
/** | ||
* Flatten the array in the format e.g. [ |
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.
same issue
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.
description is not clear. suggest to change to Flattens an array of field definitions and extracts values for a specific row
} | ||
}; | ||
|
||
/** |
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.
/** | |
/** | |
* Verifies that specified visualizations in the Flights dashboard do not have inspect options | |
* Tests each visualization in visualizationTitlesWithNoInspectOptions array | |
*/ |
}; | ||
|
||
/** | ||
* In the Flights dashboard, verify that the visualizations identified as having an inspect option have the option. |
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.
same to clarify description
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Can you update ciGroup10 or 12 in include this test? |
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
Signed-off-by: Argus Li <[email protected]>
...ion/core_opensearch_dashboards/opensearch_dashboards/apps/query_enhancements/inspect.spec.js
Outdated
Show resolved
Hide resolved
...ion/core_opensearch_dashboards/opensearch_dashboards/apps/query_enhancements/inspect.spec.js
Outdated
Show resolved
Hide resolved
(config.language === QueryLanguages.SQL.name || | ||
config.language === QueryLanguages.PPL.name) | ||
) { | ||
cy.log(`Skipped for ${key}`); |
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.
do we need this?
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.
I want to keep this here. These are skipped because of a bug (#9305), and I want to make it clear they are skipped. I'll add the link to the bug to the comment as well.
Removed a log and a wait. Signed-off-by: Argus Li <[email protected]>
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-9292-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 527c1dcb23f85abd4d0ce09687fb631ff5036c81
# Push it to GitHub
git push --set-upstream origin backport/backport-9292-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
…pensearch-project#9292) * Complete discover inspect tests. Signed-off-by: Argus Li <[email protected]> * Complete visualizations and fix PPL array type. Signed-off-by: Argus Li <[email protected]> * Changeset file for PR opensearch-project#9292 created/updated * Fix docker URL for datasource. Signed-off-by: Argus Li <[email protected]> * Fix namespace issue. Signed-off-by: Argus Li <[email protected]> * Address comments. Signed-off-by: Argus Li <[email protected]> * Fix import Signed-off-by: Argus Li <[email protected]> * Fix import. Signed-off-by: Argus Li <[email protected]> * Add spec to cigroup 10 and 12. Signed-off-by: Argus Li <[email protected]> * Remove test from CI Group 10. Signed-off-by: Argus Li <[email protected]> * Make field display filtering use randomized datasource name Signed-off-by: Argus Li <[email protected]> * Address comments. Removed a log and a wait. 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>
Description
Adds a Cypress test spec for the inspect functionality in the Discover and Dashboards pages.
Issues Resolved
Closes #8955, #8956.
Screenshot
inspect.mp4
Testing the changes
With OSD running, run yarn run cypress open. In E2E specs, you will see 1 new test spec inspect.spec.js. Run the test spec.
Changelog