tests(register-component): update tests to use test-id for submit button

This commit is contained in:
Adam Shurson
2020-09-21 13:46:13 -05:00
parent b746ef2f37
commit 67aa7e8176
2 changed files with 7 additions and 2 deletions
@@ -41,7 +41,9 @@ describe('RegisterComponentForm', () => {
),
).toBeInTheDocument();
const submit = (await rendered.getByRole('button')) as HTMLButtonElement;
const submit = (await rendered.getByTestId(
'registerComponentFormSubmit',
)) as HTMLButtonElement;
expect(submit.disabled).toBeTruthy();
});
@@ -54,7 +56,9 @@ describe('RegisterComponentForm', () => {
target: { value: 'https://example.com/blob/master/component.yaml' },
});
});
const submit = (await rendered.getByRole('button')) as HTMLButtonElement;
const submit = (await rendered.getByTestId(
'registerComponentFormSubmit',
)) as HTMLButtonElement;
expect(submit.disabled).toBeFalsy();
});
@@ -113,6 +113,7 @@ const RegisterComponentForm: FC<Props> = ({ onSubmit, submitting }) => {
</FormControl>
<Button
id="registerComponentFormSubmit"
data-testid="registerComponentFormSubmit"
variant="contained"
color="primary"
type="submit"