V2Wizard: Uncomment relevant GCP tests and add data-testids
The tests have not been modified at this point, only uncommented, so the next commit will have a clear diff. Some data-testids were added to radio selectors and the Google principle input as well for use in the tests.
This commit is contained in:
parent
5a3726a4c8
commit
698037a7dc
2 changed files with 81 additions and 74 deletions
|
|
@ -40,9 +40,10 @@ const Gcp = () => {
|
|||
</Text>
|
||||
<FormGroup label="Select image sharing" isRequired>
|
||||
<Radio
|
||||
id="radio-with-description"
|
||||
id="share-with-google"
|
||||
data-testid="share-with-google"
|
||||
label="Share image with a Google acount"
|
||||
name="radio-7"
|
||||
name="radio-1"
|
||||
description={
|
||||
<Text>
|
||||
Your image will be uploaded to GCP and shared with the account you
|
||||
|
|
@ -57,9 +58,10 @@ const Gcp = () => {
|
|||
}}
|
||||
/>
|
||||
<Radio
|
||||
id="radio"
|
||||
id="share-with-insights"
|
||||
data-testid="share-with-insights"
|
||||
label="Share image with Red Hat Insights only"
|
||||
name="radio-8"
|
||||
name="radio-2"
|
||||
description={
|
||||
<Text>
|
||||
Your image will be uploaded to GCP and shared with Red Hat
|
||||
|
|
@ -78,36 +80,40 @@ const Gcp = () => {
|
|||
<>
|
||||
<FormGroup label="Account type" isRequired>
|
||||
<Radio
|
||||
id="google"
|
||||
id="google-account"
|
||||
data-testid="google-account"
|
||||
label="Google account"
|
||||
name="radio-9"
|
||||
name="radio-3"
|
||||
isChecked={accountType === 'google'}
|
||||
onChange={() => {
|
||||
dispatch(changeGcpAccountType('google'));
|
||||
}}
|
||||
/>
|
||||
<Radio
|
||||
id="service"
|
||||
id="service-account"
|
||||
data-testid="service-account"
|
||||
label="Service account"
|
||||
name="radio-10"
|
||||
name="radio-4"
|
||||
isChecked={accountType === 'service'}
|
||||
onChange={() => {
|
||||
dispatch(changeGcpAccountType('service'));
|
||||
}}
|
||||
/>
|
||||
<Radio
|
||||
id="group"
|
||||
id="google-group"
|
||||
data-testid="google-group"
|
||||
label="Google group"
|
||||
name="radio-11"
|
||||
name="radio-5"
|
||||
isChecked={accountType === 'group'}
|
||||
onChange={() => {
|
||||
dispatch(changeGcpAccountType('group'));
|
||||
}}
|
||||
/>
|
||||
<Radio
|
||||
id="domain"
|
||||
id="google-domain"
|
||||
data-testid="google-domain"
|
||||
label="Google Workspace domain or Cloud Identity domain"
|
||||
name="radio-12"
|
||||
name="radio-6"
|
||||
isChecked={accountType === 'domain'}
|
||||
onChange={() => {
|
||||
dispatch(changeGcpAccountType('domain'));
|
||||
|
|
@ -123,7 +129,8 @@ const Gcp = () => {
|
|||
isRequired
|
||||
>
|
||||
<ValidatedTextInput
|
||||
ariaLabel="principal"
|
||||
ariaLabel="google principal"
|
||||
data-testid="principal"
|
||||
value={gcpEmail || ''}
|
||||
validator={isGcpEmailValid}
|
||||
onChange={(_event, value) => dispatch(changeGcpEmail(value))}
|
||||
|
|
|
|||
|
|
@ -434,86 +434,86 @@ describe('Step Upload to AWS', () => {
|
|||
// }, 10000);
|
||||
});
|
||||
|
||||
// describe('Step Upload to Google', () => {
|
||||
// const user = userEvent.setup();
|
||||
// const setUp = async () => {
|
||||
// ({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
// 'imagewizard',
|
||||
// {},
|
||||
// routes
|
||||
// ));
|
||||
describe('Step Upload to Google', () => {
|
||||
const user = userEvent.setup();
|
||||
const setUp = async () => {
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
));
|
||||
|
||||
// // select gcp as upload destination
|
||||
// await waitFor(
|
||||
// async () => await user.click(await screen.findByTestId('upload-google'))
|
||||
// );
|
||||
// select gcp as upload destination
|
||||
await waitFor(
|
||||
async () => await user.click(await screen.findByTestId('upload-google'))
|
||||
);
|
||||
|
||||
// await clickNext();
|
||||
await clickNext();
|
||||
|
||||
// await screen.findByRole('heading', {
|
||||
// name: 'Target environment - Google Cloud Platform',
|
||||
// });
|
||||
// };
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Target environment - Google Cloud Platform',
|
||||
});
|
||||
};
|
||||
|
||||
// test('clicking Next loads Registration', async () => {
|
||||
// await setUp();
|
||||
test('clicking Next loads Registration', async () => {
|
||||
await setUp();
|
||||
|
||||
// const shareRadioButton = await screen.findByRole('radio', {
|
||||
// name: /share image with a google account/i,
|
||||
// });
|
||||
// await user.click(shareRadioButton);
|
||||
const shareRadioButton = await screen.findByRole('radio', {
|
||||
name: /share image with a google account/i,
|
||||
});
|
||||
await user.click(shareRadioButton);
|
||||
|
||||
// const googleEmailInput = await screen.findByTestId('input-google-email');
|
||||
const googleEmailInput = await screen.findByTestId('input-google-email');
|
||||
|
||||
// await user.type(googleEmailInput, 'test@test.com');
|
||||
// await clickNext();
|
||||
await user.type(googleEmailInput, 'test@test.com');
|
||||
await clickNext();
|
||||
|
||||
// await screen.findByRole('textbox', {
|
||||
// name: 'Select activation key',
|
||||
// });
|
||||
await screen.findByRole('textbox', {
|
||||
name: 'Select activation key',
|
||||
});
|
||||
|
||||
// screen.getByText('Automatically register and enable advanced capabilities');
|
||||
// });
|
||||
screen.getByText('Automatically register and enable advanced capabilities');
|
||||
});
|
||||
|
||||
// test('clicking Back loads Release', async () => {
|
||||
// await setUp();
|
||||
test('clicking Back loads Release', async () => {
|
||||
await setUp();
|
||||
|
||||
// await clickBack();
|
||||
await clickBack();
|
||||
|
||||
// screen.getByTestId('upload-google');
|
||||
// });
|
||||
screen.getByTestId('upload-google');
|
||||
});
|
||||
|
||||
// test('clicking Cancel loads landing page', async () => {
|
||||
// await setUp();
|
||||
test('clicking Cancel loads landing page', async () => {
|
||||
await setUp();
|
||||
|
||||
// await verifyCancelButton(router);
|
||||
// });
|
||||
await verifyCancelButton(router);
|
||||
});
|
||||
|
||||
// test('the google account id field is shown and required', async () => {
|
||||
// await setUp();
|
||||
test('the google account id field is shown and required', async () => {
|
||||
await setUp();
|
||||
|
||||
// await waitFor(() => {
|
||||
// screen.getByTestId('account-sharing');
|
||||
// });
|
||||
await waitFor(() => {
|
||||
screen.getByTestId('account-sharing');
|
||||
});
|
||||
|
||||
// await user.click(screen.getByTestId('account-sharing'));
|
||||
// const accessKeyId = await screen.findByTestId('input-google-email');
|
||||
// expect(accessKeyId).toHaveValue('');
|
||||
// expect(accessKeyId).toBeEnabled();
|
||||
// });
|
||||
await user.click(screen.getByTestId('account-sharing'));
|
||||
const accessKeyId = await screen.findByTestId('input-google-email');
|
||||
expect(accessKeyId).toHaveValue('');
|
||||
expect(accessKeyId).toBeEnabled();
|
||||
});
|
||||
|
||||
// test('the google email field must be a valid email', async () => {
|
||||
// await setUp();
|
||||
test('the google email field must be a valid email', async () => {
|
||||
await setUp();
|
||||
|
||||
// await user.click(screen.getByTestId('account-sharing'));
|
||||
// await user.type(screen.getByTestId('input-google-email'), 'a');
|
||||
// expect(await getNextButton()).toHaveClass('pf-m-disabled');
|
||||
// expect(await getNextButton()).toBeDisabled();
|
||||
// await user.type(screen.getByTestId('input-google-email'), 'test@test.com');
|
||||
// expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
|
||||
// expect(await getNextButton()).toBeEnabled();
|
||||
// });
|
||||
// });
|
||||
await user.click(screen.getByTestId('account-sharing'));
|
||||
await user.type(screen.getByTestId('input-google-email'), 'a');
|
||||
expect(await getNextButton()).toHaveClass('pf-m-disabled');
|
||||
expect(await getNextButton()).toBeDisabled();
|
||||
await user.type(screen.getByTestId('input-google-email'), 'test@test.com');
|
||||
expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
|
||||
expect(await getNextButton()).toBeEnabled();
|
||||
});
|
||||
});
|
||||
|
||||
// describe('Step Registration', () => {
|
||||
// const user = userEvent.setup();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue