Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1,266 @@
|
||||
---
|
||||
name: integration-test-video
|
||||
description: Run Warp integration tests with screenshot and video capture, including event overlay annotations for mouse and keyboard input. Use this whenever the user wants to record an integration test, collect screenshots from a test, review generated recording artifacts, or author a test that captures video for debugging or demos.
|
||||
---
|
||||
|
||||
# Integration Test Video Recording
|
||||
|
||||
Use this skill when working with Warp's integration test recording pipeline on this branch.
|
||||
|
||||
The relevant implementation lives in:
|
||||
- `integration/src/bin/integration.rs`
|
||||
- `integration/src/test/video_recording.rs`
|
||||
- `integration/tests/integration/ui_tests.rs`
|
||||
- `ui/src/integration/driver.rs`
|
||||
- `ui/src/integration/step.rs`
|
||||
- `ui/src/integration/video_recorder.rs`
|
||||
- `ui/src/integration/artifacts.rs`
|
||||
- `ui/src/integration/overlay.rs`
|
||||
|
||||
## Command to invoke a test
|
||||
|
||||
For a single manually-invoked recording test, prefer the integration binary:
|
||||
|
||||
```bash
|
||||
WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 \
|
||||
cargo run -p integration --bin integration -- test_video_recording
|
||||
```
|
||||
|
||||
That is the command shown by the sample test in `integration/src/test/video_recording.rs`.
|
||||
|
||||
If you want the driver to auto-record a test or set of tests, add `WARP_INTEGRATION_TEST_VIDEO`:
|
||||
|
||||
```bash
|
||||
WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 \
|
||||
WARP_INTEGRATION_TEST_VIDEO=test_video_recording \
|
||||
cargo run -p integration --bin integration -- test_video_recording
|
||||
```
|
||||
|
||||
For broader integration test runs, the same env vars work with the normal test runner:
|
||||
|
||||
```bash
|
||||
WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 \
|
||||
WARP_INTEGRATION_TEST_VIDEO=test_foo,test_bar \
|
||||
cargo nextest run --no-fail-fast --workspace test_foo
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
||||
### `WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS`
|
||||
- Set this to `1` when you need real frame capture.
|
||||
- Use it for screenshot/video workflows and manual visual verification.
|
||||
- Without a real display, expect recording workflows to be incomplete or unusable.
|
||||
|
||||
### `WARP_INTEGRATION_TEST_VIDEO`
|
||||
This is the main env var that controls driver-managed video recording in `ui/src/integration/driver.rs`.
|
||||
|
||||
Behavior:
|
||||
- Unset or empty: auto-recording is disabled.
|
||||
- `1` or `all`: auto-record every test in the run.
|
||||
- Comma-separated test names: auto-record only those tests.
|
||||
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
# Record every test in the run
|
||||
WARP_INTEGRATION_TEST_VIDEO=all
|
||||
```
|
||||
|
||||
```bash
|
||||
# Record only specific tests
|
||||
WARP_INTEGRATION_TEST_VIDEO=test_foo,test_bar
|
||||
```
|
||||
|
||||
Important nuance:
|
||||
- You do not need `WARP_INTEGRATION_TEST_VIDEO` if the test itself explicitly calls `with_start_recording()` and `with_stop_recording()`.
|
||||
- Use the env var when you want whole-test recording without changing the test code.
|
||||
|
||||
### `WARP_INTEGRATION_TEST_ARTIFACTS_DIR`
|
||||
This controls the root artifact directory used by `TestArtifacts` in `ui/src/integration/artifacts.rs`.
|
||||
|
||||
If unset, artifacts go under:
|
||||
|
||||
```text
|
||||
$TMPDIR/warp_integration_test_artifacts
|
||||
```
|
||||
|
||||
Each run gets a timestamped directory:
|
||||
|
||||
```text
|
||||
<artifacts_root>/<test_name>/<timestamp>/
|
||||
```
|
||||
|
||||
This is the main directory to inspect for screenshots, logs, and the final `recording.mp4`.
|
||||
|
||||
### `WARP_INTEGRATION_TEST_VIDEO_DIR`
|
||||
This env var exists in `ui/src/integration/video_recorder.rs` as the lower-level recorder output root helper, defaulting to:
|
||||
|
||||
```text
|
||||
$TMPDIR/warp_integration_video_captures
|
||||
```
|
||||
|
||||
On this branch, the normal integration driver flow writes the finalized video into the test artifacts directory instead, so `WARP_INTEGRATION_TEST_ARTIFACTS_DIR` is the one you usually care about when reviewing results.
|
||||
|
||||
## How to specify which tests to record
|
||||
|
||||
There are two modes:
|
||||
|
||||
### 1. Record in test code
|
||||
Use `TestStep::with_start_recording()` and `TestStep::with_stop_recording()` inside the test itself. This is best when you only want to capture a specific span of the test.
|
||||
|
||||
### 2. Record from the environment
|
||||
Set `WARP_INTEGRATION_TEST_VIDEO` to:
|
||||
- `all`
|
||||
- `1`
|
||||
- or a comma-separated list like `test_a,test_b`
|
||||
|
||||
This starts recording at the beginning of matching tests and writes the video when the test completes.
|
||||
|
||||
## How overlays work
|
||||
|
||||
There is no separate overlay env var on this branch.
|
||||
|
||||
Overlay annotations are produced from the input events the test dispatches while recording is active. The overlay pipeline is implemented in `ui/src/integration/overlay.rs`, and the event capture hooks live in `ui/src/integration/step.rs`.
|
||||
|
||||
To get useful overlays in the final video, drive the test with APIs that emit mouse and keyboard events, such as:
|
||||
- `with_event(...)`
|
||||
- `with_event_fn(...)`
|
||||
- `with_click_on_saved_position(...)`
|
||||
- `with_keystrokes(...)`
|
||||
|
||||
Overlay types currently exercised by the sample test:
|
||||
- mouse click indicators
|
||||
- drag trails
|
||||
- keyboard shortcut pills
|
||||
|
||||
In practice:
|
||||
- Mouse down / drag / mouse up events create click and drag overlays.
|
||||
- KeyDown events create keyboard overlay pills.
|
||||
- If a test only records frames and never dispatches relevant input events, the resulting video will not show these annotations.
|
||||
|
||||
## How to write a test that takes screenshots
|
||||
|
||||
Use `TestStep::with_take_screenshot("filename.png")`.
|
||||
|
||||
Example pattern:
|
||||
|
||||
```rust
|
||||
TestStep::new("Take screenshot after bootstrap")
|
||||
.with_take_screenshot("after_bootstrap.png")
|
||||
```
|
||||
|
||||
The screenshot request is stored during the step and written by the driver after the step renders. The PNG lands in the test's timestamped artifacts directory.
|
||||
|
||||
## How to write a test that records video
|
||||
|
||||
### Minimum pattern
|
||||
1. Use `Builder::new().with_real_display()`.
|
||||
2. Add a step with `with_start_recording()`.
|
||||
3. Run the actions/events you want captured.
|
||||
4. Add a step with `with_stop_recording()`.
|
||||
|
||||
Example shape:
|
||||
|
||||
```rust
|
||||
Builder::new()
|
||||
.with_real_display()
|
||||
.with_step(TestStep::new("Start recording").with_start_recording())
|
||||
.with_step(/* actions and events */)
|
||||
.with_step(TestStep::new("Stop recording").with_stop_recording())
|
||||
```
|
||||
|
||||
### For overlay-friendly recordings
|
||||
Prefer explicit UI-driving steps that emit mouse and key events:
|
||||
- click with `with_click_on_saved_position(...)`
|
||||
- dispatch raw mouse events with `with_event(...)` / `with_event_fn(...)`
|
||||
- send keyboard shortcuts with `with_keystrokes(...)`
|
||||
|
||||
For drag overlays, send a sequence like:
|
||||
- `LeftMouseDown`
|
||||
- one or more `LeftMouseDragged`
|
||||
- `LeftMouseUp`
|
||||
|
||||
### Optional validation
|
||||
It is reasonable to add an `with_on_finish(...)` hook that checks for expected artifacts such as:
|
||||
- `recording.mp4`
|
||||
- `recording.log`
|
||||
- screenshot PNGs
|
||||
|
||||
The sample test does exactly that.
|
||||
|
||||
## Where the video assets go
|
||||
|
||||
The normal output location is:
|
||||
|
||||
```text
|
||||
${WARP_INTEGRATION_TEST_ARTIFACTS_DIR:-$TMPDIR/warp_integration_test_artifacts}/<test_name>/<timestamp>/
|
||||
```
|
||||
|
||||
Common artifacts in that directory:
|
||||
- `recording.mp4`
|
||||
- `recording.log`
|
||||
- any screenshots requested with `with_take_screenshot(...)`
|
||||
|
||||
For `test_video_recording`, the sample test expects:
|
||||
- `after_bootstrap.png`
|
||||
- `after_commands.png`
|
||||
- `recording.mp4`
|
||||
- `recording.log`
|
||||
|
||||
If MP4 encoding fails during finalization, the recorder falls back to per-frame PNGs in a sibling directory like:
|
||||
|
||||
```text
|
||||
recording_frames/
|
||||
```
|
||||
|
||||
with files such as:
|
||||
|
||||
```text
|
||||
recording_0000.png
|
||||
```
|
||||
|
||||
## How to review the assets
|
||||
|
||||
1. Open the latest timestamped artifact directory for the test.
|
||||
2. Review `recording.mp4` first to confirm:
|
||||
- the UI state is correct
|
||||
- recording actually started and stopped in the intended window
|
||||
- overlay annotations appear at the right moments
|
||||
3. Review any PNG screenshots captured by the test.
|
||||
4. Check `recording.log` if the output looks incomplete or suspicious.
|
||||
5. If `recording.mp4` is missing, look for fallback frame PNGs.
|
||||
|
||||
When summarizing results for the user, include the exact artifact directory path.
|
||||
|
||||
## Sample test for video recording
|
||||
|
||||
The sample manual test is `test_video_recording`.
|
||||
|
||||
It is:
|
||||
- registered in `integration/src/bin/integration.rs`
|
||||
- listed in `integration/tests/integration/ui_tests.rs`
|
||||
- implemented in `integration/src/test/video_recording.rs`
|
||||
|
||||
Run it with:
|
||||
|
||||
```bash
|
||||
WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 \
|
||||
cargo run -p integration --bin integration -- test_video_recording
|
||||
```
|
||||
|
||||
If you want full-test auto-recording from the environment as well, use:
|
||||
|
||||
```bash
|
||||
WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 \
|
||||
WARP_INTEGRATION_TEST_VIDEO=test_video_recording \
|
||||
cargo run -p integration --bin integration -- test_video_recording
|
||||
```
|
||||
|
||||
## Working pattern for agents
|
||||
|
||||
When asked to record or debug an integration test with video:
|
||||
1. Identify the exact test name.
|
||||
2. Decide whether recording should be explicit in the test or enabled via `WARP_INTEGRATION_TEST_VIDEO`.
|
||||
3. Ensure the run uses `WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1`.
|
||||
4. If the user wants visible interaction overlays, make sure the test dispatches mouse and keyboard events while recording is active.
|
||||
5. After the run, inspect the timestamped artifact directory and report the output paths back to the user.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: "Build image and start container for SSH testing"
|
||||
command: |-
|
||||
WARP_REPO_PATH=`git rev-parse --show-toplevel`
|
||||
docker build -t {{image}} $WARP_REPO_PATH/app/tests/ssh
|
||||
docker run -ditp 22:22 {{image}}
|
||||
tags: ["docker"]
|
||||
description: "Builds a Docker image and launches a container based on that image for SSH testing. You can run `ssh bash@0.0.0.0` or `ssh zsh@0.0.0.0` after running this. The password will be 'password'. After you first do this, you can manage the container with the Docker Desktop app. The container may stop (e.g. if you restart your computer), and you can usually bring it back by restarting it there (hit the play button)."
|
||||
arguments:
|
||||
- name: image
|
||||
description: The name of the Docker image. If you have multiple on your machine in order to test different operating systems, it might be useful to denominate them based on that.
|
||||
default_value: ssh_test_ubuntu_latest
|
||||
author: Zheng Tao
|
||||
shells: ["zsh", "bash"]
|
||||
@@ -0,0 +1,20 @@
|
||||
name: "Cherrypick commit into a latest release branch"
|
||||
command: |-
|
||||
git fetch;
|
||||
BRANCH_NAME=$(git branch -r | grep -o '{{release}}_release/v0.20.*{{release}}' | sort | tail -n 1);
|
||||
git checkout $BRANCH_NAME;
|
||||
git pull;
|
||||
COMMIT_HASH={{commit_hash}};
|
||||
CP_BRANCH="cherrypick/${BRANCH_NAME}_${COMMIT_HASH:0:7}";
|
||||
git checkout -b $CP_BRANCH;
|
||||
git pull;
|
||||
git cherry-pick {{commit_hash}} && git push --set-upstream origin $CP_BRANCH --no-verify;
|
||||
echo -e "\n\nCreate PR using this URL: https://github.com/warpdotdev/warp-internal/compare/${BRANCH_NAME}...${CP_BRANCH}?quick_pull=1&template=cherrypick.md"
|
||||
description: "Sets up a cherrypick of a commit (specified by hash) into the given release branch by creating a new local branch off of the release branch, performing the cherry-pick, and pushing the new branch to GitHub."
|
||||
arguments:
|
||||
- name: commit_hash
|
||||
description: Commit hash for the commit to cherrypick
|
||||
- name: release
|
||||
description: "Name of the release channel to cherrypick into, possible values: [dev, preview, stable]"
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
name: "Copy WarpDev Keychain to Warp local"
|
||||
command: "security add-generic-password -a User -U -s warp -w \"$(security find-generic-password -a User -s dev.warp.Warp-Dev -w)\""
|
||||
description: "Copies the refresh token from WarpDev into the local warp app so that it can authenticate."
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,8 @@
|
||||
name: "Create GH pull request to release a feature."
|
||||
command: open 'https://github.com/warpdotdev/warp-internal/compare/{{branch_name}}?expand=1&template=feature_flag.md'
|
||||
description: "Creates a templated pull request that we use when releasing a feature (e.g. flipping a feature flag)."
|
||||
arguments:
|
||||
- name: branch_name
|
||||
description: The name of the branch that enables the feature.
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: "Run an integration test"
|
||||
command: "WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 cargo test --package integration --test integration -- {{test}}"
|
||||
description: "Run a specific integration test."
|
||||
arguments:
|
||||
- name: test
|
||||
description: The name of the integration test to run.
|
||||
default_value: test_simple_example
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: "Run unit test"
|
||||
command: "cargo test --package warp --lib -- {{module_and_test}} --exact --nocapture"
|
||||
description: "Run a specific unit test. This is much faster than running cargo test when this is all you need."
|
||||
arguments:
|
||||
- name: module_and_test
|
||||
description: The specific `tests` module and the name of the test, separated by `::`
|
||||
default_value: terminal::model::blocks::tests::test_separator
|
||||
author: Zheng Tao
|
||||
shells: []
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: "Run Warp locally with shell"
|
||||
command: "WARP_SHELL_PATH={{shell}} cargo run"
|
||||
description: "Runs warp with the particular shell so devs don't need to change their login shell to test a different shell locally"
|
||||
arguments:
|
||||
- name: shell
|
||||
description: path of shell to use
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,11 @@
|
||||
name: "Run Warp locally with version and channel"
|
||||
command: "GIT_RELEASE_TAG={{version}} cargo run --bin {{channel}}"
|
||||
description: "Runs Warp locally with a particular version and channel for development purposes"
|
||||
arguments:
|
||||
- name: version
|
||||
description: version number to use, e.g. 1.2.3.4
|
||||
- name: channel
|
||||
description: channel type, e.g. dev or stable
|
||||
default_value: dev
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: "Bundle warp"
|
||||
command: "./script/bundle -c {{channel}}"
|
||||
description: ~
|
||||
arguments:
|
||||
- name: channel
|
||||
description: "The channel that should be bundled. One of \"stable\", \"preview\", or \"dev\"."
|
||||
author: Warp Team
|
||||
shells: []
|
||||
@@ -0,0 +1,18 @@
|
||||
name: "Create new branch off of master"
|
||||
command:
|
||||
|
|
||||
new_branch={{new_branch_name}};
|
||||
git checkout master && git pull origin master && git rev-parse --verify "$new_branch";
|
||||
if [[ $? -ne 0 ]]; then
|
||||
git checkout -b "$new_branch";
|
||||
else
|
||||
yellow=`tput setaf 3`;
|
||||
reset=`tput sgr0`;
|
||||
echo "${yellow}Branch $new_branch already exists${reset}" && git checkout "$new_branch"
|
||||
fi
|
||||
description: "Starts a new clean branch off of master if it doesn't already exist"
|
||||
arguments:
|
||||
- name: new_branch_name
|
||||
description: Name of the new branch for a task
|
||||
author: Warp Team
|
||||
shells: []
|
||||
Reference in New Issue
Block a user