Add Ids to ease tests

Add Ids to ease tests.

See: https://github.com/ansible/awx/issues/8680#issuecomment-893663314
This commit is contained in:
nixocio
2021-08-05 16:54:05 -04:00
parent 1ea0ff611a
commit e9b9dd3072
3 changed files with 12 additions and 4 deletions

View File

@@ -273,6 +273,7 @@ function ToolbarDeleteButton({
{t`Delete`} {t`Delete`}
</Button>, </Button>,
<Button <Button
ouiaId="delete-cancel"
key="cancel" key="cancel"
variant="link" variant="link"
aria-label={t`cancel delete`} aria-label={t`cancel delete`}
@@ -284,7 +285,7 @@ function ToolbarDeleteButton({
> >
<div>{t`This action will delete the following:`}</div> <div>{t`This action will delete the following:`}</div>
{itemsToDelete.map((item) => ( {itemsToDelete.map((item) => (
<span key={item.id}> <span key={item.id} id={`item-to-be-deleted-${item.id}`}>
<strong>{item.name || item.username || item.image}</strong> <strong>{item.name || item.username || item.image}</strong>
<br /> <br />
</span> </span>

View File

@@ -170,6 +170,7 @@ function UserTokenList() {
] ]
: []), : []),
<ToolbarDeleteButton <ToolbarDeleteButton
ouiaId="user-token-delete-button"
key="delete" key="delete"
onDelete={handleDelete} onDelete={handleDelete}
itemsToDelete={modifiedSelected} itemsToDelete={modifiedSelected}

View File

@@ -16,16 +16,22 @@ function UserTokenListItem({ token, isSelected, onSelect, rowIndex }) {
isSelected, isSelected,
onSelect, onSelect,
}} }}
dataLabel={t`Selected`}
id={`token-${token.id}`}
/> />
<Td dataLabel={t`Name`}> <Td dataLabel={t`Name`} id={`token-name-${token.id}`}>
<Link to={`/users/${id}/tokens/${token.id}/details`}> <Link to={`/users/${id}/tokens/${token.id}/details`}>
{token.summary_fields?.application {token.summary_fields?.application
? token.summary_fields.application.name ? token.summary_fields.application.name
: t`Personal access token`} : t`Personal access token`}
</Link> </Link>
</Td> </Td>
<Td dataLabel={t`Scope`}>{toTitleCase(token.scope)}</Td> <Td dataLabel={t`Scope`} id={`token-scope-${token.id}`}>
<Td dataLabel={t`Expires`}>{formatDateString(token.expires)}</Td> {toTitleCase(token.scope)}
</Td>
<Td dataLabel={t`Expires`} id={`token-expires-${token.id}`}>
{formatDateString(token.expires)}
</Td>
</Tr> </Tr>
); );
} }