From ec08997b63f0c727f6d630df223efa43e78ac878 Mon Sep 17 00:00:00 2001 From: nixocio Date: Wed, 17 Mar 2021 11:26:10 -0400 Subject: [PATCH 1/2] Improve selectors to ease testing Improve selectors to ease testing --- .../src/components/DeleteButton/DeleteButton.jsx | 11 +++++++++++ .../src/components/PaginatedTable/PaginatedTable.jsx | 5 ++++- .../ExecutionEnvironmentList.jsx | 1 + .../OrganizationExecEnvListItem.jsx | 2 +- .../src/screens/User/UserTeams/UserTeamListItem.jsx | 2 +- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/awx/ui_next/src/components/DeleteButton/DeleteButton.jsx b/awx/ui_next/src/components/DeleteButton/DeleteButton.jsx index 245e6ec54c..f17bd9ca95 100644 --- a/awx/ui_next/src/components/DeleteButton/DeleteButton.jsx +++ b/awx/ui_next/src/components/DeleteButton/DeleteButton.jsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import PropTypes from 'prop-types'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; import { Button } from '@patternfly/react-core'; @@ -12,6 +13,7 @@ function DeleteButton({ variant, children, isDisabled, + ouiaId, }) { const [isOpen, setIsOpen] = useState(false); @@ -22,6 +24,7 @@ function DeleteButton({ aria-label={i18n._(t`Delete`)} isDisabled={isDisabled} onClick={() => setIsOpen(true)} + ouiaId={ouiaId} > {children || i18n._(t`Delete`)} @@ -58,4 +61,12 @@ function DeleteButton({ ); } +DeleteButton.propTypes = { + ouiaId: PropTypes.string, +}; + +DeleteButton.defaultProps = { + ouiaId: null, +}; + export default withI18n()(DeleteButton); diff --git a/awx/ui_next/src/components/PaginatedTable/PaginatedTable.jsx b/awx/ui_next/src/components/PaginatedTable/PaginatedTable.jsx index bf70c2acc6..2d33fe1e66 100644 --- a/awx/ui_next/src/components/PaginatedTable/PaginatedTable.jsx +++ b/awx/ui_next/src/components/PaginatedTable/PaginatedTable.jsx @@ -38,6 +38,7 @@ function PaginatedTable({ i18n, renderToolbar, emptyContentMessage, + ouiaId, }) { const history = useHistory(); @@ -95,7 +96,7 @@ function PaginatedTable({ Content = (
{hasContentLoading && } - + {headerRow} {items.map(renderRow)} @@ -181,6 +182,7 @@ PaginatedTable.propTypes = { renderToolbar: PropTypes.func, hasContentLoading: PropTypes.bool, contentError: PropTypes.shape(), + ouiaId: PropTypes.string, }; PaginatedTable.defaultProps = { @@ -192,6 +194,7 @@ PaginatedTable.defaultProps = { pluralizedItemName: 'Items', showPageSizeOptions: true, renderToolbar: props => , + ouiaId: null, }; export { PaginatedTable as _PaginatedTable }; diff --git a/awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.jsx b/awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.jsx index 312b18f2cf..278566e632 100644 --- a/awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.jsx +++ b/awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.jsx @@ -111,6 +111,7 @@ function ExecutionEnvironmentList({ i18n }) { - {team.name} + {team.name} , From d93ef9f6de9b5bcab6f763421b8a6e75efbd56fb Mon Sep 17 00:00:00 2001 From: Tiago Goes Date: Wed, 17 Mar 2021 14:35:00 -0300 Subject: [PATCH 2/2] add ouiaID --- awx/ui_next/src/components/FormActionGroup/FormActionGroup.jsx | 2 ++ .../ExecutionEnvironmentList/ExecutionEnvironmentListItem.jsx | 1 + 2 files changed, 3 insertions(+) diff --git a/awx/ui_next/src/components/FormActionGroup/FormActionGroup.jsx b/awx/ui_next/src/components/FormActionGroup/FormActionGroup.jsx index 43dc0be9e0..47b64f3ab5 100644 --- a/awx/ui_next/src/components/FormActionGroup/FormActionGroup.jsx +++ b/awx/ui_next/src/components/FormActionGroup/FormActionGroup.jsx @@ -10,6 +10,7 @@ const FormActionGroup = ({ onCancel, onSubmit, submitDisabled, i18n }) => {