1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Added E2E-friendly selectors to nav and jt details

lint

updated snapshot
This commit is contained in:
Daniel Sami 2019-11-21 15:47:38 -05:00
parent c4143b0111
commit daf3bbc7ef
4 changed files with 32 additions and 2 deletions

View File

@ -25,17 +25,21 @@ const DetailValue = styled(({ fullWidth, ...props }) => (
`}
`;
const Detail = ({ label, value, fullWidth, className }) => {
const Detail = ({ label, value, fullWidth, className, dataCy }) => {
if (!value && typeof value !== 'number') {
return null;
}
const labelCy = dataCy ? `${dataCy}-label` : null;
const valueCy = dataCy ? `${dataCy}-value` : null;
return (
<>
<DetailName
className={className}
component={TextListItemVariants.dt}
fullWidth={fullWidth}
data-cy={labelCy}
>
{label}
</DetailName>
@ -43,6 +47,7 @@ const Detail = ({ label, value, fullWidth, className }) => {
className={className}
component={TextListItemVariants.dd}
fullWidth={fullWidth}
data-cy={valueCy}
>
{value}
</DetailValue>

View File

@ -95,6 +95,7 @@ class PageHeaderToolbar extends Component {
<Tooltip position="left" content={<div>{i18n._(t`User`)}</div>}>
<ToolbarItem>
<Dropdown
id="toolbar-user-dropdown"
isPlain
isOpen={isUserOpen}
position={DropdownPosition.right}

View File

@ -389,10 +389,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
>
<Detail__DetailName
component="dt"
data-cy={null}
fullWidth={false}
>
<StyledComponent
component="dt"
data-cy={null}
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
@ -422,14 +424,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
<Component
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
component="dt"
data-cy={null}
fullWidth={false}
>
<TextListItem
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
component="dt"
data-cy={null}
>
<dt
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
data-cy={null}
data-pf-content={true}
>
Name
@ -440,10 +445,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
</Detail__DetailName>
<Detail__DetailValue
component="dd"
data-cy={null}
fullWidth={false}
>
<StyledComponent
component="dd"
data-cy={null}
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
@ -473,14 +480,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
<Component
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
component="dd"
data-cy={null}
fullWidth={false}
>
<TextListItem
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
component="dd"
data-cy={null}
>
<dd
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
data-cy={null}
data-pf-content={true}
>
jane brown
@ -563,10 +573,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
>
<Detail__DetailName
component="dt"
data-cy={null}
fullWidth={false}
>
<StyledComponent
component="dt"
data-cy={null}
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
@ -596,14 +608,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
<Component
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
component="dt"
data-cy={null}
fullWidth={false}
>
<TextListItem
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
component="dt"
data-cy={null}
>
<dt
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
data-cy={null}
data-pf-content={true}
>
Team Roles
@ -614,10 +629,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
</Detail__DetailName>
<Detail__DetailValue
component="dd"
data-cy={null}
fullWidth={false}
>
<StyledComponent
component="dd"
data-cy={null}
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
@ -647,14 +664,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
<Component
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
component="dd"
data-cy={null}
fullWidth={false}
>
<TextListItem
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
component="dd"
data-cy={null}
>
<dd
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
data-cy={null}
data-pf-content={true}
>
<ChipGroup

View File

@ -197,7 +197,11 @@ class JobTemplateDetail extends Component {
isInitialized && (
<CardBody css="padding-top: 20px;">
<DetailList gutter="sm">
<Detail label={i18n._(t`Name`)} value={name} />
<Detail
label={i18n._(t`Name`)}
value={name}
dataCy="jt-detail-name"
/>
<Detail label={i18n._(t`Description`)} value={description} />
<Detail label={i18n._(t`Job Type`)} value={job_type} />