Files
Carlo 885540eed1 Patch when closed: frontend (#50437)
**Related issue:** Resolves #49419

Adds the UI for patching Fleet-maintained apps when the app is closed.
The patch toggle becomes a Deploy control with Force install and Patch
checkboxes. Checking Patch reveals a radio group: Patch when app is
closed, Force patch, or End user initiated. The control appears in the
Add software flow, a new Deploy modal, and the edit-policy page. The
change also adds skipped-install copy in the activity feed and install
details, a Self-service toggle for Fleet-maintained apps, and GitOps and
Premium gating.

The PR also includes backend changes that expose the patch policy's
continuous-automation state and a Fleet-maintained app's install query
in the API. The UI reads both to show the correct Deploy options, so
they ship in one PR.

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually


Eng QA walkthrough [part
1](https://drive.google.com/file/d/1Un-Z4QoTk2eXslQ_b8t95cE11QYq1SUt/view?usp=drive_link),
[part
2](https://drive.google.com/file/d/12_1Eh_RHOJ7RTjXBxFgas0VhKWvhLS0r/view?usp=drive_link)
2026-08-04 13:47:24 -04:00
..

Fleet UI tests

The test directory contains the jest configuration, test setup, request handlers, mock server definition, testing utilities, and entity stubs (deprecated and will be replaced by mocks in frontend/__mocks__) for use in test files throughout the application. The test files for components and app functions are located in the same directory as the files they test.

Table of contents

Jest configuration

This is where the jest configuration is located. Refer to Jest's official documentation.

Test setup

This file configures the testing environment for every test file.

Request handlers and their setup

Default handlers and custom handlers are both defined within the handlers directory and return mocked data. The handlers directory will naturally grow with more default and custom handlers required for more tests. We use mock service worker to define all request handlers.

Default handlers and custom handlers differ in their setup. Default handlers are setup in mock-server.ts. The mock server will serve the default handlers outlined in default-handlers.ts. Custom handlers must be setup inline within a component's test suite (frontend/**/ComponentName.tests.tsx). For example, we would setup the custom handler activityHandler9Activities inline using mockServer.use(activityHandler9Activities);.

Testing utilities

We use various utility functions to write our tests.

Testing stubs Deprecated

Testing stubs are still being used in a handful of old tests. We are no longer following this pattern of adding data to testing stubs. Rather, we are building stubs as mocks located in the frontend/__mocks__ directory.

Check out how we mock data used for unit and integration tests.

Follow this guide to run tests locally.

Visit the frontend overview of Fleet UI testing for more information on our testing strategy, philosophies, and tools.