Skip to content

Commit

Permalink
Merge pull request #77 from BlackBeltTechnology/feature/JNG-4768_fix_…
Browse files Browse the repository at this point in the history
…class_name_based_selectors_in_e2e_tests

JNG-4768 fix class name based selectors in e2e tests
  • Loading branch information
Madmat8 authored Apr 24, 2023
2 parents 4cfc1a5 + 0f827e4 commit 05582a6
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 24 deletions.
2 changes: 1 addition & 1 deletion judo-ui-react/src/main/resources/actor/src/App.tsx.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function App() {
<PrincipalProvider>
{{/ if }}
<SnackbarProvider maxSnack={3} action={(snackbarId) => (
<IconButton style={ { color: '#fff' } } onClick={() => closeSnackbar(snackbarId)}>
<IconButton className="close-error-snackbar" style={ { color: '#fff' } } onClick={() => closeSnackbar(snackbarId)}>
<MdiIcon path="close" />
</IconButton>
)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const FilterOperator = ({ filter, operatorId, valueId, setFilterOperator }: Filt
onChange={onChangeHandler}
>
{getOperatorsByFilter(filter).map((item) => (
<MenuItem id={valueId} key={item} value={item}>
<MenuItem className="filter-operation-item" id={valueId} key={item} value={item}>
{/* TODO: do not forget localization here*/}
{item}
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ export const RangeDialog = <T extends JudoStored<T>, U extends QueryCustomizer<T
loading={isLoading}
rows={data}
rowCount={rowCount}
getRowClassName={() => "data-grid-row"}
getCellClassName={() => "data-grid-cell"}
sortModel={sortModel}
onSortModelChange={handleSortModelChange}
checkboxSelection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const AggregationInput = ({
/>
</ButtonBase>
{exists(value) && onView && (
<IconButton disabled={disabled || editMode} onClick={onView}>
<IconButton className="astronomer-edit" disabled={disabled || editMode} onClick={onView}>
<MdiIcon path="eye" />
</IconButton>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export const TrinaryLogicCombobox = ({
),
} }
>
<MenuItem id={`${id}-true`} value={'Yes'}>{ t('judo.component.TrinaryLogic.true', { defaultValue: 'Yes' }) as string }</MenuItem>
<MenuItem id={`${id}-false`} value={'No'}>{ t('judo.component.TrinaryLogic.false', { defaultValue: 'No' }) as string }</MenuItem>
<MenuItem id={`${id}-undefined`} value={'Unknown'}>{ t('judo.component.TrinaryLogic.unknown', { defaultValue: 'Unknown' }) as string }</MenuItem>
<MenuItem className="trinary-logic-combobox-item" id={`${id}-true`} value={'Yes'}>{ t('judo.component.TrinaryLogic.true', { defaultValue: 'Yes' }) as string }</MenuItem>
<MenuItem className="trinary-logic-combobox-item" id={`${id}-false`} value={'No'}>{ t('judo.component.TrinaryLogic.false', { defaultValue: 'No' }) as string }</MenuItem>
<MenuItem className="trinary-logic-combobox-item" id={`${id}-undefined`} value={'Unknown'}>{ t('judo.component.TrinaryLogic.unknown', { defaultValue: 'Unknown' }) as string }</MenuItem>
</TextField>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{# if page.dataElement.isUpdatable }}
{editMode && isFormUpdateable() && (
<Grid item>
<Grid className="page-action" item>
<Button
id="page-action-edit-cancel"
variant="outlined"
Expand All @@ -16,7 +16,7 @@
</Grid>
)}
{editMode && isFormUpdateable() && (
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-edit-save" onClick={() => saveData()} disabled={isLoading}>
<MdiIcon path="content-save" />
{t('judo.pages.save', { defaultValue: 'Save' })}
Expand All @@ -26,7 +26,7 @@
{{/ if }}
{{# if page.dataElement.isRefreshable }}
{!editMode && (
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-refresh" onClick={() => fetchData()} disabled={isLoading}>
<MdiIcon path="refresh" />
{t('judo.pages.refresh', { defaultValue: 'Refresh' })}
Expand All @@ -37,7 +37,7 @@
{{# each page.pageActions as |action| }}
{{# if action.isDeleteAction }}
{!editMode && isFormDeleteable() && (
<Grid item>
<Grid className="page-action" item>
<Button
id="page-action-delete"
onClick={() => {{ actionFunctionName action page }}({{# if (hasDataElementOwner action.dataElement) }}{ __signedIdentifier: signedIdentifier } as JudoIdentifiable<{{ classDataName page.dataElement.owner '' }}>, {{/ if }}data, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {{ rel.dataElement.name }}Columns: GridColDef<{{ classDataName rel.dataEle
...baseColumnConfig,
field: '{{ column.attributeType.name }}',
headerName: t('{{ idToTranslationKey column.fQName application }}', { defaultValue: '{{ column.label }}' }) as string,
headerClassName: 'data-grid-column-header',
{{> actor/src/fragments/relation/column.fragment.hbs column=column dataElement=rel.dataElement name=rel.name }}
},
{{/ each }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {{ rel.dataElement.name }}Columns: GridColDef<{{ classDataName rel.dataEle
...baseColumnConfig,
field: '{{ column.attributeType.name }}',
headerName: t('{{ idToTranslationKey column.fQName application }}', { defaultValue: '{{ column.label }}' }) as string,
headerClassName: 'data-grid-column-header',
{{> actor/src/fragments/relation/column.fragment.hbs column=column dataElement=rel.dataElement name=rel.name }}
},
{{/ each }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function Header(props: HeaderProps) {
<AppBar position="sticky" elevation={0}>
<Toolbar>
<Grid item>
<Button variant="text" color="secondary" onClick={ () => back() } disabled={isBackDisabled}>
<Button id="navigate-back-button" variant="text" color="secondary" onClick={ () => back() } disabled={isBackDisabled}>
<MdiIcon path="arrow-left" />
</Button>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ function ActionItem(props: MenuItem) {
const { id, label, to, icon } = props;

return (
<ListItemButton id={id} onClick={ () => to && clearNavigate(to) }>
<ListItemButton className="navigation-item" id={id} onClick={ () => to && clearNavigate(to) }>
{icon
? <ListItemIcon>
? <ListItemIcon className="navigation-item-icon">
<MdiIcon path={icon} />
</ListItemIcon>
: null
}
<ListItemText primary={t(`menuTree.${label}`, { defaultValue: label })} />
<ListItemText classes={ { primary: "navigation-item-label"} } primary={t(`menuTree.${label}`, { defaultValue: label })} />
</ListItemButton>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ export default function {{ pageName page }}() {
<PageHeader title={title}>
{{# each (getUniquePageActions page) as |action| }}
{{# if action.isCreateAction }}
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-create" onClick={ () => {{ actionFunctionName action page }}((result: {{ classDataName page.dataElement.target 'Stored' }}) => navigate(`{{ getNavigationForPage (getViewPageForTablePage page) 'result.__signedIdentifier' }}`)) } disabled={isLoading}>
<MdiIcon path="file_document_plus" />
{t('judo.pages.table.create', { defaultValue: 'Create' })}
</Button>
</Grid>
{{/ if }}
{{# if action.isRefreshAction }}
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-refresh" onClick={ () => {{ actionFunctionName action page }}(() => fetchData()) } disabled={isLoading}>
<MdiIcon path="refresh" />
{t('judo.pages.table.refresh', { defaultValue: 'Refresh' })}
Expand All @@ -236,6 +236,8 @@ export default function {{ pageName page }}() {
loading={isLoading}
rows={data}
rowCount={rowCount}
getRowClassName={() => "data-grid-row"}
getCellClassName={() => "data-grid-cell"}
sortModel={sortModel}
onSortModelChange={handleSortModelChange}
columns={[...columns, ...columnsActionCalculator('{{ createId page.dataElement }}', rowActions, { shownActions: 2 })]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const use{{ pageName page }} = () => {
...baseColumnConfig,
field: '{{ column.attributeType.name }}',
headerName: t('{{ idToTranslationKey column.fQName application }}', { defaultValue: '{{ column.label }}' }) as string,
headerClassName: 'data-grid-column-header',
{{> actor/src/fragments/relation/column.fragment.hbs column=column dataElement=table.dataElement name=table.name }}
},
{{/ each }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,31 +214,31 @@ export default function {{ pageName page }}() {
<PageHeader title={title}>
{{# each (getUniquePageActions page) as |action| }}
{{# if action.isRefreshAction }}
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-refresh" onClick={ () => {{ actionFunctionName action page }}(() => fetchData()) } disabled={isLoading}>
<MdiIcon path="refresh" />
{t('judo.pages.table.refresh', { defaultValue: 'Refresh' })}
</Button>
</Grid>
{{/ if }}
{{# if action.isAddAction }}
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-add" onClick={ () => {{ actionFunctionName action page }}({ __signedIdentifier: signedIdentifier } as JudoIdentifiable<{{ classDataName table.dataElement.owner '' }}>, () => fetchData()) } disabled={isLoading}>
<MdiIcon path="attachment-plus" />
{t('judo.pages.table.add', { defaultValue: 'Add' })}
</Button>
</Grid>
{{/ if }}
{{# if action.isClearAction }}
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-clear" onClick={ () => {{ actionFunctionName action page }}({ __signedIdentifier: signedIdentifier } as JudoIdentifiable<{{ classDataName table.dataElement.owner '' }}>, () => fetchData()) } disabled={isLoading}>
<MdiIcon path="link_off" />
{t('judo.pages.table.clear', { defaultValue: 'Clear' })}
</Button>
</Grid>
{{/ if }}
{{# if action.isCreateAction }}
<Grid item>
<Grid className="page-action" item>
<Button id="page-action-create" onClick={ () => {{ actionFunctionName action page }}({ __signedIdentifier: signedIdentifier } as JudoIdentifiable<{{ classDataName table.dataElement.owner '' }}>, () => fetchData()) } disabled={isLoading}>
<MdiIcon path="file_document_plus" />
{t('judo.pages.table.create', { defaultValue: 'Create' })}
Expand All @@ -263,6 +263,8 @@ export default function {{ pageName page }}() {
loading={isLoading}
rows={data}
rowCount={rowCount}
getRowClassName={() => "data-grid-row"}
getCellClassName={() => "data-grid-cell"}
sortModel={sortModel}
onSortModelChange={handleSortModelChange}
columns={[...columns, ...columnsActionCalculator('{{ createId table.dataElement }}', rowActions, { shownActions: 2 })]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const use{{ pageName page }} = () => {
...baseColumnConfig,
field: '{{ column.attributeType.name }}',
headerName: t('{{ idToTranslationKey column.fQName application }}', { defaultValue: '{{ column.label }}' }) as string,
headerClassName: 'data-grid-column-header',
{{> actor/src/fragments/relation/column.fragment.hbs column=column dataElement=table.dataElement name=table.name }}
},
{{/ each }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default function {{ pageName page }}() {
</PageHeader>
<Container component="main" maxWidth="xl">
<Box sx={mainContainerPadding}>
<Grid container xs={12} sm={12} spacing={2} direction="{{# if rootChild.isDirectionHorizontal }}row{{ else }}column{{/ if }}" alignItems="{{ alignItems rootChild }}" justifyContent="{{ justifyContent rootChild }}">
<Grid className="relation-page-data" container xs={12} sm={12} spacing={2} direction="{{# if rootChild.isDirectionHorizontal }}row{{ else }}column{{/ if }}" alignItems="{{ alignItems rootChild }}" justifyContent="{{ justifyContent rootChild }}">
{{# each rootChild.children as |child| }}
{{> (getWidgetTemplate child) }}
{{/ each }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
{{/ if }}
} }
>
<MenuItem id="{{ createId child }}-true" value={'true'}>{ t('judo.form.switch.true', { defaultValue: 'Yes' }) as string }</MenuItem>
<MenuItem id="{{ createId child }}-false" value={'false'}>{ t('judo.form.switch.false', { defaultValue: 'No' }) as string }</MenuItem>
<MenuItem id="{{ createId child }}-undefined" value={' '}>{ t('judo.form.switch.unknown', { defaultValue: 'Unknown' }) as string }</MenuItem>
<MenuItem id="{{ createId child }}-true" className="switch-menu-item" value={'true'}>{ t('judo.form.switch.true', { defaultValue: 'Yes' }) as string }</MenuItem>
<MenuItem id="{{ createId child }}-false" className="switch-menu-item" value={'false'}>{ t('judo.form.switch.false', { defaultValue: 'No' }) as string }</MenuItem>
<MenuItem id="{{ createId child }}-undefined" className="switch-menu-item" value={' '}>{ t('judo.form.switch.unknown', { defaultValue: 'Unknown' }) as string }</MenuItem>
</TextField>
{{ else }}
<FormGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
getRowId={(row: { __identifier: string }) => row.__identifier}
loading={isLoading}
rows={data?.{{ child.dataElement.name }} ?? []}
getRowClassName={() => "data-grid-row"}
getCellClassName={() => "data-grid-cell"}
columns={[ ...{{ child.dataElement.name }}Columns, ...columnsActionCalculator('{{ createId child.dataElement }}', {{ child.dataElement.name }}RowActions, { shownActions: 2 }) ]}
disableRowSelectionOnClick
{{# each child.rowActions as |action| }}
Expand Down

0 comments on commit 05582a6

Please sign in to comment.