chore(ui): add data-test attributes

pull/5948/head
k3yi0 2022-06-14 15:19:29 +02:00
parent eae82c2c8d
commit b1715b0ccc
6 changed files with 17 additions and 5 deletions

View File

@ -49,6 +49,7 @@ class AllUsersTableHeader extends Component<Props> {
size={ComponentSize.Small}
active={superAdminNewUsers}
onChange={this.handleToggleClick}
entity="new-users-superAdmin"
/>
<span>All new users are SuperAdmins</span>
</div>

View File

@ -89,6 +89,7 @@ export default class AllUsersTableRow extends Component<Props> {
color={ComponentColor.Success}
disabled={this.userIsMe}
tooltipText={this.toggleTooltipText}
entity="superAdmin"
/>
</td>
<td style={{textAlign: 'right', width: colActions}}>
@ -99,6 +100,7 @@ export default class AllUsersTableRow extends Component<Props> {
type="btn-danger"
text="Delete"
customClass="table--show-on-row-hover"
testId="delete-user--button"
/>
</td>
</tr>

View File

@ -152,19 +152,25 @@ class AllUsersTableRowNew extends Component {
disabled={true}
placeholder="OAuth Scheme..."
value={scheme}
data-test="oauth-scheme--input"
/>
</td>
<td style={{width: colSuperAdmin}} className="text-center">
&mdash;
</td>
<td className="text-right" style={{width: colActions}}>
<button className="btn btn-xs btn-square btn-info" onClick={onBlur}>
<button
className="btn btn-xs btn-square btn-info"
onClick={onBlur}
data-test="cancel-new-user--button"
>
<span className="icon remove" />
</button>
<button
className="btn btn-xs btn-square btn-success"
disabled={preventCreate}
onClick={this.handleConfirmCreateUser}
data-test="confirm-new-user--button"
>
<span className="icon checkmark" />
</button>

View File

@ -125,7 +125,7 @@ class UsersTableRowNew extends Component {
disabled={true}
placeholder="OAuth Scheme..."
value={scheme}
data-test="oauth-schema--input"
data-test="oauth-scheme--input"
/>
</td>
<td className="text-right" style={{width: colActions}}>

View File

@ -63,7 +63,7 @@ class SlideToggle extends Component<Props> {
private get dataTest(): string {
const {active, entity} = this.props
return active ? `hide-${entity}--toggle` : `show-${entity}--toggle`
return active ? `turn-off-${entity}--toggle` : `turn-on-${entity}--toggle`
}
}

View File

@ -33,6 +33,7 @@ const Tags: FunctionComponent<TagsProps> = ({
item={item}
onDelete={onDeleteTag}
confirmText={confirmText}
testId={item.text || item.name || item}
/>
)
})}
@ -47,6 +48,7 @@ interface TagProps {
confirmText?: string
item: Item
onDelete: (item: Item) => void
testId?: Item
}
@ErrorHandling
@ -56,9 +58,9 @@ class Tag extends PureComponent<TagProps> {
}
public render() {
const {item, confirmText} = this.props
const {item, confirmText, testId} = this.props
return (
<span key={uuid.v4()} className="input-tag--item">
<span key={uuid.v4()} className="input-tag--item" data-test={`${testId}-tag--item`}>
<span>{item.text || item.name || item}</span>
<ConfirmButton
icon="remove"
@ -67,6 +69,7 @@ class Tag extends PureComponent<TagProps> {
confirmText={confirmText}
customClass="input-tag--remove"
confirmAction={this.handleClickDelete(item)}
testId="delete-tag--button"
/>
</span>
)