betodealmeida commented on code in PR #31699:
URL: https://github.com/apache/superset/pull/31699#discussion_r1917395064
##########
superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts:
##########
@@ -34,46 +34,55 @@ function openModalFromMenu(chartType: string) {
cy.get(
`[data-test-viz-type='${chartType}'] [aria-label='More Options']`,
).click();
- cy.get('.ant-dropdown')
- .not('.ant-dropdown-hidden')
+ cy.get('.antd5-dropdown')
+ .not('.antd5-dropdown-hidden')
.find("[role='menu'] [role='menuitem']")
.eq(5)
.should('contain', 'Drill to detail')
.click();
cy.wait('@samples');
}
-function openModalFromChartContext(targetMenuItem: string) {
+function drillToDetail(targetMenuItem: string) {
interceptSamples();
- if (targetMenuItem.startsWith('Drill to detail by')) {
- cy.get('.ant-dropdown')
- .not('.ant-dropdown-hidden')
- .should('be.visible')
- .first()
- .find("[role='menu'] [role='menuitem'] [title='Drill to detail by']")
- .trigger('mouseover');
- cy.get('[data-test="drill-to-detail-by-submenu"]')
- .should('be.visible')
- .not('.ant-dropdown-menu-hidden
[data-test="drill-to-detail-by-submenu"]')
- .should('be.visible')
- .find('[role="menuitem"]')
- .contains(new RegExp(`^${targetMenuItem}$`))
- .first()
- .click();
- } else {
- cy.get('.ant-dropdown')
- .not('.ant-dropdown-hidden')
- .first()
- .find("[role='menu'] [role='menuitem']")
- .contains(new RegExp(`^${targetMenuItem}$`))
- .first()
- .click();
- }
+ cy.get('.antd5-dropdown')
+ .not('.antd5-dropdown-hidden')
+ .first()
+ .find("[role='menu'] [role='menuitem']")
+ .contains(new RegExp(`^${targetMenuItem}$`))
+ .first()
+ .trigger('keydown', { keyCode: 13, which: 13, force: true });
+
cy.getBySel('metadata-bar').should('be.visible');
cy.wait('@samples');
}
+const drillToDetailBy = (targetDrill: string) => {
+ interceptSamples();
+
+ cy.get('.ant-dropdown:not(.ant-dropdown-hidden)')
+ .first()
+ .should('be.visible')
+ .find("[role='menu'] [role='menuitem']")
+ .contains(new RegExp(`^Drill to detail by$`))
Review Comment:
```suggestion
.contains(/^Drill to detail by$/)
```
##########
superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts:
##########
@@ -56,15 +56,21 @@ const drillBy = (targetDrillByColumn: string, isLegacy =
false) => {
cy.get('.ant-dropdown:not(.ant-dropdown-hidden)')
.first()
- .find("[role='menu'] [role='menuitem'] [title='Drill by']")
+ .should('be.visible')
+ .find("[role='menu'] [role='menuitem']")
+ .contains(new RegExp(`^Drill by$`))
Review Comment:
Nit, use `//` for static regexes as it's more readable IMHO:
```suggestion
.contains(/^Drill by$/)
```
##########
superset-frontend/src/components/DropdownSelectableIcon/index.tsx:
##########
@@ -98,7 +104,19 @@ const StyleSubmenuItem = styled.div`
export default (props: DropDownSelectableProps) => {
const theme = useTheme();
+ const [visible, setVisible] = useState(false);
const { icon, info, menuItems, selectedKeys, onSelect } = props;
+
+ const handleVisibleChange = (flag: boolean) => {
+ setVisible(flag);
+ };
Review Comment:
```suggestion
const handleVisibleChange = setVisible;
```
Or just use `setVisible` where `handleVisibleChange` is being used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]