Commit graph

156 commits

Author SHA1 Message Date
regexowl
45a42ce549 src: Migrate remaining files to TypeScript
This migrates remaining JavaScript files to TypeScript and updates imports.
2024-06-06 08:38:41 +02:00
Sanne Raymaekers
0e74de53fa test: only test against content sources 2024-05-22 10:11:51 +02:00
regexowl
f37bd91a9a test: Update tests after TypeScript migration
This resolves problems caused by TypeScript migration.
2024-05-03 16:36:26 +02:00
Michal Gold
4ba9235b1b V2Wizrd: remove Duplicate mount points warning 2024-04-10 08:30:13 +02:00
lucasgarfield
7c5a040ad7 V1Wizard: Change qcow search param to qcow2 (HMS-3684)
This commit changes the optional search param `target=qcow` to be
`target=qcow2` so it is in alignment with the UI.
2024-03-20 17:29:51 +01:00
regexowl
76fba98773 V1Wizard: Add search parameter for target selection (HMS-3684)
Add an optional search parameter to the V1Wizard 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 17:29:51 +01:00
Simon Steinbeiss
9020392969 V1 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 09:08:57 +01:00
regexowl
07ec85f526 test: Increase timeout for CreateImageWizard test
The "Step Details image name invalid for more than 63 chars" is often timing out. The timeout was already increased in V2, this makes the same change for V1.
2024-03-06 10:40:57 +01:00
regexowl
9629a7259d test: Await testTile function
The `testTile` function was improperly awaited, causing problems with tests that followed.
2024-03-01 17:33:08 +01:00
lucasgarfield
3493772672 V1 Wizard: Add search parameter for release selection
Adding an optional search parameter to the 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.
2024-03-01 17:33:08 +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
Ondrej Ezr
627f953dfc feat(HMS-3341): pass module_hotfixes flag to compose request 2024-02-28 12:41:20 +01:00
regexowl
97170fb98f test: Re-enable repositories step
This reverts:
- https://github.com/osbuild/image-builder-frontend/pull/1593
2024-02-19 20:54:45 +01:00
regexowl
28468c7af6 test: Disable repositories tests
This disables all tests testing behaviour of the Repositories step.

All instances were marked with the "Temporarily disable" comment to make the complete revert easier in the future.
2024-01-25 13:53:27 +01:00
lucasgarfield
0f75f4862a Tests: Disable repository related tests
Disable tests related to custom repos temporarily while that feature is
unavailable.
2024-01-24 21:13:09 +01:00
Amir
c2e7c34d6e feat(HMS-3386): add blueprints initial layout 2024-01-19 17:20:21 +01:00
regexowl
f90718815b test: Replace .getBy queries by awaited .findBy
Components sometimes render slower than tests run which causes failures when the test suite expects elements that did not finish their rendering yet.

This should help to prevent most of possible problems with the rendering speed.
2024-01-17 17:19:57 +01:00
regexowl
b427c1a310 Wizard/test: Remove unused variables
This removes unused variable from the code.
2023-12-19 09:17:01 +01:00
regexowl
44bb6f62ff test: Add a test checking if release lifecycle chart renders correctly
This adds a test that checks if the release lifecycle chart rendered only when RHEL 8 release is selected.
2023-12-07 19:39:58 +01:00
regexowl
c11f80188e test: Update release select option to partial match
With description added to the RHEL release options in Release select every query using name needed to be updated from full to partial match.
2023-12-07 19:39:58 +01:00
regexowl
3e07472826 Wizard/ImagesTable/test: Change "VMWare" to "VMware"
The "w" in VMware should be lower case, this updates it in all places.
2023-12-05 13:20:42 +01:00
Sanne Raymaekers
31d286aac3 test/CreateImageWizard: Test compose requests sent by wizard 2023-12-01 13:11:07 +01:00
regexowl
62673813e2 test: Remove out-of-date comments
This cleans up comments in tests and removes all that are no longer relevant.
2023-11-27 13:52:20 +01:00
Amir Fefer
16cf421c68 feat(HMS-2789): simplfy activation key creation 2023-11-23 16:19:07 +01:00
mgold1234
303e557f07 fix linting warnings
this commit fix some linting warnings that user get when running npm run lint:js:fix command,
some worning comes after big changes to TypeScript
2023-11-13 16:00:01 +01:00
regexowl
7b0b9a8ddc test: Fix await-async-events error
After cleaning up the ESLint plugins a new error for eslint-plugin-testing-library popped up. This PR solves all of the occurences of `Promise returned from async event method `user` must be handled` and removes the `"testing-library/await-async-events": "off"` switch which was temporary put in place.
2023-11-08 14:15:17 +01:00
Thomas Lavocat
e2c3ea98b3 tests: there's now two option-menu to select from
Adding a new select into the images output step had for effet to
mechanically add a new option menu. In order to select the release
menu we have to take now the first option menu of all possibilities.

Refs HMS-1135
2023-10-26 20:07:54 +02:00
Thomas Lavocat
826882d1ef tests: adapt to target appearing dynamically
There is now a delay between when the user clicks on the architecture
button (or just goes onto the step) and when the targets are being
displayed. This is due to the fact that the data to filter which targets
needs to be displayed has to be fetched from the backend. And during the
meantime a loading spinner is shown.

To adapt to this the code simply waits for the fields to be accessible.

Refs HMS-1135
2023-10-26 20:07:54 +02:00
lucasgarfield
c4d411efa4 Wizard: Improve in-page wizard cosmetically
This commit:
1. Removes the header from the Data Driven Forms wizard
2. Adds padding around the in-page wizard so it is visually consistent
   with the images table
3. Refactors the images table header into a re-usable component that is
   now used in both the images table and the wizard
4. Allows the repositories table to fill the available vertical space in
   the wizard
5. Adjusts the package dual list selectors so that they fill the
   available horizontal space in the wizard
2023-10-20 15:51:03 +02:00
Thomas Lavocat
cbe710e75e wizard: don't show the form as a modal
When the user clicks on the "create an image" button, the image wizard
shows up replacing the landing page. This allows to keep the quickstart
guides to the right of the wizard while the user is interacting with it.
2023-10-09 11:40:40 +02:00
Adi Abramovich
a890dc5666 wizard: add GCP image sharing options
Adding GCP image sharing option according to the discussion on slack(https://redhat-internal.slack.com/archives/C03AZ0264LW/p1692789579814619) and mocks(https://issues.redhat.com/browse/HMS-2352).

In summary, within our GCP sources, we store the project ID. Images cannot be shared directly with a project ID, but they can be shared with a service account or a Google account. Consequently, to launch instances in GCP, users are not required to provide their Google account; instead, the images should be shared with the provisioning service account. This ensures that the provisioning team has access to the necessary images, as sharing them with individual users would not allow that.

After a thorough discussion, we have collectively decided to introduce an option. This option allows users to exclusively utilize the Launch service without the need to share the image with a Google account.
2023-09-27 13:53:36 +02:00
lucasgarfield
7b9e726151 ImagesTable: Convert ImagesTable to Typescript & RTK Query
This commit converts the Images Table to Typescript and converts all API
calls to image-builder to use RTK Query hooks.

This should increase the performance of the app significantly.
Previously our calls to the image-builder API were made in series. They
are now made in parallel. We may want to investigate the possibility of
hitting rate limiting now that we will be issuing requests in much more
rapid succession.

In the tests, moving to RTK Query hooks has allowed us to remove
virtually all Jest mocking. However, this means that some of our
previous tests which tested against implementation details were broken.
Most notably, we no longer check the Redux store to verify that clones
have been added correctly and we no longer check that compose requests
were issued successfully. Test coverage will be restored in a follow-up
PR where the dev-dependency @msw/data is added. Adding a persistent data
layer to the tests using @msw/data will allow us to verify that our POST
requests (creating composes and cloning them) are working by testing
that the Images Table has been updated.
2023-09-18 10:35:04 +02:00
regexowl
9f5a0af826 Wizard: Update the Repositories step
This updates the Repositories and Review step as per [mocks](https://www.sketch.com/s/d7aa6d29-fca0-4283-a846-09cc5fd10612/a/MyEbDz7).

Repositories with the unavailable or invalid status have a popover that allows for further inspection. The time of the last introspection and the counter of failed attempts was added to the popover, together with the "Go to Repositories" button.

On Recreate the payload repositories are checked against "freshly" fetched list of repositories. In case any of the previously checked repositories is no longer available in content sources an Alert is rendered on both Repositories and Review steps. The unavailable repository is checked, but the checkbox is disabled and the information is dashed out. Since the information about the repository is stored in the Repository type, the only information available to be rendered is the baseurl.

Create image button is also disabled when recreating an image with unavailable repositories.
2023-09-11 10:30:04 +02:00
regexowl
ff0eb304bf test: Safeguard first setUp() in .test and .azure against early exit
The "Step Image output - clicking Next loads Upload to AWS" and "Step Upload to Azure - clicking Next loads Registration" were sometimes returning the "Warning: An update to <element> inside a test was not wrapped in act(...)" error.

This seems to have been caused by an early exit in the `setUp()` function in the first `describe` block.
Safeguards were put in place to fix this behaviour.

As this error didn't occur every time, testing the updates was not easy. This current fix passed the threshold of ten successful runs of `npm run test`.
2023-08-30 16:01:02 +02:00
regexowl
38e2852734 test: Fix problem with mocked server.use calls
Test `component renders error state correctly` was outputting errors for both AWS and Azure tests.
This was caused by calling `server.use()` after the wizard was already rendered.

Fixed by moving the one time server mock response to the very beginning of the unit test. Also added `server.resetHandlers()` to be run after each of the unit tests.

Thanks to this fix, azure tests could be merged again. Which means no more splitting into `CreateImageWizard.azure.test.js` and `CreateImageWizard.azure.2.test.js`
2023-08-30 16:01:02 +02:00
regexowl
e71d98da08 test: Update CreateImageWizard tests
This updates following test suites after bumping react and testing-library:
- CreateImageWizard.azure.test.js
- CreateImageWizard.azure.2.test.js
- CreateImageWizard.content.test.js
- CreateImageWizard.test.js
2023-08-30 16:01:02 +02:00
regexowl
90a012d49b HMS-1492: Change rhc to non-capitalized
Fixes HMS-1492

This changes all occurences of "rhc" and "remote host configuration" from capitalized to lowercase.
In cases where the sentence started with "rhc" this was changed to "remote host configuration" to avoid
starting the sentence with "Rhc".
2023-08-29 12:36:38 +02:00
Ondrej Ezr
8b796ef431 Switch to Content Sources search
Enable searching for RH packages through Content Sources service.
Gates the search by Content Sources feature flag, to keep the easy kill switch.
2023-08-24 14:41:16 +02:00
Ondrej Ezr
b486f44dcb Custom Repositories gate by Feature flag 2023-08-23 15:38:25 +02:00
Ondrej Ezr
2a8e5a10df Launch button in stable environments
This moves Beta only features to stable environment:
- Sharing Images through Sources
- Launch button

This tries to avoid any refactoring, just moving components from Beta to stable with minimal changes.
2023-08-23 09:27:25 +02:00
Thomas Lavocat
8ab31edbe9 eslint/expect: uneffective tests
Correct the tests that were not testing the result. And set the values
to a functioning one.
2023-08-17 17:18:55 +02:00
Thomas Lavocat
3b8afeaf7d eslint/excpect: should not be called conditionally
This commit fixes the error but not really the pattern. We should
consider refactoring the tests following these guidelines:
https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-expect.md
2023-08-17 17:18:55 +02:00
Thomas Lavocat
62bca76627 test/wizard: avoid scalprum errors
Avoid having to deal with scalprum errors by not rendering the
LandingPage.
2023-08-09 16:03:00 +02:00
Thomas Lavocat
dd54af2c7b test/wizard: fix act errors
Brute force approach to fix the act errors in the Wizard tests. It's not
ideal but allows to move on toward activating strict mode on the test
suite ASAP.
2023-08-09 16:03:00 +02:00
regexowl
608ca157eb test/fixtures: Update compose fixture and migrate it to TypeScript
This adds `request` to a reponse from the `composes/{composeId}` endpoint and `meta` to a response from the `/composes/{composeId}/clones` endpoint as per API documentation.

The incomplete responses were causing problems when fetching data from the endpoints mentioned above.

The fixture was also migrated to TypeScript.
2023-08-07 10:20:44 +02:00
regexowl
e2ffc1705c test/fixtures: Migrate the packages fixture to TypeScript
This migrates the `packages` fixture to TypeScript and adds needed types to `index.ts`
2023-08-07 10:01:40 +02:00
regexowl
1456861e63 test: Move button clicking functions to testUtils
This moves the `clickBack`, `clickCancel`, `clickNext`, `getNextButton` and `verifyCancelButton` functions from the tests to `testUtils`.
2023-08-01 13:32:20 +02:00
mgold1234
7cb3f2d0b6 Wizard: add description field to Details steps 2023-07-28 12:24:25 +02:00
mgold1234
ca2f2f7ba3 Wizard: change the image name
fixes #1196
this commit update the wording on image name step
when user create new image.
2023-07-17 17:05:03 +02:00
regexowl
c4f616763d Wizard: Image name validation
This adds validation of an image name based on a pattern, which was chosen as an intersection of the naming constrains of hyperscalers.

The pattern is based on the one for naming GCP images as those naming guidelines are the most restrictive. With added minimal length restriction of AWS.
2023-07-11 10:39:32 +02:00