Adds elements and identifiers for cypress tests

Properly display instance groups and labels on node details view
This commit is contained in:
mabashian
2022-09-13 14:42:58 -04:00
committed by Alan Rominger
parent d63c940e2f
commit ead56bfa1b
8 changed files with 195 additions and 182 deletions

View File

@@ -132,7 +132,7 @@ function CredentialsStep({
); );
return ( return (
<> <div data-cy="credentials-prompt">
{meta.error && ( {meta.error && (
<CredentialErrorAlert variant="danger" isInline title={meta.error} /> <CredentialErrorAlert variant="danger" isInline title={meta.error} />
)} )}
@@ -208,7 +208,7 @@ function CredentialsStep({
}} }}
renderItemChip={renderChip} renderItemChip={renderChip}
/> />
</> </div>
); );
} }

View File

@@ -66,50 +66,52 @@ function ExecutionEnvironmentStep() {
} }
return ( return (
<OptionsList <div data-cy="execution-environment-prompt">
value={field.value ? [field.value] : []} <OptionsList
options={execution_environments} value={field.value ? [field.value] : []}
optionCount={count} options={execution_environments}
columns={[ optionCount={count}
{ columns={[
name: t`Name`, {
key: 'name', name: t`Name`,
}, key: 'name',
{ },
name: t`Image`, {
key: 'image', name: t`Image`,
}, key: 'image',
]} },
searchColumns={[ ]}
{ searchColumns={[
name: t`Name`, {
key: 'name__icontains', name: t`Name`,
isDefault: true, key: 'name__icontains',
}, isDefault: true,
{ },
name: t`Image`, {
key: 'image__icontains', name: t`Image`,
}, key: 'image__icontains',
]} },
sortColumns={[ ]}
{ sortColumns={[
name: t`Name`, {
key: 'name', name: t`Name`,
}, key: 'name',
{ },
name: t`Image`, {
key: 'image', name: t`Image`,
}, key: 'image',
]} },
searchableKeys={searchableKeys} ]}
relatedSearchableKeys={relatedSearchableKeys} searchableKeys={searchableKeys}
header={t`Execution Environments`} relatedSearchableKeys={relatedSearchableKeys}
name="execution_environment" header={t`Execution Environments`}
qsConfig={QS_CONFIG} name="execution_environment"
readOnly qsConfig={QS_CONFIG}
selectItem={helpers.setValue} readOnly
deselectItem={() => helpers.setValue(null)} selectItem={helpers.setValue}
/> deselectItem={() => helpers.setValue(null)}
/>
</div>
); );
} }

View File

@@ -68,38 +68,40 @@ function InstanceGroupsStep() {
} }
return ( return (
<OptionsList <div data-cy="instance-groups-prompt">
value={selected} <OptionsList
options={instance_groups} value={selected}
optionCount={count} options={instance_groups}
searchColumns={[ optionCount={count}
{ searchColumns={[
name: t`Name`, {
key: 'name__icontains', name: t`Name`,
isDefault: true, key: 'name__icontains',
}, isDefault: true,
{ },
name: t`Credential Name`, {
key: 'credential__name__icontains', name: t`Credential Name`,
}, key: 'credential__name__icontains',
]} },
sortColumns={[ ]}
{ sortColumns={[
name: t`Name`, {
key: 'name', name: t`Name`,
}, key: 'name',
]} },
searchableKeys={searchableKeys} ]}
relatedSearchableKeys={relatedSearchableKeys} searchableKeys={searchableKeys}
multiple relatedSearchableKeys={relatedSearchableKeys}
header={t`Instance Groups`} multiple
name="instanceGroups" header={t`Instance Groups`}
qsConfig={QS_CONFIG} name="instanceGroups"
selectItem={handleSelect} qsConfig={QS_CONFIG}
deselectItem={handleSelect} selectItem={handleSelect}
sortSelectedItems={(selectedItems) => setSelected(selectedItems)} deselectItem={handleSelect}
isSelectedDraggable sortSelectedItems={(selectedItems) => setSelected(selectedItems)}
/> isSelectedDraggable
/>
</div>
); );
} }

View File

@@ -70,7 +70,7 @@ function InventoryStep({ warningMessage = null }) {
} }
return ( return (
<> <div data-cy="inventory-prompt">
{meta.touched && meta.error && ( {meta.touched && meta.error && (
<InventoryErrorAlert variant="danger" isInline title={meta.error} /> <InventoryErrorAlert variant="danger" isInline title={meta.error} />
)} )}
@@ -109,7 +109,7 @@ function InventoryStep({ warningMessage = null }) {
selectItem={helpers.setValue} selectItem={helpers.setValue}
deselectItem={() => field.onChange(null)} deselectItem={() => field.onChange(null)}
/> />
</> </div>
); );
} }

View File

@@ -28,95 +28,97 @@ function OtherPromptsStep({ launchConfig, variablesMode, onVarModeChange }) {
? jobHelpText ? jobHelpText
: workflowHelpText; : workflowHelpText;
return ( return (
<Form <div data-cy="other-prompts">
onSubmit={(e) => { <Form
e.preventDefault(); onSubmit={(e) => {
}} e.preventDefault();
> }}
{launchConfig.ask_job_type_on_launch && ( >
<JobTypeField helpTextSource={helpTextSource} /> {launchConfig.ask_job_type_on_launch && (
)} <JobTypeField helpTextSource={helpTextSource} />
{launchConfig.ask_scm_branch_on_launch && ( )}
<FormField {launchConfig.ask_scm_branch_on_launch && (
id="prompt-scm-branch" <FormField
name="scm_branch" id="prompt-scm-branch"
label={t`Source Control Branch`} name="scm_branch"
tooltip={helpTextSource.sourceControlBranch} label={t`Source Control Branch`}
/> tooltip={helpTextSource.sourceControlBranch}
)} />
{launchConfig.ask_labels_on_launch && ( )}
<LabelsField helpTextSource={helpTextSource} /> {launchConfig.ask_labels_on_launch && (
)} <LabelsField helpTextSource={helpTextSource} />
{launchConfig.ask_forks_on_launch && ( )}
<FormField {launchConfig.ask_forks_on_launch && (
id="prompt-forks" <FormField
name="forks" id="prompt-forks"
label={t`Forks`} name="forks"
type="number" label={t`Forks`}
min="0" type="number"
tooltip={helpTextSource.forks} min="0"
/> tooltip={helpTextSource.forks}
)} />
{launchConfig.ask_limit_on_launch && ( )}
<FormField {launchConfig.ask_limit_on_launch && (
id="prompt-limit" <FormField
name="limit" id="prompt-limit"
label={t`Limit`} name="limit"
tooltip={helpTextSource.limit} label={t`Limit`}
/> tooltip={helpTextSource.limit}
)} />
{launchConfig.ask_verbosity_on_launch && ( )}
<VerbosityField helpTextSource={helpTextSource} /> {launchConfig.ask_verbosity_on_launch && (
)} <VerbosityField helpTextSource={helpTextSource} />
{launchConfig.ask_job_slice_count_on_launch && ( )}
<FormField {launchConfig.ask_job_slice_count_on_launch && (
id="prompt-job-slicing" <FormField
name="job_slice_count" id="prompt-job-slicing"
label={t`Job Slicing`} name="job_slice_count"
type="number" label={t`Job Slicing`}
min="1" type="number"
tooltip={helpTextSource.jobSlicing} min="1"
/> tooltip={helpTextSource.jobSlicing}
)} />
{launchConfig.ask_timeout_on_launch && ( )}
<FormField {launchConfig.ask_timeout_on_launch && (
id="prompt-timeout" <FormField
name="timeout" id="prompt-timeout"
label={t`Timeout`} name="timeout"
type="number" label={t`Timeout`}
min="0" type="number"
tooltip={helpTextSource.timeout} min="0"
/> tooltip={helpTextSource.timeout}
)} />
{launchConfig.ask_diff_mode_on_launch && <ShowChangesToggle />} )}
{launchConfig.ask_tags_on_launch && ( {launchConfig.ask_diff_mode_on_launch && <ShowChangesToggle />}
<TagField {launchConfig.ask_tags_on_launch && (
id="prompt-job-tags" <TagField
name="job_tags" id="prompt-job-tags"
label={t`Job Tags`} name="job_tags"
aria-label={t`Job Tags`} label={t`Job Tags`}
tooltip={helpTextSource.jobTags} aria-label={t`Job Tags`}
/> tooltip={helpTextSource.jobTags}
)} />
{launchConfig.ask_skip_tags_on_launch && ( )}
<TagField {launchConfig.ask_skip_tags_on_launch && (
id="prompt-skip-tags" <TagField
name="skip_tags" id="prompt-skip-tags"
label={t`Skip Tags`} name="skip_tags"
aria-label={t`Skip Tags`} label={t`Skip Tags`}
tooltip={helpTextSource.skipTags} aria-label={t`Skip Tags`}
/> tooltip={helpTextSource.skipTags}
)} />
{launchConfig.ask_variables_on_launch && ( )}
<VariablesField {launchConfig.ask_variables_on_launch && (
id="prompt-variables" <VariablesField
name="extra_vars" id="prompt-variables"
label={t`Variables`} name="extra_vars"
initialMode={variablesMode} label={t`Variables`}
onModeChange={onVarModeChange} initialMode={variablesMode}
/> onModeChange={onVarModeChange}
)} />
</Form> )}
</Form>
</div>
); );
} }

View File

@@ -52,7 +52,7 @@ function PreviewStep({ resource, launchConfig, surveyConfig, formErrors }) {
} }
return ( return (
<> <div data-cy="prompt-preview">
{formErrors && ( {formErrors && (
<ErrorMessageWrapper> <ErrorMessageWrapper>
{t`Some of the previous step(s) have errors`} {t`Some of the previous step(s) have errors`}
@@ -70,7 +70,7 @@ function PreviewStep({ resource, launchConfig, surveyConfig, formErrors }) {
launchConfig={launchConfig} launchConfig={launchConfig}
overrides={overrides} overrides={overrides}
/> />
</> </div>
); );
} }

View File

@@ -31,16 +31,18 @@ function SurveyStep({ surveyConfig }) {
float: NumberField, float: NumberField,
}; };
return ( return (
<Form <div data-cy="survey-prompts">
onSubmit={(e) => { <Form
e.preventDefault(); onSubmit={(e) => {
}} e.preventDefault();
> }}
{surveyConfig.spec.map((question) => { >
const Field = fieldTypes[question.type]; {surveyConfig.spec.map((question) => {
return <Field key={question.variable} question={question} />; const Field = fieldTypes[question.type];
})} return <Field key={question.variable} question={question} />;
</Form> })}
</Form>
</div>
); );
} }
SurveyStep.propTypes = { SurveyStep.propTypes = {

View File

@@ -19,6 +19,8 @@ function NodeViewModal({ readOnly }) {
const { const {
fullUnifiedJobTemplate, fullUnifiedJobTemplate,
originalNodeCredentials, originalNodeCredentials,
originalNodeInstanceGroups,
originalNodeLabels,
originalNodeObject, originalNodeObject,
promptValues, promptValues,
} = nodeToView; } = nodeToView;
@@ -160,7 +162,7 @@ function NodeViewModal({ readOnly }) {
originalNodeObject.summary_fields.execution_environment; originalNodeObject.summary_fields.execution_environment;
} }
if (launchConfig.ask_labels_on_launch) { if (launchConfig.ask_labels_on_launch) {
overrides.labels = originalNodeObject.labels; overrides.labels = originalNodeLabels || [];
} }
if (launchConfig.ask_forks_on_launch) { if (launchConfig.ask_forks_on_launch) {
overrides.forks = originalNodeObject.forks; overrides.forks = originalNodeObject.forks;
@@ -204,6 +206,9 @@ function NodeViewModal({ readOnly }) {
if (launchConfig.ask_credential_on_launch) { if (launchConfig.ask_credential_on_launch) {
overrides.credentials = originalNodeCredentials || []; overrides.credentials = originalNodeCredentials || [];
} }
if (launchConfig.ask_instance_groups_on_launch) {
overrides.instance_groups = originalNodeInstanceGroups || [];
}
} }
let nodeUpdatedConvergence = {}; let nodeUpdatedConvergence = {};