Patch is one of the applications for console.redhat.com. It allows users to display and manage available patches for their registered systems. This repository contains source code for the frontend part of the application which uses the REST API available from Patchman Engine.
- Make sure you have
Node.jsversion >= 18 installed. - Run script to patch your
/etc/hosts - Make sure you are using Red Hat proxy if working against the stage environment.
- Make sure you are connected to the Red Hat VPN
- Install dependencies with
npm install - Run development server with
npm run startand select desired environment (stage-previewis recommended) - Local version of the app will be available at URL printed out to the
console (https://stage.foo.redhat.com:1337/preview/insights/patch/ if you selected
stage-preview)
Playwright and Jest are used as our testing frameworks.
npm run lint- run the linter.npm run test- run all Jest tests.npm run coverage- generate coverage information from Jest tests after running them.
The E2E tests are located in the playwright/ directory and are identified by the *.spec.ts file
extension.
All the helpers live in the test-utils directory.
-
Copy the example env file content and create a file named
.envin the root directory of the project. Paste the example file content into it. For local development fill in the following variables:BASE_URL-https://stage.foo.redhat.com:1337is required, which is already set in the example configADMIN_USER- your consoledot stage usernameADMIN_PASSWORD- your consoledot stage password
-
Make sure Playwright is installed as a dev dependency:
npm clean-install
-
Download the Playwright browsers with:
npx playwright install
-
Start the local development stage server by running:
npm run start:stage -
Now you have two options of how to run the tests:
-
Using the terminal
npx playwright testwill run the playwright test suite.npx playwright test --headedwill run the suite in a vnc-like browser so you can watch its interactions.
-
Using VSCode (or VSCode forks, like Cursor) + the Playwright Test module for VSCode – other editors have similar plugins for ease of use.
-
Running integration tests requires two distinct steps: first, pointing Playwright to stage; and second, enabling the Podman API wrapper for managing containers that are provisioned by our Playwright tests. Follow these setup steps:
- Set
PROXYandBASE_URL. Seeplaywright_example.envfor reference - Set the
INTEGRATIONflag to true - Set the
DOCKER_SOCKEToption in your.envfile as follows:DOCKER_SOCKET="/tmp/podman.sock" - Start the API service for Podman by running:
podman system service -t 0 unix:///tmp/podman.sock
- Run the tests with
npx playwright test
If you're using Docker instead of Podman, you'll need to use DOCKER_SOCKET="/var/run/docker.sock". You can also skip
step 4 and run the tests directly with npx playwright test.
The app uses containerized builds which are configured in
app-interface.
| Environment | Available at | Deployed version |
|---|---|---|
| stage preview | https://console.stage.redhat.com/preview | master branch |
| stage stable | https://console.stage.redhat.com | master branch |
| production preview | https://console.redhat.com/preview | up to the commit configured in app-interface |
| production stable | https://console.redhat.com | up to the commit configured in app-interface |
This project uses Patternfly React.
This app imports components from Insights Front-end Components library. ESI tags are used to import Insights Chrome which takes care of the header, sidebar, and footer.