From 052f101a7032cc0aa439d0f3a4492ea001b6b64a Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Fri, 8 Nov 2019 13:14:37 -0500 Subject: [PATCH 1/5] Adds AddDropDownButton removes TemplateDropDown Button Both Inventory List and Template List use the same add button that has a drop down. I decided to make a component that both can use. This also addresses a typo in a InventoryList test. --- .../AddDropDownButton/AddDropDownButton.jsx} | 21 ++--- .../AddDropDownButton.test.jsx} | 10 +-- .../src/components/AddDropDownButton/index.js | 4 + .../Inventory/InventoryList/InventoryList.jsx | 83 ++++--------------- .../InventoryList/InventoryList.test.jsx | 2 +- .../Template/TemplateList/TemplateList.jsx | 24 +++++- 6 files changed, 55 insertions(+), 89 deletions(-) rename awx/ui_next/src/{screens/Template/TemplateList/TemplateAddButton.jsx => components/AddDropDownButton/AddDropDownButton.jsx} (68%) rename awx/ui_next/src/{screens/Template/TemplateList/TemplateAddButton.test.jsx => components/AddDropDownButton/AddDropDownButton.test.jsx} (71%) create mode 100644 awx/ui_next/src/components/AddDropDownButton/index.js diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.jsx b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx similarity index 68% rename from awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.jsx rename to awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx index ff96a0b6c0..bd56d3d1a4 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.jsx +++ b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx @@ -1,11 +1,10 @@ import React, { useState, useRef, useEffect } from 'react'; import { Link, withRouter } from 'react-router-dom'; import { withI18n } from '@lingui/react'; -import { t } from '@lingui/macro'; import { Dropdown, DropdownPosition } from '@patternfly/react-core'; import { ToolbarAddButton } from '@components/PaginatedDataList'; -function TemplateAddButton({ match, i18n }) { +function AddDropDownButton({ topUrl, bottomUrl, topLabel, bottomLabel }) { const [isOpen, setIsOpen] = useState(false); const element = useRef(null); @@ -30,19 +29,15 @@ function TemplateAddButton({ match, i18n }) { position={DropdownPosition.right} toggle={ setIsOpen(!isOpen)} />} dropdownItems={[ - - {i18n._(t`Job Template`)} + + {`${topLabel}`} , - {i18n._(t`Workflow Template`)} + {`${bottomLabel}`} , ]} /> @@ -50,5 +45,5 @@ function TemplateAddButton({ match, i18n }) { ); } -export { TemplateAddButton as _TemplateAddButton }; -export default withI18n()(withRouter(TemplateAddButton)); +export { AddDropDownButton as _AddDropDownButton }; +export default withI18n()(withRouter(AddDropDownButton)); diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.test.jsx b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx similarity index 71% rename from awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.test.jsx rename to awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx index 1a0e75e29e..a6e4c1b1a3 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.test.jsx +++ b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx @@ -1,22 +1,22 @@ import React from 'react'; import { mountWithContexts } from '@testUtils/enzymeHelpers'; -import TemplateAddButton from './TemplateAddButton'; +import AddDropDownButton from './AddDropDownButton'; -describe('', () => { +describe('', () => { test('should be closed initially', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts(); expect(wrapper.find('Dropdown').prop('isOpen')).toEqual(false); }); test('should render two links', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts(); wrapper.find('button').simulate('click'); expect(wrapper.find('Dropdown').prop('isOpen')).toEqual(true); expect(wrapper.find('Link')).toHaveLength(2); }); test('should close when button re-clicked', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts(); wrapper.find('button').simulate('click'); expect(wrapper.find('Dropdown').prop('isOpen')).toEqual(true); wrapper.find('button').simulate('click'); diff --git a/awx/ui_next/src/components/AddDropDownButton/index.js b/awx/ui_next/src/components/AddDropDownButton/index.js new file mode 100644 index 0000000000..1ba2828957 --- /dev/null +++ b/awx/ui_next/src/components/AddDropDownButton/index.js @@ -0,0 +1,4 @@ +export { + default +} +from './AddDropDownButton' diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx index c949b39656..fa8ac6e584 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx @@ -1,15 +1,9 @@ import React, { Component } from 'react'; -import { withRouter, Link } from 'react-router-dom'; +import { withRouter } from 'react-router-dom'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; -import { - Card, - PageSection, - Dropdown, - DropdownItem, - DropdownPosition, -} from '@patternfly/react-core'; +import { Card, PageSection } from '@patternfly/react-core'; import { InventoriesAPI } from '@api'; import AlertModal from '@components/AlertModal'; @@ -17,10 +11,10 @@ import DatalistToolbar from '@components/DataListToolbar'; import ErrorDetail from '@components/ErrorDetail'; import PaginatedDataList, { ToolbarDeleteButton, - ToolbarAddButton, } from '@components/PaginatedDataList'; -import { getQSConfig, parseQueryString } from '@util/qs'; +import { getQSConfig, parseQueryString } from '@util/qs'; +import AddDropDownButton from '@components/AddDropDownButton'; import InventoryListItem from './InventoryListItem'; // The type value in const QS_CONFIG below does not have a space between job_inventory and @@ -65,10 +59,6 @@ class InventoriesList extends Component { } } - componentWillUnmount() { - document.removeEventListener('click', this.handleAddToggle, false); - } - handleDeleteErrorClose() { this.setState({ deletionError: null }); } @@ -90,16 +80,13 @@ class InventoriesList extends Component { handleAddToggle(e) { const { isAddOpen } = this.state; - document.addEventListener('click', this.handleAddToggle, false); if (this.node && this.node.contains(e.target) && isAddOpen) { - document.removeEventListener('click', this.handleAddToggle, false); this.setState({ isAddOpen: false }); } else if (this.node && this.node.contains(e.target) && !isAddOpen) { this.setState({ isAddOpen: true }); } else { this.setState({ isAddOpen: false }); - document.removeEventListener('click', this.handleAddToggle, false); } } @@ -222,33 +209,13 @@ class InventoriesList extends Component { pluralizedItemName="Inventories" />, canAdd && ( -
{ - this.node = node; - }} + - - } - dropdownItems={[ - - - {i18n._(t`Inventory`)} - - , - - - {i18n._(t`Smart Inventory`)} - - , - ]} - /> -
+ topUrl={`${match.url}/inventory/add/`} + bottomdUrl={`${match.url}/smart_inventory/add/`} + topLabel={i18n._(t`Inventory`)} + bottomLabel={i18n._(t`Smart Inventory`)} + /> ), ]} /> @@ -269,31 +236,13 @@ class InventoriesList extends Component { )} emptyStateControls={ canAdd && ( -
{ - this.node = node; - }} + - } - dropdownItems={[ - - - {i18n._(t`Inventory`)} - - , - - - {i18n._(t`Smart Inventory`)} - - , - ]} - /> -
+ topUrl={`${match.url}/inventory/add/`} + bottomUrl={`${match.url}/smart_inventory/add/`} + topLabel={i18n._(t`Inventory`)} + bottomLabel={i18n._(t`Smart Inventory`)} + /> ) } /> diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.test.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.test.jsx index c312f92b7f..796ae9eff1 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.test.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.test.jsx @@ -284,7 +284,7 @@ describe('', () => { done(); }); - test('Add button shown for users without ability to POST', async done => { + test('Add button shown for users with ability to POST', async done => { const wrapper = mountWithContexts(); await waitForElement( wrapper, diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx b/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx index 68e2bb7400..d687cf5de9 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx +++ b/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx @@ -13,8 +13,8 @@ import PaginatedDataList, { } from '@components/PaginatedDataList'; import { getQSConfig, parseQueryString } from '@util/qs'; +import AddDropDownButton from '@components/AddDropDownButton'; import TemplateListItem from './TemplateListItem'; -import TemplateAddButton from './TemplateAddButton'; // The type value in const QS_CONFIG below does not have a space between job_template and // workflow_job_template so the params sent to the API match what the api expects. @@ -206,7 +206,15 @@ class TemplatesList extends Component { itemsToDelete={selected} pluralizedItemName="Templates" />, - canAdd && , + canAdd && ( + + ), ]} /> )} @@ -220,7 +228,17 @@ class TemplatesList extends Component { isSelected={selected.some(row => row.id === template.id)} /> )} - emptyStateControls={canAdd && } + emptyStateControls={ + canAdd && ( + + ) + } /> Date: Fri, 8 Nov 2019 15:47:19 -0500 Subject: [PATCH 2/5] Allows AddDropDownButton components to accept array of dropdownItems --- .../AddDropDownButton/AddDropDownButton.jsx | 22 +++---- .../AddDropDownButton.test.jsx | 21 +++++-- .../src/components/AddDropDownButton/index.js | 5 +- .../Inventory/InventoryList/InventoryList.jsx | 57 +++++++------------ .../Template/TemplateList/TemplateList.jsx | 39 +++++++------ 5 files changed, 66 insertions(+), 78 deletions(-) diff --git a/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx index bd56d3d1a4..9296fc1f17 100644 --- a/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx +++ b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx @@ -1,10 +1,9 @@ import React, { useState, useRef, useEffect } from 'react'; -import { Link, withRouter } from 'react-router-dom'; -import { withI18n } from '@lingui/react'; +import { Link } from 'react-router-dom'; import { Dropdown, DropdownPosition } from '@patternfly/react-core'; import { ToolbarAddButton } from '@components/PaginatedDataList'; -function AddDropDownButton({ topUrl, bottomUrl, topLabel, bottomLabel }) { +function AddDropDownButton({ dropdownItems }) { const [isOpen, setIsOpen] = useState(false); const element = useRef(null); @@ -28,22 +27,19 @@ function AddDropDownButton({ topUrl, bottomUrl, topLabel, bottomLabel }) { isOpen={isOpen} position={DropdownPosition.right} toggle={ setIsOpen(!isOpen)} />} - dropdownItems={[ - - {`${topLabel}`} - , + dropdownItems={dropdownItems.map(item => ( - {`${bottomLabel}`} - , - ]} + {item.label} + + ))} /> ); } export { AddDropDownButton as _AddDropDownButton }; -export default withI18n()(withRouter(AddDropDownButton)); +export default AddDropDownButton; diff --git a/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx index a6e4c1b1a3..a30e3f9cd8 100644 --- a/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx +++ b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.test.jsx @@ -3,20 +3,33 @@ import { mountWithContexts } from '@testUtils/enzymeHelpers'; import AddDropDownButton from './AddDropDownButton'; describe('', () => { + const dropdownItems = [ + { + key: 'inventory', + label: 'Inventory', + url: `inventory/inventory/add/`, + }, + ]; test('should be closed initially', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts( + + ); expect(wrapper.find('Dropdown').prop('isOpen')).toEqual(false); }); test('should render two links', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts( + + ); wrapper.find('button').simulate('click'); expect(wrapper.find('Dropdown').prop('isOpen')).toEqual(true); - expect(wrapper.find('Link')).toHaveLength(2); + expect(wrapper.find('Link')).toHaveLength(dropdownItems.length); }); test('should close when button re-clicked', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts( + + ); wrapper.find('button').simulate('click'); expect(wrapper.find('Dropdown').prop('isOpen')).toEqual(true); wrapper.find('button').simulate('click'); diff --git a/awx/ui_next/src/components/AddDropDownButton/index.js b/awx/ui_next/src/components/AddDropDownButton/index.js index 1ba2828957..8c87c7df31 100644 --- a/awx/ui_next/src/components/AddDropDownButton/index.js +++ b/awx/ui_next/src/components/AddDropDownButton/index.js @@ -1,4 +1 @@ -export { - default -} -from './AddDropDownButton' +export { default } from './AddDropDownButton'; diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx index fa8ac6e584..da87e832b9 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx @@ -36,7 +36,6 @@ class InventoriesList extends Component { selected: [], inventories: [], itemCount: 0, - isAddOpen: false, }; this.loadInventories = this.loadInventories.bind(this); @@ -44,7 +43,6 @@ class InventoriesList extends Component { this.handleSelect = this.handleSelect.bind(this); this.handleInventoryDelete = this.handleInventoryDelete.bind(this); this.handleDeleteErrorClose = this.handleDeleteErrorClose.bind(this); - this.handleAddToggle = this.handleAddToggle.bind(this); } componentDidMount() { @@ -78,18 +76,6 @@ class InventoriesList extends Component { } } - handleAddToggle(e) { - const { isAddOpen } = this.state; - - if (this.node && this.node.contains(e.target) && isAddOpen) { - this.setState({ isAddOpen: false }); - } else if (this.node && this.node.contains(e.target) && !isAddOpen) { - this.setState({ isAddOpen: true }); - } else { - this.setState({ isAddOpen: false }); - } - } - async handleInventoryDelete() { const { selected, itemCount } = this.state; @@ -155,14 +141,29 @@ class InventoriesList extends Component { inventories, itemCount, selected, - isAddOpen, actions, } = this.state; const { match, i18n } = this.props; const canAdd = actions && Object.prototype.hasOwnProperty.call(actions, 'POST'); - const isAllSelected = - selected.length > 0 && selected.length === inventories.length; + const isAllSelected = selected.length === inventories.length; + const addButton = ( + + ); return ( @@ -208,15 +209,7 @@ class InventoriesList extends Component { itemsToDelete={selected} pluralizedItemName="Inventories" />, - canAdd && ( - - ), + canAdd && addButton, ]} /> )} @@ -234,17 +227,7 @@ class InventoriesList extends Component { isSelected={selected.some(row => row.id === inventory.id)} /> )} - emptyStateControls={ - canAdd && ( - - ) - } + emptyStateControls={canAdd && addButton} /> 0; + const addButton = ( + + ); return ( @@ -206,15 +223,7 @@ class TemplatesList extends Component { itemsToDelete={selected} pluralizedItemName="Templates" />, - canAdd && ( - - ), + canAdd && addButton, ]} /> )} @@ -228,17 +237,7 @@ class TemplatesList extends Component { isSelected={selected.some(row => row.id === template.id)} /> )} - emptyStateControls={ - canAdd && ( - - ) - } + emptyStateControls={canAdd && addButton} /> Date: Mon, 11 Nov 2019 14:00:06 -0500 Subject: [PATCH 3/5] Adds Proptypes to AddDropDownButton Component Also refactors to use the url that is passed in as the key for the link. This means that we don't have to pass in a key value. --- .../AddDropDownButton/AddDropDownButton.jsx | 12 +++++++++++- .../Inventory/InventoryList/InventoryList.jsx | 2 -- .../screens/Template/TemplateList/TemplateList.jsx | 2 -- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx index 9296fc1f17..288a30733f 100644 --- a/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx +++ b/awx/ui_next/src/components/AddDropDownButton/AddDropDownButton.jsx @@ -1,5 +1,6 @@ import React, { useState, useRef, useEffect } from 'react'; import { Link } from 'react-router-dom'; +import PropTypes from 'prop-types'; import { Dropdown, DropdownPosition } from '@patternfly/react-core'; import { ToolbarAddButton } from '@components/PaginatedDataList'; @@ -30,7 +31,7 @@ function AddDropDownButton({ dropdownItems }) { dropdownItems={dropdownItems.map(item => ( {item.label} @@ -41,5 +42,14 @@ function AddDropDownButton({ dropdownItems }) { ); } +AddDropDownButton.propTypes = { + dropdownItems: PropTypes.arrayOf( + PropTypes.shape({ + label: PropTypes.string.isRequired, + url: PropTypes.string.isRequired, + }) + ).isRequired, +}; + export { AddDropDownButton as _AddDropDownButton }; export default AddDropDownButton; diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx index da87e832b9..59e63a9b35 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryList.jsx @@ -152,12 +152,10 @@ class InventoriesList extends Component { key="add" dropdownItems={[ { - key: 'inventory', label: i18n._(t`Inventory`), url: `${match.url}/inventory/add/`, }, { - key: 'smart-inventory', label: i18n._(t`Smart Inventory`), url: `${match.url}/smart_inventory/add/`, }, diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx b/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx index 8e04c480f5..7a087f88fe 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx +++ b/awx/ui_next/src/screens/Template/TemplateList/TemplateList.jsx @@ -166,12 +166,10 @@ class TemplatesList extends Component { key="add" dropdownItems={[ { - key: 'template', label: i18n._(t`Template`), url: `${match.url}/template/add/`, }, { - key: 'workflow_template', label: i18n._(t`Workflow Template`), url: `${match.url}/_workflow/add/`, }, From e3ee3c5a001d47c8316e9579a3b84909051ac0f3 Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Tue, 12 Nov 2019 10:16:25 -0500 Subject: [PATCH 4/5] Fixes failing tests --- .../Project/shared/ProjectForm.test.jsx | 2 +- .../JobTemplateEdit/JobTemplateEdit.test.jsx | 29 ++++++++++++------- .../Template/shared/JobTemplateForm.test.jsx | 14 +++++---- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx b/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx index bfb4817941..584287444e 100644 --- a/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx +++ b/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx @@ -26,7 +26,7 @@ describe('', () => { id: 100, credential_type_id: 4, kind: 'scm', - name: 'alpha', + name: 'Foo', }, }, }; diff --git a/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx b/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx index eb9a049e41..fb8f1435a8 100644 --- a/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx +++ b/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx @@ -200,17 +200,22 @@ describe('', () => { data: { ...updatedTemplateData }, }); const formik = wrapper.find('Formik').instance(); - const changeState = new Promise(resolve => { - const values = { - ...mockJobTemplate, - ...updatedTemplateData, - labels, - instanceGroups: [], - }; - formik.setState({ values }, () => resolve()); - }); + const changeState = await act( + () => + new Promise(resolve => { + const values = { + ...mockJobTemplate, + ...updatedTemplateData, + labels, + instanceGroups: [], + }; + formik.setState({ values }, () => resolve()); + }) + ); await changeState; - wrapper.find('button[aria-label="Save"]').simulate('click'); + await act(async () => { + wrapper.find('button[aria-label="Save"]').simulate('click'); + }); await sleep(0); expect(JobTemplatesAPI.update).toHaveBeenCalledWith(1, { @@ -236,7 +241,9 @@ describe('', () => { 'button[aria-label="Cancel"]', e => e.length === 1 ); - cancelButton.prop('onClick')(); + await act(async () => { + cancelButton.prop('onClick')(); + }); expect(history.location.pathname).toEqual( '/templates/job_template/1/details' ); diff --git a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx index 62e6607be4..aa16a8a736 100644 --- a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx +++ b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx @@ -157,10 +157,12 @@ describe('', () => { target: { value: 'new baz type', name: 'playbook' }, }); expect(form.state('values').playbook).toEqual('new baz type'); - wrapper - .find('CredentialChip') - .at(0) - .prop('onClick')(); + await act(async () => { + wrapper + .find('CredentialChip') + .at(0) + .prop('onClick')(); + }); expect(form.state('values').credentials).toEqual([ { id: 2, kind: 'ssh', name: 'Bar' }, ]); @@ -180,7 +182,9 @@ describe('', () => { }); await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0); expect(handleSubmit).not.toHaveBeenCalled(); - wrapper.find('button[aria-label="Save"]').simulate('click'); + await act(async () => { + wrapper.find('button[aria-label="Save"]').simulate('click'); + }); await sleep(1); expect(handleSubmit).toBeCalled(); }); From 068dab14d47a1e18d9fee51f9203a3a4bb8d3a57 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 12 Nov 2019 12:35:36 -0500 Subject: [PATCH 5/5] Increase async test timeout When our CI system is overloaded, tests start running slower. --- awx/ui_next/jest.setup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awx/ui_next/jest.setup.js b/awx/ui_next/jest.setup.js index 62cb566c00..6dd8eff3bc 100644 --- a/awx/ui_next/jest.setup.js +++ b/awx/ui_next/jest.setup.js @@ -6,4 +6,6 @@ export const asyncFlush = () => new Promise((resolve) => setImmediate(resolve)); const enzyme = require('enzyme'); const Adapter = require('enzyme-adapter-react-16'); +jest.setTimeout(5000 * 4); + enzyme.configure({ adapter: new Adapter() });