Commit graph

76 commits

Author SHA1 Message Date
lucasgarfield
61b23216f4 V2 Wizard: OpenSCAP edit tests
Edit mode is now fully tested and working for OpenSCAP profiles. A
handler for the PUT request was added and the fixtures were updated to
support this.

`EditImageWizard.tsx`: Previously we dispatched `initializeWizard()`
while waiting for the blueprintDetails to load. This meant that the
state was incorrect (empty) while the blueprintDetails request was
in flight.

`requestMapper.tsx`: Correctly populate state in edit mode if the
blueprint contains a custom file system – previously custom mountpoints
were dropped and automatic mode was selected.

`spyOnRequest()`: Differentiate between request types (e.g. GET, PUT)
for the same endpoint.
2024-04-30 15:13:50 +02:00
regexowl
0c1af145c1 test: Add tests to check reseting public cloud states
This adds happy path tests that check whether the public cloud states get reset after the public cloud was removed from targets.
2024-04-29 15:35:59 +02:00
regexowl
6494070a40 test: Replace image installer with guest image in happy path tests
This replaces 'image-installer' target with 'guest-image' in happy path tests which allows proper testing of FSC functionality. File system customisations are not applied to bare metal - installer images.
2024-04-29 11:57:30 +02:00
regexowl
ec8cf1c8b9 test: Add test for checking ISO only / more targets FSC options
This adds two tests that check whether the "Manually configure partitions" options is hidden on ISO only target and shown when combined with another target.
2024-04-29 11:57:30 +02:00
lucasgarfield
bb91840eef V2 Wizard: Fix snapshot_date field
The snapshot_date in the image_request must be a date. snapshot_date is
an optional field and if no snapshot is used, the field should be
undefined. Previously it was an empty string and this caused image
builder to return a code 400 with message "Snapshot date is not in
DateOnly (yyyy-mm-dd) format".
2024-04-26 15:03:17 +02:00
Ondrej Ezr
7246cfbd16 WizardV2: pass module_hotfixes to the request 2024-04-26 13:59:20 +02:00
Andrew Dewar
3231b324f0 HMS-3796: Add snapshot date selection to wizard 2024-04-25 14:45:50 +02:00
regexowl
b6041d2022 V2Wizard: Add masked services to the "Disabled services" code block
Fixes #1985

This concatenates masked service to the disabled services so both get rendered in the "Disabled service" code block.

Test to check this was also added.
2024-04-25 11:40:17 +02:00
regexowl
45be93db11 test: Add debounce to tests
Extra await with longer time out was added to a test to accomodate searchTerm debounce.
2024-04-25 11:32:47 +02:00
regexowl
3b7a1338ec test: Add unleash flag mocking to the tests
The functionality is currently gated behind an unleash flag. This adds the mocked flag to the tests.
2024-04-25 11:22:08 +02:00
regexowl
6f6784df2d test: Add package recommendations to the happy path test
This adds unit tests for package recommendations to the `Packages.test.tsx`, testing the happy path for:
- adding single recommendation
- adding all recommendations
- removing a recommendation
2024-04-25 11:22:08 +02:00
regexowl
371588e9a2 test: Add tests for package recommendations
This updates the handlers and fixtures and adds a simple unit test testing that recommendations get rendered correctly and it's possible to add them to the blueprint.
2024-04-25 11:22:08 +02:00
lucasgarfield
1607fda162 V2 Wizard: Add Azure tests (HMS-2781)
Adds tests to verify that building an Azure image using either sources
or manually entering the required info results in a correctly generated
request.
2024-04-23 11:58:42 +02:00
lucasgarfield
1367de0684 V2 Wizard: Add AWS tests (HMS-2781)
Adds tests to verify that building an AWS image using either sources or
an account id results in a correctly generated request.
2024-04-23 10:40:31 +02:00
lucasgarfield
a1bdcaa54f V2 Wizard: Fix OpenSCAP step
OpenSCAP profile info is now correctly loaded into the state and
verified to be in the final request with tests.

I modified the fixtures for the OpenSCAP profiles. My changes ensure we
have a Venn-diagram like overlap when changing from one profile to
another where one package is the same, one package is removed, and one
package is added. The same is true for the services and partitions. For
kernel args it is not so important as that is just a string (as opposed
to an array), so it is enough to be different.

I was able to eliminate a useEffect by replacing it with a lazy query
trigger function. Setting the second arg `preferCacheValue` to `true`
means that a request is only made if cached data is not available.

I modified the Redux reducers a bit to add some additional safety.

`changeFileSystemPartitionMode` is now responsible for initializing the
partitions field in the state by adding the root partition – previously
this was done in the components themselves by dispatching
`addPartition`. This reducer can always be safely dispatched – if the
mode is ‘manual’, dispatching it with a payload of ‘manual’ will not
result in any changes to the state.

`addPackage` is also safer now. When a package is added, the list of
packages is checked. If there is a package with an identical name, the
new package overwrites the previous package. This is useful because the
description may be different for the same package – for instance, when
adding an OpenSCAP package, we use a custom description (‘this package
required by OpenSCAP’).
2024-04-23 10:02:03 +02:00
Amir
bac8e1e57f V2Wizard: add GCP target full test coverage 2024-04-18 18:51:40 +02:00
regexowl
dbeee5d066 V2Wizard: Differentiate between Create and Edit mode on Review step
This renames actions on the primary button on Review step for the Create mode so it's clear whether you're creating a blueprint from a scratch or saving changes to an already existing blueprint.
2024-04-17 18:46:49 +03:00
lucasgarfield
782a8eba7e V2 Wizard: Add custom file system to request customizations (HMS-3690)
The blueprint request now contains a field for the filesystem in its
customizations.
2024-04-16 10:02:19 +02:00
regexowl
43cb43dac8 V2Wizard: Add tally to the "Selected" toggle
This adds a tally of selected packages to the "Selected" toggle.
2024-04-11 11:41:46 +02:00
regexowl
a8270fd228 test: Re-enable FSC alert test and clean up
This re-enables test of FSC alert and cleans up previously commented lines of the tests.
2024-04-11 11:21:19 +02:00
regexowl
972190ecaf V2Wizard: Update create/edit button copy
This updates copy on the Save changes button as per recent mocks.
2024-04-10 13:44:22 +03:00
Amir
442d88a4ce fix(HMS-3850): V2Wizard:use menu toggle for save and build 2024-04-09 14:56:34 +02:00
regexowl
7e83c8ecbb test: Enable OpenSCAP initialized packages tests
This re-enables tests checking initialization of packages upon OpenSCAP profile selection.
2024-04-04 12:34:57 +02:00
regexowl
f71175f69b V2Wizard: Add full bottom pagination to Repositories and Packages
This adds full pagination to the bottom of Repositories and Packages steps which will allow the user to get to the very end of the tables in a case of many results.
2024-04-04 11:35:07 +02:00
regexowl
d2c56391f9 V2Wizard: Update "Too many results" copy
This updates copy shown in a table when too many results are fetched. Also a period was added to the end of the empty state bodies.
2024-04-02 10:59:41 +02:00
Ondrej Ezr
ad8fd5ddc3 Blueprint: Validate Blueprint name is not empty
We are now validating Blueprint name on the backend to be non-empty.
Adds same validation for frontend

Refs HMS-3801
2024-03-25 12:51:33 +01:00
Gianluca Zuccarelli
d57cd95c65 V1Wizard: masked services -> disabled services
For the UX the user doesn't really need to know that the services are masked,
rather than disabled in the backend. We can simplify this and show the masked
services as disabled.
2024-03-21 11:16:50 +01:00
lucasgarfield
5dcc3abbd8 V2Wizard: Change search parameter from qcow to qcow2
`target=qcow2` is in better alignment with the UI than `target=qcow`
2024-03-20 18:04:44 +01:00
regexowl
a7cc88af44 V2Wizard: Add search parameter for target selection (HMS-3684)
Add an optional search parameter to the wizard like so:

`/insights/image-builder/imagewizard?target=iso`
or
`/insights/image-builder/imagewizard?target=qcow`

This results in wizard being opened and iso or qcow target being pre-selected. The Insights assistant chat bot will make use of this feature.
2024-03-20 18:04:44 +01:00
Simon Steinbeiss
ad25c6bcb7 V2 Wizard: Add search parameter for arch selection
Add an optional search parameter to the wizard like so:

/insights/image-builder/imagewizard?arch=aarch64

This results in the wizard being opened and 'aarch64' being pre-selected as the architecture.
The Insights assistant chat bot and our websites (access.redhat.com and
developers.redhat.com) will make use of this feature.

Relates to HMS-3684
2024-03-15 12:22:07 +01:00
mgold1234
430ea83df0 V2 Wizard: Add File System Configuration Step (HMS-2781)
The FSC step is added to the wizard and takes full advantage of Redux
for state management.

This is still a work in progress.

Supported features:
1. Select partition mountpoint prefix (e.g. /var, /home)
2. Edit partition mountpoint suffix (e.g. /home/videogames)
3. Change displayed units (KiB, MiB, GiB)

Supported but buggy features:
1. Edit partition size

Unsupported features:
1. Add partitions
2. Remove partitions
3. Validation
2024-03-08 18:14:33 +01:00
lucasgarfield
6af38141be V2 Wizard Tests: Add tests for release and architecture
Adds tests that ensure the blueprint request is generated correctly for
all releases (rhel 8 & 9, centos 8 & 9) and for both architectures
(x86_64 and aarch64).
2024-03-07 17:03:20 +01:00
lucasgarfield
d6016519e5 Test: useChrome() mocks isBeta() returns true
The previous commit adjusts the necessary feature flags to expose the
new blueprints table and V2 wizard in stage-preview.

This causes tests where isBeta() == false to fail. This commit changes
the relevant useChrome() mocks such that isBeta() returns true.
2024-03-05 19:27:46 +01:00
lucasgarfield
25a5ff7772 V2Wizard/Test: Add docstring to preparePathname helper
preparePathname() is called by the render() test helper function, this
commit adds a docstring (JSDoc format) with examples to document how it
works.
2024-03-04 16:43:55 +01:00
lucasgarfield
ad5d2007bb V2 Wizard: Add search parameter for release selection (HMS-3684)
Adding an optional search parameter to the V2 wizard like so:

/insights/image-builder/imagewizard?release=rhel8

results in the wizard being opened and RHEL 8 being pre-selected as the release.

The Insights assistant chat bot will make use of this feature.

The render() test utility function had to be updated to accept an
optional searchParams argument.
2024-03-04 16:43:55 +01:00
regexowl
c60e45cd4d test: Remove "Click through all"
This removes the "Click through all" test as it will be replaces by testing the requests for separate customisations.
2024-03-04 16:33:24 +01:00
regexowl
2bed43645d V2Wizard/test: Fix bug on registration step and enable tests
This fixes a bug on the registration step which made the text "Connect to Red Hat Insights" not to get rendered when registering with rhc.

All registration tests were also enabled in CreateImageWizard.test.tsx
2024-03-01 10:49:43 +01:00
regexowl
2bb8da190b test: Re-enable part of AWS tests
This re-enables the rest of AWS tests in CreateImageWizard.test.tsx
2024-03-01 10:22:11 +01:00
lucasgarfield
e923cccd41 V2Wizard/Repositories: Add payload_repositories to request and test it
Previously the V2 Wizard's request mapper was only adding the
custom_repositories field. We also need to add a nearly duplicate
payload_repositories field due to how the image-builder API works...
which is admittedly not intuitive.

Tests are also added to ensure that requests are generated correctly
when using the custom repositories feature.
2024-03-01 10:02:52 +01:00
regexowl
08563b9dfa V2Wizard/test: Add autofocus to radios and enable Keyboard accessibility tests
This adds `autoFocus` attribute to radios on AWS, Azure and GCP step.

The Keyboard accessibility tests have been re-enabled.
2024-03-01 09:38:47 +01:00
lucasgarfield
ed61f17d58 V2Wizard/Packages: Add tests for requests
Adds tests that verify using the custom packages step to add a custom
package results in a correctly generated API request.
2024-02-29 14:37:46 +01:00
regexowl
8b224a0327 V2Wizard: Remove bulk select and refresh button from the Packages step
This removes bulk select and a refresh button from the Packages step and updates tests accordingly.
2024-02-29 12:39:09 +01:00
regexowl
11cedba1af test: Re-align CreateImageWizard.test tests
The tests in the suite were improperly nested, this fixes the problem.
2024-02-29 11:19:24 +01:00
regexowl
161e9c05f0 test: Remove @ts-ignore comments
This removes `@ts-ignore` instances in the Azure test suite.
2024-02-28 18:19:57 +01:00
regexowl
2c6c326677 V2Wizard: Add packages to the Review step
This adds packages counter and a table of packages in a popover to the Review step.

The name of the field was also updated to "Additional packages".
2024-02-28 17:17:00 +01:00
regexowl
4c80ab4ad7 test: Adjust original CreateImageWizard tests according to fixture changes
The packages fixtures for content sources have "-sources" added to their name. This updates the tests accordingly.
2024-02-28 17:17:00 +01:00
regexowl
97d4ad7cc8 test: Enable packages tests
This re-enables previously disabled test for the Packages step.
2024-02-28 17:17:00 +01:00
mgold1234
174e37531c V2Wizard: add unit test to Azure step 2024-02-28 12:10:00 +01:00
regexowl
61c575c42e test: Up timeout for 'image name invalid for more than 63 chars'
This increases the timeout of 'image name invalid for more than 63 chars' to 20000.
2024-02-22 12:55:29 +01:00
lucasgarfield
d4c9534ecc V2Wizard/Details: Add request assertion tests
Adds tests to verify requets for images with names and descriptions are
formulated correctly.

Test functions shared/common to multiple steps were extracted to the
test utilities.
2024-02-15 13:10:34 +01:00