Skip to content

Commit 6db0940

Browse files
F #6718: add data-cy for tests (#3245)
1 parent efa5e62 commit 6db0940

File tree

31 files changed

+110
-32
lines changed

31 files changed

+110
-32
lines changed

src/fireedge/src/client/components/MultipleTags/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ MultipleTags.propTypes = {
116116
tags: PropTypes.any,
117117
limitTags: PropTypes.number,
118118
clipboard: PropTypes.bool,
119-
truncateText: PropTypes.bool,
119+
truncateText: PropTypes.number,
120120
}
121121
MultipleTags.displayName = 'MultipleTags'
122122

src/fireedge/src/client/components/Tables/ACLs/row.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ACL_TABLE_VIEWS } from 'client/constants'
2626
import PropTypes from 'prop-types'
2727

2828
const Row = (viewType) => {
29-
const aclRow = ({ original, value, headerList, ...props }) => {
29+
const aclRow = ({ original, value, headerList, rowDataCy, ...props }) => {
3030
// Check what view show in the table cards
3131
if (viewType === ACL_TABLE_VIEWS.NAMES.type) {
3232
return <ACLCardNames rootProps={props} acl={value} />

src/fireedge/src/client/components/Tables/AllImages/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { T } from 'client/constants'
3535
import * as Helper from 'client/models/Helper'
3636
import * as ImageModel from 'client/models/Image'
3737

38-
const Row = ({ original, value, headerList, ...props }) => {
38+
const Row = ({ original, value, headerList, rowDataCy, ...props }) => {
3939
const classes = rowStyles()
4040
const {
4141
ID,
@@ -127,6 +127,7 @@ Row.propTypes = {
127127
isSelected: PropTypes.bool,
128128
handleClick: PropTypes.func,
129129
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
130+
rowDataCy: PropTypes.string,
130131
}
131132

132133
export default Row

src/fireedge/src/client/components/Tables/BackupJobs/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import backupjobApi, {
2323
import { jsonToXml } from 'client/models/Helper'
2424

2525
const Row = memo(
26-
({ original, value, onClickLabel, headerList, ...props }) => {
26+
({ original, value, onClickLabel, headerList, rowDataCy, ...props }) => {
2727
const [update] = useUpdateBackupJobMutation()
2828

2929
const state = backupjobApi.endpoints.getBackupJobs.useQueryState(
@@ -68,6 +68,7 @@ Row.propTypes = {
6868
onClick: PropTypes.func,
6969
onClickLabel: PropTypes.func,
7070
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
71+
rowDataCy: PropTypes.string,
7172
}
7273

7374
Row.displayName = 'VirtualDataCenterRow'

src/fireedge/src/client/components/Tables/Backups/row.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ import { T } from 'client/constants'
4545
import * as Helper from 'client/models/Helper'
4646
import * as ImageModel from 'client/models/Image'
4747

48-
const Row = ({ original, value, onClickLabel, headerList, ...props }) => {
48+
const Row = ({
49+
original,
50+
value,
51+
onClickLabel,
52+
headerList,
53+
rowDataCy,
54+
...props
55+
}) => {
4956
const [update] = useUpdateImageMutation()
5057
const { labels: userLabels } = useAuth()
5158

@@ -188,6 +195,7 @@ Row.propTypes = {
188195
handleClick: PropTypes.func,
189196
onClickLabel: PropTypes.func,
190197
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
198+
rowDataCy: PropTypes.string,
191199
}
192200

193201
export default Row

src/fireedge/src/client/components/Tables/Clusters/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { rowStyles } from 'client/components/Tables/styles'
2424
import { Tr } from 'client/components/HOC'
2525
import { T } from 'client/constants'
2626

27-
const Row = ({ original, value, headerList, ...props }) => {
27+
const Row = ({ original, value, headerList, rowDataCy, ...props }) => {
2828
const classes = rowStyles()
2929
const { ID, NAME, HOSTS, DATASTORES, VNETS, PROVIDER_NAME } = value
3030

@@ -77,6 +77,7 @@ Row.propTypes = {
7777
isSelected: PropTypes.bool,
7878
handleClick: PropTypes.func,
7979
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
80+
rowDataCy: PropTypes.string,
8081
}
8182

8283
export default Row

src/fireedge/src/client/components/Tables/Datastores/row.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ import api, {
2323
} from 'client/features/OneApi/datastore'
2424

2525
const Row = memo(
26-
({ original, value, onClickLabel, zone, headerList, ...props }) => {
26+
({
27+
original,
28+
value,
29+
onClickLabel,
30+
zone,
31+
headerList,
32+
rowDataCy,
33+
...props
34+
}) => {
2735
const [update] = useUpdateDatastoreMutation()
2836
const {
2937
data: datastores,
@@ -73,6 +81,7 @@ Row.propTypes = {
7381
onClickLabel: PropTypes.func,
7482
zone: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7583
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
84+
rowDataCy: PropTypes.string,
7685
}
7786

7887
Row.displayName = 'DatastoreRow'

src/fireedge/src/client/components/Tables/Enhanced/WrapperRow.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,25 @@ const listStyles = makeStyles(({ palette }) => ({
3535
*/
3636
const RowStyle = memo(
3737
({
38-
original,
39-
value,
38+
original = {},
39+
value = {},
4040
onClickLabel,
4141
onDeleteLabel,
4242
globalErrors,
4343
headerList = [],
4444
className,
45+
rowDataCy = '',
4546
...props
4647
}) => {
48+
const { ID = '' } = original
4749
const styles = listStyles()
4850

4951
return (
50-
<TableRow {...props} className={`${styles.row} ${className}`}>
52+
<TableRow
53+
data-cy={`list-${rowDataCy}-${ID}`}
54+
{...props}
55+
className={`${styles.row} ${className}`}
56+
>
5157
{headerList.map(({ id, accessor }) => {
5258
switch (typeof accessor) {
5359
case 'string':
@@ -71,6 +77,7 @@ RowStyle.propTypes = {
7177
onDeleteLabel: PropTypes.func,
7278
globalErrors: PropTypes.array,
7379
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
80+
rowDataCy: PropTypes.string,
7481
className: PropTypes.string,
7582
}
7683

src/fireedge/src/client/components/Tables/Enhanced/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const DataListPerPage = memo(
7979
zoneId,
8080
cannotFilterByLabel,
8181
styles,
82+
rootProps: rootPropsTable,
8283
}) => {
8384
if (!page.length) {
8485
return ''
@@ -102,6 +103,7 @@ const DataListPerPage = memo(
102103
{...(messageValues.length && {
103104
globalErrors: messageValues,
104105
})}
106+
rowDataCy={rootPropsTable?.['data-cy'] ?? ''}
105107
className={isSelected ? 'selected' : ''}
106108
{...(!cannotFilterByLabel && {
107109
onClickLabel: (label) => {
@@ -165,6 +167,9 @@ DataListPerPage.propTypes = {
165167
zoneId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
166168
cannotFilterByLabel: PropTypes.any,
167169
styles: PropTypes.any,
170+
rootProps: PropTypes.shape({
171+
'data-cy': PropTypes.string,
172+
}),
168173
}
169174

170175
DataListPerPage.displayName = 'DataListPerPage'
@@ -509,6 +514,7 @@ const EnhancedTable = ({
509514

510515
{/* DATALIST PER PAGE */}
511516
<DataListPerPage
517+
rootProps={rootProps}
512518
page={page}
513519
prepareRow={prepareRow}
514520
RowComponent={RowComponent}

src/fireedge/src/client/components/Tables/Hosts/row.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ import PropTypes from 'prop-types'
2020
import { memo, useCallback, useMemo } from 'react'
2121

2222
const Row = memo(
23-
({ original, value, onClickLabel, zone, headerList, ...props }) => {
23+
({
24+
original,
25+
value,
26+
onClickLabel,
27+
zone,
28+
headerList,
29+
rowDataCy,
30+
...props
31+
}) => {
2432
const [update] = useUpdateHostMutation()
2533

2634
const {
@@ -72,6 +80,7 @@ Row.propTypes = {
7280
onClickLabel: PropTypes.func,
7381
zone: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7482
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
83+
rowDataCy: PropTypes.string,
7584
}
7685

7786
Row.displayName = 'HostRow'

src/fireedge/src/client/components/Tables/Images/row.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ import { prettyBytes } from 'client/utils'
4545
import * as Helper from 'client/models/Helper'
4646
import * as ImageModel from 'client/models/Image'
4747

48-
const Row = ({ original, value, onClickLabel, headerList, ...props }) => {
48+
const Row = ({
49+
original,
50+
value,
51+
onClickLabel,
52+
headerList,
53+
rowDataCy,
54+
...props
55+
}) => {
4956
const [update] = useUpdateImageMutation()
5057
const { labels: userLabels } = useAuth()
5158

@@ -168,6 +175,7 @@ Row.propTypes = {
168175
handleClick: PropTypes.func,
169176
onClickLabel: PropTypes.func,
170177
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
178+
rowDataCy: PropTypes.string,
171179
}
172180

173181
export default Row

src/fireedge/src/client/components/Tables/Increments/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { prettyBytes } from 'client/utils'
3131

3232
import * as Helper from 'client/models/Helper'
3333

34-
const Row = ({ original, value, headerList, ...props }) => {
34+
const Row = ({ original, value, headerList, rowDataCy, ...props }) => {
3535
const classes = rowStyles()
3636
const { ID, TYPE, DATE, SIZE, SOURCE } = value
3737

@@ -79,6 +79,7 @@ Row.propTypes = {
7979
isSelected: PropTypes.bool,
8080
handleClick: PropTypes.func,
8181
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
82+
rowDataCy: PropTypes.string,
8283
}
8384

8485
export default Row

src/fireedge/src/client/components/Tables/MarketplaceApps/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import api, {
2323
import { jsonToXml } from 'client/models/Helper'
2424

2525
const Row = memo(
26-
({ original, value, onClickLabel, headerList, ...props }) => {
26+
({ original, value, onClickLabel, headerList, rowDataCy, ...props }) => {
2727
const [update] = useUpdateAppMutation()
2828

2929
const state = api.endpoints.getMarketplaceApps.useQueryState(undefined, {
@@ -65,6 +65,7 @@ Row.propTypes = {
6565
onClick: PropTypes.func,
6666
onClickLabel: PropTypes.func,
6767
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
68+
rowDataCy: PropTypes.string,
6869
}
6970

7071
Row.displayName = 'MarketplaceAppRow'

src/fireedge/src/client/components/Tables/Marketplaces/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { MarketplaceCard } from 'client/components/Cards'
2020
import marketplaceApi from 'client/features/OneApi/marketplace'
2121

2222
const Row = memo(
23-
({ original, value, headerList, ...props }) => {
23+
({ original, value, headerList, rowDataCy, ...props }) => {
2424
const state = marketplaceApi.endpoints.getMarketplaces.useQueryState(
2525
undefined,
2626
{
@@ -43,6 +43,7 @@ Row.propTypes = {
4343
className: PropTypes.string,
4444
handleClick: PropTypes.func,
4545
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
46+
rowDataCy: PropTypes.string,
4647
}
4748

4849
Row.displayName = 'MarketplaceRow'

src/fireedge/src/client/components/Tables/SecurityGroups/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import PropTypes from 'prop-types'
2222
import { memo, useCallback, useMemo } from 'react'
2323

2424
const Row = memo(
25-
({ original, value, onClickLabel, headerList, ...props }) => {
25+
({ original, value, onClickLabel, headerList, rowDataCy, ...props }) => {
2626
const [update] = useUpdateSecGroupMutation()
2727

2828
const {
@@ -75,6 +75,7 @@ Row.propTypes = {
7575
handleClick: PropTypes.func,
7676
onClickLabel: PropTypes.func,
7777
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
78+
rowDataCy: PropTypes.string,
7879
}
7980

8081
Row.displayName = 'SecurityGroupRow'

src/fireedge/src/client/components/Tables/ServiceTemplates/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import serviceTemplateApi, {
2222
} from 'client/features/OneApi/serviceTemplate'
2323

2424
const Row = memo(
25-
({ original, value, headerList, ...props }) => {
25+
({ original, value, headerList, rowDataCy, ...props }) => {
2626
const [update] = useUpdateServiceTemplateMutation()
2727

2828
const state =
@@ -64,6 +64,7 @@ Row.propTypes = {
6464
className: PropTypes.string,
6565
handleClick: PropTypes.func,
6666
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
67+
rowDataCy: PropTypes.string,
6768
}
6869

6970
Row.displayName = 'ServiceTemplateRow'

src/fireedge/src/client/components/Tables/Services/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ServiceCard } from 'client/components/Cards'
2020
import serviceApi from 'client/features/OneApi/service'
2121

2222
const Row = memo(
23-
({ original, value, headerList, ...props }) => {
23+
({ original, value, headerList, rowDataCy, ...props }) => {
2424
const state = serviceApi.endpoints.getServices.useQueryState(undefined, {
2525
selectFromResult: ({ data = [] }) =>
2626
data.find((service) => +service.ID === +original.ID),
@@ -40,6 +40,7 @@ Row.propTypes = {
4040
className: PropTypes.string,
4141
handleClick: PropTypes.func,
4242
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
43+
rowDataCy: PropTypes.string,
4344
}
4445

4546
Row.displayName = 'ServiceRow'

src/fireedge/src/client/components/Tables/Support/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { memo } from 'react'
1919
import { SupportCard } from 'client/components/Cards'
2020

2121
const Row = memo(
22-
({ original, value, headerList, ...props }) => (
22+
({ original, value, headerList, rowDataCy, ...props }) => (
2323
<SupportCard ticket={original} rootProps={props} />
2424
),
2525
(prev, next) => prev.className === next.className
@@ -32,6 +32,7 @@ Row.propTypes = {
3232
className: PropTypes.string,
3333
onClick: PropTypes.func,
3434
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
35+
rowDataCy: PropTypes.string,
3536
}
3637

3738
Row.displayName = 'SupportRow'

src/fireedge/src/client/components/Tables/Users/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import PropTypes from 'prop-types'
1818

1919
import { UserCard } from 'client/components/Cards'
2020

21-
const Row = ({ original, value, headerList, ...props }) => (
21+
const Row = ({ original, value, headerList, rowDataCy, ...props }) => (
2222
<UserCard rootProps={props} user={value} />
2323
)
2424

@@ -28,6 +28,7 @@ Row.propTypes = {
2828
isSelected: PropTypes.bool,
2929
handleClick: PropTypes.func,
3030
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
31+
rowDataCy: PropTypes.string,
3132
}
3233

3334
export default Row

src/fireedge/src/client/components/Tables/VNetworkTemplates/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { T } from 'client/constants'
2525

2626
import * as Helper from 'client/models/Helper'
2727

28-
const Row = ({ original, value, headerList, ...props }) => {
28+
const Row = ({ original, value, headerList, rowDataCy, ...props }) => {
2929
const classes = rowStyles()
3030
const { ID, NAME, UNAME, GNAME, LOCK, REGTIME, PROVISION_ID } = value
3131

@@ -69,6 +69,7 @@ Row.propTypes = {
6969
isSelected: PropTypes.bool,
7070
handleClick: PropTypes.func,
7171
headerList: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
72+
rowDataCy: PropTypes.string,
7273
}
7374

7475
export default Row

0 commit comments

Comments
 (0)