diff --git a/src/components/clusterDetail/ClusterCredentials.tsx b/src/components/clusterDetail/ClusterCredentials.tsx index 4cb0137aba..fd0a91bbb3 100644 --- a/src/components/clusterDetail/ClusterCredentials.tsx +++ b/src/components/clusterDetail/ClusterCredentials.tsx @@ -11,6 +11,7 @@ type ClusterCredentialsProps = { error: boolean; retry: () => void; credentials?: Credentials; + idPrefix?: string; }; const ClusterCredentials: React.FC = ({ @@ -18,6 +19,7 @@ const ClusterCredentials: React.FC = ({ credentials, error, retry, + idPrefix = 'cluster-creds', }) => { let credentialsBody: JSX.Element; if (error) { @@ -37,6 +39,7 @@ const ClusterCredentials: React.FC = ({ iconPosition="right" isInline onClick={() => window.open(credentials.consoleUrl, '_blank', 'noopener')} + id={`${idPrefix}-link-console-url`} > {credentials.consoleUrl} @@ -44,6 +47,7 @@ const ClusterCredentials: React.FC = ({ } diff --git a/src/components/clusterDetail/ClusterDetail.tsx b/src/components/clusterDetail/ClusterDetail.tsx index af7164a04b..f09d628b01 100644 --- a/src/components/clusterDetail/ClusterDetail.tsx +++ b/src/components/clusterDetail/ClusterDetail.tsx @@ -56,6 +56,8 @@ type ClusterDetailProps = { setResetClusterModalOpen: (isOpen: boolean) => void; }; +const getID = (suffix: string) => `cluster-detail-${suffix}`; + const ClusterDetail: React.FC = ({ cluster, setCancelInstallationModalOpen, @@ -119,9 +121,14 @@ const ClusterDetail: React.FC = ({ credentials={credentials} error={!!credentialsError} retry={fetchCredentials} + idPrefix={getID('cluster-creds')} /> )} - + Bare Metal Inventory @@ -142,7 +149,10 @@ const ClusterDetail: React.FC = ({ )} {cluster.status === 'error' && ( - setResetClusterModalOpen(true)}> + setResetClusterModalOpen(true)} + > Reset Cluster )} @@ -151,12 +161,14 @@ const ClusterDetail: React.FC = ({ isDisabled={!credentials || !!credentialsError} cluster={cluster} consoleUrl={credentials?.consoleUrl} + id={getID('button-launch-console')} /> )} } isHidden={isSingleClusterMode()} + id={getID('button-back-to-all-clusters')} > Back to all clusters diff --git a/src/components/clusterDetail/ClusterInstallationError.tsx b/src/components/clusterDetail/ClusterInstallationError.tsx index 59d4045ff9..14e551a368 100644 --- a/src/components/clusterDetail/ClusterInstallationError.tsx +++ b/src/components/clusterDetail/ClusterInstallationError.tsx @@ -19,6 +19,9 @@ type ClusterInstallationErrorProps = { title?: string; setResetClusterModalOpen: (isOpen: boolean) => void; }; + +const getID = (suffix: string) => `cluster-install-error-${suffix}`; + const ClusterInstallationError: React.FC = ({ cluster, title = 'Cluster installation failed', @@ -33,17 +36,22 @@ const ClusterInstallationError: React.FC = ({ title={title} actionLinks={ <> - setResetClusterModalOpen(true)}> + setResetClusterModalOpen(true)} + id={getID('button-reset-cluster')} + > Reset Cluster downloadClusterInstallationLogs(addAlert, cluster.id)} isDisabled={!canDownloadClusterLogs(cluster)} + id={getID('button-download-installation-logs')} > Download Installation Logs window.open(getBugzillaLink(cluster.openshiftVersion), '_blank')} + id={getID('button-report-bug')} > Report a bug diff --git a/src/components/clusterDetail/ConsoleModal.tsx b/src/components/clusterDetail/ConsoleModal.tsx index bafda17638..b19bd6e37d 100644 --- a/src/components/clusterDetail/ConsoleModal.tsx +++ b/src/components/clusterDetail/ConsoleModal.tsx @@ -17,10 +17,12 @@ import { InfoCircleIcon } from '@patternfly/react-icons'; type WebConsoleHintProps = { cluster: Cluster; consoleUrl?: string; + idPrefix?: string; }; type LaunchOpenshiftConsoleButtonProps = WebConsoleHintProps & { isDisabled: boolean; + id?: string; }; type ConsoleModalProps = WebConsoleHintProps & { @@ -68,6 +70,7 @@ export const LaunchOpenshiftConsoleButton: React.FC { const [isOpen, setOpen] = React.useState(false); @@ -78,6 +81,7 @@ export const LaunchOpenshiftConsoleButton: React.FC setOpen(true)} + id={id} > Launch OpenShift Console @@ -94,6 +98,7 @@ export const LaunchOpenshiftConsoleButton: React.FC = ({ cluster, consoleUrl, + idPrefix, }) => { const [isOpen, setOpen] = React.useState(false); @@ -105,6 +110,7 @@ export const TroubleshootingOpenshiftConsoleButton: React.FC setOpen(true)} + id={`${idPrefix}-troubleshooting-hint-open`} > Not able to access the Web Console? diff --git a/src/components/clusterDetail/KubeconfigDownload.tsx b/src/components/clusterDetail/KubeconfigDownload.tsx index f1472edbb5..5e184475c0 100644 --- a/src/components/clusterDetail/KubeconfigDownload.tsx +++ b/src/components/clusterDetail/KubeconfigDownload.tsx @@ -10,9 +10,10 @@ import { getErrorMessage, handleApiError, ocmClient } from '../../api'; type KubeconfigDownloadProps = { clusterId: Cluster['id']; status: Cluster['status']; + id?: string; }; -const KubeconfigDownload: React.FC = ({ clusterId, status }) => { +const KubeconfigDownload: React.FC = ({ clusterId, status, id }) => { const { addAlert } = React.useContext(AlertsContext); const download = React.useCallback( @@ -49,6 +50,7 @@ const KubeconfigDownload: React.FC = ({ clusterId, stat variant={ButtonVariant.secondary} onClick={() => download(clusterId, status)} isDisabled={!canDownloadKubeconfig(status)} + id={id} > Download kubeconfig