mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 07:26:03 -03:30
Merge pull request #5377 from dsesami/new-ids
Updated some selector attributes for E2E Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -112,6 +112,9 @@ afterEach(() => {
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Test Attributes** -
|
||||||
|
It should be noted that the `dataCy` prop, as well as its equivalent attribute `data-cy`, are used as flags for any UI test that wants to avoid relying on brittle CSS selectors such as `nth-of-type()`.
|
||||||
|
|
||||||
## Handling API Errors
|
## Handling API Errors
|
||||||
API requests can and will fail occasionally so they should include explicit error handling. The three _main_ categories of errors from our perspective are: content loading errors, form submission errors, and other errors. The patterns currently in place for these are described below:
|
API requests can and will fail occasionally so they should include explicit error handling. The three _main_ categories of errors from our perspective are: content loading errors, form submission errors, and other errors. The patterns currently in place for these are described below:
|
||||||
|
|
||||||
|
|||||||
@@ -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') {
|
if (!value && typeof value !== 'number') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const labelCy = dataCy ? `${dataCy}-label` : null;
|
||||||
|
const valueCy = dataCy ? `${dataCy}-value` : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DetailName
|
<DetailName
|
||||||
className={className}
|
className={className}
|
||||||
component={TextListItemVariants.dt}
|
component={TextListItemVariants.dt}
|
||||||
fullWidth={fullWidth}
|
fullWidth={fullWidth}
|
||||||
|
data-cy={labelCy}
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
</DetailName>
|
</DetailName>
|
||||||
@@ -43,6 +47,7 @@ const Detail = ({ label, value, fullWidth, className }) => {
|
|||||||
className={className}
|
className={className}
|
||||||
component={TextListItemVariants.dd}
|
component={TextListItemVariants.dd}
|
||||||
fullWidth={fullWidth}
|
fullWidth={fullWidth}
|
||||||
|
data-cy={valueCy}
|
||||||
>
|
>
|
||||||
{value}
|
{value}
|
||||||
</DetailValue>
|
</DetailValue>
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ class PageHeaderToolbar extends Component {
|
|||||||
<Tooltip position="left" content={<div>{i18n._(t`User`)}</div>}>
|
<Tooltip position="left" content={<div>{i18n._(t`User`)}</div>}>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
id="toolbar-user-dropdown"
|
||||||
isPlain
|
isPlain
|
||||||
isOpen={isUserOpen}
|
isOpen={isUserOpen}
|
||||||
position={DropdownPosition.right}
|
position={DropdownPosition.right}
|
||||||
|
|||||||
@@ -389,10 +389,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
>
|
>
|
||||||
<Detail__DetailName
|
<Detail__DetailName
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<StyledComponent
|
<StyledComponent
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
forwardedComponent={
|
forwardedComponent={
|
||||||
Object {
|
Object {
|
||||||
"$$typeof": Symbol(react.forward_ref),
|
"$$typeof": Symbol(react.forward_ref),
|
||||||
@@ -422,14 +424,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
<Component
|
<Component
|
||||||
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<TextListItem
|
<TextListItem
|
||||||
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
>
|
>
|
||||||
<dt
|
<dt
|
||||||
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
||||||
|
data-cy={null}
|
||||||
data-pf-content={true}
|
data-pf-content={true}
|
||||||
>
|
>
|
||||||
Name
|
Name
|
||||||
@@ -440,10 +445,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
</Detail__DetailName>
|
</Detail__DetailName>
|
||||||
<Detail__DetailValue
|
<Detail__DetailValue
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<StyledComponent
|
<StyledComponent
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
forwardedComponent={
|
forwardedComponent={
|
||||||
Object {
|
Object {
|
||||||
"$$typeof": Symbol(react.forward_ref),
|
"$$typeof": Symbol(react.forward_ref),
|
||||||
@@ -473,14 +480,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
<Component
|
<Component
|
||||||
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<TextListItem
|
<TextListItem
|
||||||
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
>
|
>
|
||||||
<dd
|
<dd
|
||||||
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
||||||
|
data-cy={null}
|
||||||
data-pf-content={true}
|
data-pf-content={true}
|
||||||
>
|
>
|
||||||
jane brown
|
jane brown
|
||||||
@@ -563,10 +573,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
>
|
>
|
||||||
<Detail__DetailName
|
<Detail__DetailName
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<StyledComponent
|
<StyledComponent
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
forwardedComponent={
|
forwardedComponent={
|
||||||
Object {
|
Object {
|
||||||
"$$typeof": Symbol(react.forward_ref),
|
"$$typeof": Symbol(react.forward_ref),
|
||||||
@@ -596,14 +608,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
<Component
|
<Component
|
||||||
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<TextListItem
|
<TextListItem
|
||||||
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
||||||
component="dt"
|
component="dt"
|
||||||
|
data-cy={null}
|
||||||
>
|
>
|
||||||
<dt
|
<dt
|
||||||
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
className="Detail__DetailName-sc-16ypsyv-0 erdIBg"
|
||||||
|
data-cy={null}
|
||||||
data-pf-content={true}
|
data-pf-content={true}
|
||||||
>
|
>
|
||||||
Team Roles
|
Team Roles
|
||||||
@@ -614,10 +629,12 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
</Detail__DetailName>
|
</Detail__DetailName>
|
||||||
<Detail__DetailValue
|
<Detail__DetailValue
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<StyledComponent
|
<StyledComponent
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
forwardedComponent={
|
forwardedComponent={
|
||||||
Object {
|
Object {
|
||||||
"$$typeof": Symbol(react.forward_ref),
|
"$$typeof": Symbol(react.forward_ref),
|
||||||
@@ -647,14 +664,17 @@ exports[`<ResourceAccessListItem /> initially renders succesfully 1`] = `
|
|||||||
<Component
|
<Component
|
||||||
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
>
|
>
|
||||||
<TextListItem
|
<TextListItem
|
||||||
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
||||||
component="dd"
|
component="dd"
|
||||||
|
data-cy={null}
|
||||||
>
|
>
|
||||||
<dd
|
<dd
|
||||||
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
className="Detail__DetailValue-sc-16ypsyv-1 yHlYM"
|
||||||
|
data-cy={null}
|
||||||
data-pf-content={true}
|
data-pf-content={true}
|
||||||
>
|
>
|
||||||
<ChipGroup
|
<ChipGroup
|
||||||
|
|||||||
@@ -197,7 +197,11 @@ class JobTemplateDetail extends Component {
|
|||||||
isInitialized && (
|
isInitialized && (
|
||||||
<CardBody css="padding-top: 20px;">
|
<CardBody css="padding-top: 20px;">
|
||||||
<DetailList gutter="sm">
|
<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`Description`)} value={description} />
|
||||||
<Detail label={i18n._(t`Job Type`)} value={job_type} />
|
<Detail label={i18n._(t`Job Type`)} value={job_type} />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user