diff --git a/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/AnalyticsStep.jsx b/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/AnalyticsStep.jsx
index b33c38fd38..ca7f030184 100644
--- a/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/AnalyticsStep.jsx
+++ b/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/AnalyticsStep.jsx
@@ -3,6 +3,7 @@ import { withI18n } from '@lingui/react';
import { Trans, t } from '@lingui/macro';
import { useField } from 'formik';
import { Button, Flex, FormGroup } from '@patternfly/react-core';
+import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { required } from '../../../../util/validators';
import FormField, {
CheckboxField,
@@ -49,7 +50,9 @@ function AnalyticsStep({ i18n }) {
more information, see{' '}
', () => {
@@ -157,8 +158,9 @@ describe('', () => {
});
test('clicking next button should show analytics step', async () => {
+ wrapper.update();
await act(async () => {
- wrapper.find('Button[children="Next"]').simulate('click');
+ wrapper.find('button#subscription-wizard-next').simulate('click');
});
wrapper.update();
expect(wrapper.find('AnalyticsStep').length).toBe(1);
@@ -185,27 +187,27 @@ describe('', () => {
test('clicking next button should show eula step', async () => {
await act(async () => {
- wrapper.find('Button[children="Next"]').simulate('click');
+ wrapper.find('button#subscription-wizard-next').simulate('click');
});
wrapper.update();
expect(wrapper.find('EulaStep').length).toBe(1);
expect(wrapper.find('CheckboxField').length).toBe(1);
- expect(wrapper.find('Button[children="Submit"]').length).toBe(1);
+ expect(wrapper.find('button#subscription-wizard-submit').length).toBe(1);
});
test('checking EULA agreement should enable Submit button', async () => {
- expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
- true
- );
+ expect(
+ wrapper.find('button#subscription-wizard-submit').prop('disabled')
+ ).toBe(true);
await act(async () => {
wrapper.find('Checkbox[name="eula"] input').simulate('change', {
target: { value: true, name: 'eula' },
});
});
wrapper.update();
- expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
- false
- );
+ expect(
+ wrapper.find('button#subscription-wizard-submit').prop('disabled')
+ ).toBe(false);
});
test('should successfully save on form submission', async () => {
@@ -271,6 +273,7 @@ describe('', () => {
context: {
config: {
mockConfig,
+ setConfig: jest.fn(),
},
me: {
is_superuser: true,
@@ -370,7 +373,7 @@ describe('', () => {
});
test('next should skip analytics step and navigate to eula step', async () => {
await act(async () => {
- wrapper.find('Button[children="Next"]').simulate('click');
+ wrapper.find('button#subscription-wizard-next').simulate('click');
});
wrapper.update();
expect(wrapper.find('SubscriptionStep').length).toBe(0);
@@ -379,18 +382,18 @@ describe('', () => {
});
test('submit should be disabled until EULA agreement checked', async () => {
- expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
- true
- );
+ expect(
+ wrapper.find('button#subscription-wizard-submit').prop('disabled')
+ ).toBe(true);
await act(async () => {
wrapper.find('Checkbox[name="eula"] input').simulate('change', {
target: { value: true, name: 'eula' },
});
});
wrapper.update();
- expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
- false
- );
+ expect(
+ wrapper.find('button#subscription-wizard-submit').prop('disabled')
+ ).toBe(false);
});
test('should successfully send request to api on form submission', async () => {
@@ -420,7 +423,7 @@ describe('', () => {
el => el.length === 0
);
await act(async () =>
- wrapper.find('Button[children="Submit"]').prop('onClick')()
+ wrapper.find('button#subscription-wizard-submit').prop('onClick')()
);
wrapper.update();
waitForElement(wrapper, 'Alert[title="Save successful"]');
@@ -441,7 +444,7 @@ describe('', () => {
});
});
- test.only('should throw a content error', async () => {
+ test('should throw a content error', async () => {
RootAPI.readAssetVariables.mockRejectedValueOnce(new Error());
let wrapper;
await act(async () => {
diff --git a/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/SubscriptionStep.jsx b/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/SubscriptionStep.jsx
index 48aa5b15b4..d102681acb 100644
--- a/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/SubscriptionStep.jsx
+++ b/awx/ui_next/src/screens/Setting/Subscription/SubscriptionEdit/SubscriptionStep.jsx
@@ -16,6 +16,7 @@ import {
Tooltip,
} from '@patternfly/react-core';
import { useConfig } from '../../../../contexts/Config';
+import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import useModal from '../../../../util/useModal';
import FormField, { PasswordField } from '../../../../components/FormField';
import Popover from '../../../../components/Popover';
@@ -150,7 +151,9 @@ function SubscriptionStep({ i18n }) {
. For more information, see the{' '}