mirror of
https://github.com/ansible/awx.git
synced 2026-01-27 16:41:29 -03:30
Merge pull request #7738 from mabashian/test-console-cleanup
Test console cleanup Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
162aab7272
@ -208,8 +208,10 @@ describe('<CredentialForm />', () => {
|
||||
});
|
||||
wrapper.update();
|
||||
expect(
|
||||
wrapper.find('FormGroup[fieldId="credential-gce-file"]').prop('isValid')
|
||||
).toBe(false);
|
||||
wrapper
|
||||
.find('FormGroup[fieldId="credential-gce-file"]')
|
||||
.prop('validated')
|
||||
).toBe('error');
|
||||
|
||||
expect(
|
||||
wrapper
|
||||
|
||||
@ -41,7 +41,7 @@ function BecomeMethodField({ fieldOptions, isRequired }) {
|
||||
)
|
||||
}
|
||||
isRequired={isRequired}
|
||||
isValid={!(meta.touched && meta.error)}
|
||||
validated={!(meta.touched && meta.error) ? 'default' : 'error'}
|
||||
>
|
||||
<Select
|
||||
maxHeight={200}
|
||||
|
||||
@ -29,7 +29,7 @@ function CredentialInput({ fieldOptions, credentialKind, ...rest }) {
|
||||
onChange={(value, event) => {
|
||||
subFormField.onChange(event);
|
||||
}}
|
||||
isValid={isValid}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -38,7 +38,6 @@ function CredentialInput({ fieldOptions, credentialKind, ...rest }) {
|
||||
<PasswordInput
|
||||
{...subFormField}
|
||||
id={`credential-${fieldOptions.id}`}
|
||||
isValid={isValid}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
@ -55,7 +54,7 @@ function CredentialInput({ fieldOptions, credentialKind, ...rest }) {
|
||||
onChange={(value, event) => {
|
||||
subFormField.onChange(event);
|
||||
}}
|
||||
isValid={isValid}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -107,7 +106,7 @@ function CredentialField({ credentialType, fieldOptions, i18n }) {
|
||||
helperTextInvalid={meta.error}
|
||||
label={fieldOptions.label}
|
||||
isRequired={isRequired}
|
||||
isValid={isValid}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
>
|
||||
<AnsibleSelect
|
||||
{...subFormField}
|
||||
@ -132,7 +131,7 @@ function CredentialField({ credentialType, fieldOptions, i18n }) {
|
||||
)
|
||||
}
|
||||
isRequired={isRequired}
|
||||
isValid={isValid}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
>
|
||||
<CredentialInput
|
||||
credentialKind={credentialType.kind}
|
||||
@ -150,7 +149,7 @@ function CredentialField({ credentialType, fieldOptions, i18n }) {
|
||||
<CredentialPluginField
|
||||
fieldOptions={fieldOptions}
|
||||
isRequired={isRequired}
|
||||
isValid={isValid}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
>
|
||||
<CredentialInput fieldOptions={fieldOptions} />
|
||||
</CredentialPluginField>
|
||||
|
||||
@ -43,7 +43,7 @@ function CredentialPluginInput(props) {
|
||||
{React.cloneElement(children, {
|
||||
...inputField,
|
||||
isRequired,
|
||||
isValid,
|
||||
validated: isValid ? 'default' : 'error',
|
||||
isDisabled: !!passwordPromptField.value,
|
||||
onChange: (_, event) => {
|
||||
inputField.onChange(event);
|
||||
@ -125,7 +125,7 @@ function CredentialPluginField(props) {
|
||||
fieldId={`credential-${fieldOptions.id}`}
|
||||
helperTextInvalid={meta.error}
|
||||
isRequired={isRequired}
|
||||
isValid={isValid}
|
||||
validated={isValid ? 'default' : 'error'}
|
||||
label={fieldOptions.label}
|
||||
labelIcon={
|
||||
fieldOptions.help_text && (
|
||||
|
||||
@ -20,7 +20,7 @@ function GceFileUploadField({ i18n }) {
|
||||
return (
|
||||
<FormGroup
|
||||
fieldId="credential-gce-file"
|
||||
isValid={!fileError}
|
||||
validated={!fileError ? 'default' : 'error'}
|
||||
label={i18n._(t`Service account JSON file`)}
|
||||
helperText={i18n._(
|
||||
t`Select a JSON formatted service account key to autopopulate the following fields.`
|
||||
|
||||
@ -51,11 +51,13 @@ describe('<InventoryAdd />', () => {
|
||||
];
|
||||
await waitForElement(wrapper, 'isLoading', el => el.length === 0);
|
||||
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'new Foo',
|
||||
organization: { id: 2 },
|
||||
insights_credential: { id: 47 },
|
||||
instanceGroups,
|
||||
await act(async () => {
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'new Foo',
|
||||
organization: { id: 2 },
|
||||
insights_credential: { id: 47 },
|
||||
instanceGroups,
|
||||
});
|
||||
});
|
||||
await sleep(1);
|
||||
expect(InventoriesAPI.create).toHaveBeenCalledWith({
|
||||
@ -74,7 +76,9 @@ describe('<InventoryAdd />', () => {
|
||||
|
||||
test('handleCancel should return the user back to the inventories list', async () => {
|
||||
await waitForElement(wrapper, 'isLoading', el => el.length === 0);
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
await act(async () => {
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
});
|
||||
expect(history.location.pathname).toEqual('/inventories');
|
||||
});
|
||||
});
|
||||
|
||||
@ -102,7 +102,9 @@ describe('<InventoryEdit />', () => {
|
||||
|
||||
test('handleCancel returns the user to inventory detail', async () => {
|
||||
await waitForElement(wrapper, 'isLoading', el => el.length === 0);
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
await act(async () => {
|
||||
wrapper.find('Button[aria-label="Cancel"]').simulate('click');
|
||||
});
|
||||
expect(history.location.pathname).toEqual(
|
||||
'/inventories/inventory/1/details'
|
||||
);
|
||||
@ -114,12 +116,14 @@ describe('<InventoryEdit />', () => {
|
||||
{ name: 'Bizz', id: 2 },
|
||||
{ name: 'Buzz', id: 3 },
|
||||
];
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'Foo',
|
||||
id: 13,
|
||||
organization: { id: 1 },
|
||||
insights_credential: { id: 13 },
|
||||
instanceGroups,
|
||||
await act(async () => {
|
||||
wrapper.find('InventoryForm').prop('onSubmit')({
|
||||
name: 'Foo',
|
||||
id: 13,
|
||||
organization: { id: 1 },
|
||||
insights_credential: { id: 13 },
|
||||
instanceGroups,
|
||||
});
|
||||
});
|
||||
await sleep(0);
|
||||
instanceGroups.map(IG =>
|
||||
|
||||
@ -241,7 +241,9 @@ describe('<JobTemplateAdd />', () => {
|
||||
});
|
||||
});
|
||||
await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0);
|
||||
wrapper.find('button[aria-label="Cancel"]').invoke('onClick')();
|
||||
await act(async () => {
|
||||
wrapper.find('button[aria-label="Cancel"]').invoke('onClick')();
|
||||
});
|
||||
expect(history.location.pathname).toEqual('/templates');
|
||||
});
|
||||
});
|
||||
|
||||
@ -131,7 +131,9 @@ function WorkflowJobTemplateForm({
|
||||
<TextInput
|
||||
id="text-wfjt-limit"
|
||||
{...limitField}
|
||||
isValid={!limitMeta.touched || !limitMeta.error}
|
||||
validated={
|
||||
!limitMeta.touched || !limitMeta.error ? 'default' : 'error'
|
||||
}
|
||||
onChange={value => {
|
||||
limitHelpers.setValue(value);
|
||||
}}
|
||||
|
||||
@ -12,3 +12,10 @@ require('@nteract/mockument');
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const asyncFlush = () => new Promise(resolve => setImmediate(resolve));
|
||||
|
||||
// this ensures that debug messages don't get logged out to the console
|
||||
// while tests are running i.e. websocket connect/disconnect
|
||||
global.console = {
|
||||
...console,
|
||||
debug: jest.fn(),
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user