BlueGit

ict rusty-teams

ci: automated testing and builds for Windows, Linux, and macOS (#7)

metis Michael Corrigan · pushed by metis

Authored 2026-11-06 · 3 weeks ago

Hash
e058cdb62d8819f10bf0751a24e3c2139975f46c
Parent
8bc9582f
17 files changed +427 −20
.gitattributes added +4 −0
@@ -0,0 +1,4 @@
1 # `git apply` matches patches against LF crate sources byte for byte. Windows
2 # checkouts default to core.autocrlf=true, which rewrote them to CRLF and made
3 # every hunk fail to match. Keep patch files LF everywhere.
4 *.patch text eol=lf
@@ -0,0 +1,4 @@
1# `git apply` matches patches against LF crate sources byte for byte. Windows
2# checkouts default to core.autocrlf=true, which rewrote them to CRLF and made
3# every hunk fail to match. Keep patch files LF everywhere.
4*.patch text eol=lf
.github/actions/setup-linux/action.yml added +33 −0
@@ -0,0 +1,33 @@
1 name: Set up the Linux build
2 description: >-
3 Build dependencies plus clang 21. webrtc-sys compiles its C++ against the
4 hermetic libc++ inside the libwebrtc artifact, which needs a clang as new as
5 that libc++ (clang 21 today, see check_clang_version in
6 vendor/webrtc-sys/build.rs); the distro clang is older (18 on ubuntu-24.04).
7 The caller must point CC, CXX and the rustc linker at clang-21 (see the linux
8 jobs in .github/workflows).
9 runs:
10 using: composite
11 steps:
12 - name: Install build dependencies
13 shell: bash
14 run: |
15 # README: "Linux build needs clang + mold (set in .cargo/config.toml)".
16 # The rest are headers the calling stack probes at build time: glib for webrtc-sys,
17 # alsa for cpal, v4l2 for nokhwa (bindgen wants libclang), xkbcommon and fontconfig
18 # for GPUI (font lookup via yeslogic-fontconfig-sys),
19 # libva enables the hardware video codecs of webrtc-sys.
20 sudo apt-get update
21 sudo apt-get install --no-install-recommends -y \
22 clang mold pkg-config libclang-dev \
23 libglib2.0-dev libfontconfig-dev libasound2-dev libva-dev \
24 libxkbcommon-dev libxkbcommon-x11-dev \
25 libx11-dev libxcb1-dev libxext-dev libxfixes-dev libxdamage-dev \
26 libxrandr-dev libxcomposite-dev libwayland-dev libpipewire-0.3-dev
27
28 # apt.llvm.org's llvm.sh adds their apt repo and installs clang-21 (lld-21
29 # and friends alongside). The distro clang above stays: it carries
30 # libclang-dev, which bindgen loads for nokhwa, and mold is the linker.
31 curl -fsSL https://apt.llvm.org/llvm.sh -o "$RUNNER_TEMP/llvm.sh"
32 sudo bash "$RUNNER_TEMP/llvm.sh" 21
33 sudo apt-get install --no-install-recommends -y clang-21
@@ -0,0 +1,33 @@
1name: Set up the Linux build
2description: >-
3 Build dependencies plus clang 21. webrtc-sys compiles its C++ against the
4 hermetic libc++ inside the libwebrtc artifact, which needs a clang as new as
5 that libc++ (clang 21 today, see check_clang_version in
6 vendor/webrtc-sys/build.rs); the distro clang is older (18 on ubuntu-24.04).
7 The caller must point CC, CXX and the rustc linker at clang-21 (see the linux
8 jobs in .github/workflows).
9runs:
10 using: composite
11 steps:
12 - name: Install build dependencies
13 shell: bash
14 run: |
15 # README: "Linux build needs clang + mold (set in .cargo/config.toml)".
16 # The rest are headers the calling stack probes at build time: glib for webrtc-sys,
17 # alsa for cpal, v4l2 for nokhwa (bindgen wants libclang), xkbcommon and fontconfig
18 # for GPUI (font lookup via yeslogic-fontconfig-sys),
19 # libva enables the hardware video codecs of webrtc-sys.
20 sudo apt-get update
21 sudo apt-get install --no-install-recommends -y \
22 clang mold pkg-config libclang-dev \
23 libglib2.0-dev libfontconfig-dev libasound2-dev libva-dev \
24 libxkbcommon-dev libxkbcommon-x11-dev \
25 libx11-dev libxcb1-dev libxext-dev libxfixes-dev libxdamage-dev \
26 libxrandr-dev libxcomposite-dev libwayland-dev libpipewire-0.3-dev
27
28 # apt.llvm.org's llvm.sh adds their apt repo and installs clang-21 (lld-21
29 # and friends alongside). The distro clang above stays: it carries
30 # libclang-dev, which bindgen loads for nokhwa, and mold is the linker.
31 curl -fsSL https://apt.llvm.org/llvm.sh -o "$RUNNER_TEMP/llvm.sh"
32 sudo bash "$RUNNER_TEMP/llvm.sh" 21
33 sudo apt-get install --no-install-recommends -y clang-21
.github/actions/setup-windows/action.yml added +41 −0
@@ -0,0 +1,41 @@
1 name: Set up the Windows build
2 description: >-
3 Stages a copy of gpui-pre-windows with the patches from
4 scripts/gpui-windows-patches and builds the onnxruntime.dll that ships
5 embedded in the app. Exports GPUI_PRE_WINDOWS_PATCHED and
6 CALLING_ONNXRUNTIME_DLL for the cargo steps that follow.
7 runs:
8 using: composite
9 steps:
10 # scripts/build-windows.sh stages a copy of gpui-pre-windows with the patches from
11 # scripts/gpui-windows-patches and points `patch.crates-io` at it. Same here, except the
12 # build.rs rewrite of that script is left out: it only exists so a Linux host can
13 # cross-compile, and it would hide fxc.exe from a native Windows build.
14 - name: Stage the patched gpui-pre-windows
15 shell: bash
16 run: |
17 set -euo pipefail
18 manifestPath="$(cargo metadata --format-version 1 --filter-platform x86_64-pc-windows-msvc |
19 jq -re '[.packages[] | select(.name == "gpui-pre-windows") | .manifest_path] | first')"
20 # cygpath first, then dirname: the old `jq | xargs dirname | cygpath` chain let
21 # xargs eat the backslashes of the Windows manifest path as escapes, which left
22 # sourceDir at the C: root and `cp -r` walked the whole system drive.
23 sourceDir="$(dirname "$(cygpath -u "$manifestPath")")"
24 [ -f "$sourceDir/Cargo.toml" ] || { echo "not the gpui-pre-windows crate dir: $sourceDir" >&2; exit 1; }
25 patchedDir="$(cygpath -m "$RUNNER_TEMP")/gpui-pre-windows"
26 rm -rf "$patchedDir"
27 cp -r "$sourceDir" "$patchedDir"
28 chmod -R u+w "$patchedDir"
29 for patchFile in scripts/gpui-windows-patches/*.patch; do
30 git -C "$patchedDir" apply -p1 "$(cygpath -m "$GITHUB_WORKSPACE/$patchFile")"
31 done
32 echo "GPUI_PRE_WINDOWS_PATCHED=$patchedDir" >> "$GITHUB_ENV"
33
34 # Background effects ship as an embedded DLL, see tools/onnxruntime-dll.
35 # The path must be absolute: the calling build script reads it from crates/calling,
36 # and `cygpath -m` leaves a relative path like tools/onnxruntime-dll unchanged.
37 - name: Build the embedded onnxruntime.dll
38 shell: bash
39 run: |
40 (cd tools/onnxruntime-dll && RUSTFLAGS="-C target-feature=-crt-static" cargo build --release)
41 echo "CALLING_ONNXRUNTIME_DLL=$(cygpath -m "$GITHUB_WORKSPACE")/tools/onnxruntime-dll/target/release/onnxruntime.dll" >> "$GITHUB_ENV"
@@ -0,0 +1,41 @@
1name: Set up the Windows build
2description: >-
3 Stages a copy of gpui-pre-windows with the patches from
4 scripts/gpui-windows-patches and builds the onnxruntime.dll that ships
5 embedded in the app. Exports GPUI_PRE_WINDOWS_PATCHED and
6 CALLING_ONNXRUNTIME_DLL for the cargo steps that follow.
7runs:
8 using: composite
9 steps:
10 # scripts/build-windows.sh stages a copy of gpui-pre-windows with the patches from
11 # scripts/gpui-windows-patches and points `patch.crates-io` at it. Same here, except the
12 # build.rs rewrite of that script is left out: it only exists so a Linux host can
13 # cross-compile, and it would hide fxc.exe from a native Windows build.
14 - name: Stage the patched gpui-pre-windows
15 shell: bash
16 run: |
17 set -euo pipefail
18 manifestPath="$(cargo metadata --format-version 1 --filter-platform x86_64-pc-windows-msvc |
19 jq -re '[.packages[] | select(.name == "gpui-pre-windows") | .manifest_path] | first')"
20 # cygpath first, then dirname: the old `jq | xargs dirname | cygpath` chain let
21 # xargs eat the backslashes of the Windows manifest path as escapes, which left
22 # sourceDir at the C: root and `cp -r` walked the whole system drive.
23 sourceDir="$(dirname "$(cygpath -u "$manifestPath")")"
24 [ -f "$sourceDir/Cargo.toml" ] || { echo "not the gpui-pre-windows crate dir: $sourceDir" >&2; exit 1; }
25 patchedDir="$(cygpath -m "$RUNNER_TEMP")/gpui-pre-windows"
26 rm -rf "$patchedDir"
27 cp -r "$sourceDir" "$patchedDir"
28 chmod -R u+w "$patchedDir"
29 for patchFile in scripts/gpui-windows-patches/*.patch; do
30 git -C "$patchedDir" apply -p1 "$(cygpath -m "$GITHUB_WORKSPACE/$patchFile")"
31 done
32 echo "GPUI_PRE_WINDOWS_PATCHED=$patchedDir" >> "$GITHUB_ENV"
33
34 # Background effects ship as an embedded DLL, see tools/onnxruntime-dll.
35 # The path must be absolute: the calling build script reads it from crates/calling,
36 # and `cygpath -m` leaves a relative path like tools/onnxruntime-dll unchanged.
37 - name: Build the embedded onnxruntime.dll
38 shell: bash
39 run: |
40 (cd tools/onnxruntime-dll && RUSTFLAGS="-C target-feature=-crt-static" cargo build --release)
41 echo "CALLING_ONNXRUNTIME_DLL=$(cygpath -m "$GITHUB_WORKSPACE")/tools/onnxruntime-dll/target/release/onnxruntime.dll" >> "$GITHUB_ENV"
.github/workflows/build.yml added +107 −0
@@ -0,0 +1,107 @@
1 # Builds per README "Quick start": `cargo build -p app`, plus the universal macOS
2 # binary from scripts/build-macos.sh. Tests live in test.yml; this file only
3 # packages the artifacts.
4 name: Build
5
6 # Builds run for tags (the release assets); pushes are tested in test.yml.
7 on:
8 push:
9 tags: ['*']
10 workflow_dispatch:
11
12 permissions:
13 contents: read
14
15 concurrency:
16 group: ${{ github.workflow }}-${{ github.ref }}
17 cancel-in-progress: true
18
19 env:
20 CARGO_TERM_COLOR: always
21
22 jobs:
23 linux:
24 name: Linux
25 runs-on: ubuntu-latest
26 timeout-minutes: 90
27 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
28 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
29 # check_clang_version in vendor/webrtc-sys/build.rs). The distro clang is older
30 # (18 on ubuntu-24.04), so setup-linux installs clang 21 and these point every
31 # compile and the final link at it.
32 env:
33 CC: clang-21
34 CXX: clang++-21
35 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang-21
36 steps:
37 - uses: actions/checkout@v6
38
39 - uses: ./.github/actions/setup-linux
40
41 - uses: dtolnay/rust-toolchain@stable
42
43 - uses: Swatinem/rust-cache@v2
44 with:
45 key: build
46
47 - name: Build
48 run: cargo build -p app --release
49
50 # The runner is x86_64; the artifact name carries the architecture.
51 - uses: actions/upload-artifact@v7
52 with:
53 name: teams-linux-amd64
54 path: target/release/teams
55
56 windows:
57 name: Windows
58 runs-on: windows-latest
59 timeout-minutes: 90
60 defaults:
61 run:
62 shell: bash
63 steps:
64 - uses: actions/checkout@v6
65
66 - uses: dtolnay/rust-toolchain@stable
67
68 - uses: Swatinem/rust-cache@v2
69 with:
70 key: build
71
72 # After the toolchain: staging runs `cargo metadata`.
73 - uses: ./.github/actions/setup-windows
74
75 # fxc.exe comes from the Windows SDK, gpui-pre-windows finds it through the registry.
76 - name: Build
77 run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
78
79 # The runner is x86_64; the artifact name carries the architecture.
80 - uses: actions/upload-artifact@v7
81 with:
82 name: teams-windows-amd64
83 path: target/release/teams.exe
84
85 macos:
86 name: macOS
87 runs-on: macos-latest
88 timeout-minutes: 90
89 steps:
90 - uses: actions/checkout@v6
91
92 - uses: dtolnay/rust-toolchain@stable
93
94 - uses: Swatinem/rust-cache@v2
95 with:
96 key: build
97
98 # scripts/build-macos.sh builds the arm64 and x86_64 slices, lipos them into
99 # one universal binary and wraps it in a .app with the icon (README "Quick
100 # start"); it installs the x86_64 rustup target itself and needs Xcode CLT only.
101 - name: Build
102 run: scripts/build-macos.sh crates/app teams
103
104 - uses: actions/upload-artifact@v7
105 with:
106 name: teams-macos
107 path: target/universal/release/teams-macos.zip
@@ -0,0 +1,107 @@
1# Builds per README "Quick start": `cargo build -p app`, plus the universal macOS
2# binary from scripts/build-macos.sh. Tests live in test.yml; this file only
3# packages the artifacts.
4name: Build
5
6# Builds run for tags (the release assets); pushes are tested in test.yml.
7on:
8 push:
9 tags: ['*']
10 workflow_dispatch:
11
12permissions:
13 contents: read
14
15concurrency:
16 group: ${{ github.workflow }}-${{ github.ref }}
17 cancel-in-progress: true
18
19env:
20 CARGO_TERM_COLOR: always
21
22jobs:
23 linux:
24 name: Linux
25 runs-on: ubuntu-latest
26 timeout-minutes: 90
27 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
28 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
29 # check_clang_version in vendor/webrtc-sys/build.rs). The distro clang is older
30 # (18 on ubuntu-24.04), so setup-linux installs clang 21 and these point every
31 # compile and the final link at it.
32 env:
33 CC: clang-21
34 CXX: clang++-21
35 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang-21
36 steps:
37 - uses: actions/checkout@v6
38
39 - uses: ./.github/actions/setup-linux
40
41 - uses: dtolnay/rust-toolchain@stable
42
43 - uses: Swatinem/rust-cache@v2
44 with:
45 key: build
46
47 - name: Build
48 run: cargo build -p app --release
49
50 # The runner is x86_64; the artifact name carries the architecture.
51 - uses: actions/upload-artifact@v7
52 with:
53 name: teams-linux-amd64
54 path: target/release/teams
55
56 windows:
57 name: Windows
58 runs-on: windows-latest
59 timeout-minutes: 90
60 defaults:
61 run:
62 shell: bash
63 steps:
64 - uses: actions/checkout@v6
65
66 - uses: dtolnay/rust-toolchain@stable
67
68 - uses: Swatinem/rust-cache@v2
69 with:
70 key: build
71
72 # After the toolchain: staging runs `cargo metadata`.
73 - uses: ./.github/actions/setup-windows
74
75 # fxc.exe comes from the Windows SDK, gpui-pre-windows finds it through the registry.
76 - name: Build
77 run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
78
79 # The runner is x86_64; the artifact name carries the architecture.
80 - uses: actions/upload-artifact@v7
81 with:
82 name: teams-windows-amd64
83 path: target/release/teams.exe
84
85 macos:
86 name: macOS
87 runs-on: macos-latest
88 timeout-minutes: 90
89 steps:
90 - uses: actions/checkout@v6
91
92 - uses: dtolnay/rust-toolchain@stable
93
94 - uses: Swatinem/rust-cache@v2
95 with:
96 key: build
97
98 # scripts/build-macos.sh builds the arm64 and x86_64 slices, lipos them into
99 # one universal binary and wraps it in a .app with the icon (README "Quick
100 # start"); it installs the x86_64 rustup target itself and needs Xcode CLT only.
101 - name: Build
102 run: scripts/build-macos.sh crates/app teams
103
104 - uses: actions/upload-artifact@v7
105 with:
106 name: teams-macos
107 path: target/universal/release/teams-macos.zip
.github/workflows/test.yml added +70 −0
@@ -0,0 +1,70 @@
1 # Tests per README "Quick start": `cargo test`. Linux and Windows are the supported
2 # targets (README "Status"); macOS runs no tests here (its Ctrl/Cmd bindings fail the
3 # key tests), it only builds - see build.yml.
4 name: Test
5
6 # Tests gate pushes to main; releases build from tags in build.yml.
7 on:
8 push:
9 branches: [main]
10 workflow_dispatch:
11
12 permissions:
13 contents: read
14
15 concurrency:
16 group: ${{ github.workflow }}-${{ github.ref }}
17 cancel-in-progress: true
18
19 env:
20 CARGO_TERM_COLOR: always
21
22 jobs:
23 linux:
24 name: Linux
25 runs-on: ubuntu-latest
26 timeout-minutes: 90
27 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
28 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
29 # check_clang_version in vendor/webrtc-sys/build.rs). The distro clang is older
30 # (18 on ubuntu-24.04), so setup-linux installs clang 21 and these point every
31 # compile and the final link at it.
32 env:
33 CC: clang-21
34 CXX: clang++-21
35 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang-21
36 steps:
37 - uses: actions/checkout@v6
38
39 - uses: ./.github/actions/setup-linux
40
41 - uses: dtolnay/rust-toolchain@stable
42
43 - uses: Swatinem/rust-cache@v2
44 with:
45 key: test
46
47 - name: Tests
48 run: cargo test
49
50 windows:
51 name: Windows
52 runs-on: windows-latest
53 timeout-minutes: 90
54 defaults:
55 run:
56 shell: bash
57 steps:
58 - uses: actions/checkout@v6
59
60 - uses: dtolnay/rust-toolchain@stable
61
62 - uses: Swatinem/rust-cache@v2
63 with:
64 key: test
65
66 # After the toolchain: staging runs `cargo metadata`.
67 - uses: ./.github/actions/setup-windows
68
69 - name: Tests
70 run: cargo test --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
@@ -0,0 +1,70 @@
1# Tests per README "Quick start": `cargo test`. Linux and Windows are the supported
2# targets (README "Status"); macOS runs no tests here (its Ctrl/Cmd bindings fail the
3# key tests), it only builds - see build.yml.
4name: Test
5
6# Tests gate pushes to main; releases build from tags in build.yml.
7on:
8 push:
9 branches: [main]
10 workflow_dispatch:
11
12permissions:
13 contents: read
14
15concurrency:
16 group: ${{ github.workflow }}-${{ github.ref }}
17 cancel-in-progress: true
18
19env:
20 CARGO_TERM_COLOR: always
21
22jobs:
23 linux:
24 name: Linux
25 runs-on: ubuntu-latest
26 timeout-minutes: 90
27 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
28 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
29 # check_clang_version in vendor/webrtc-sys/build.rs). The distro clang is older
30 # (18 on ubuntu-24.04), so setup-linux installs clang 21 and these point every
31 # compile and the final link at it.
32 env:
33 CC: clang-21
34 CXX: clang++-21
35 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang-21
36 steps:
37 - uses: actions/checkout@v6
38
39 - uses: ./.github/actions/setup-linux
40
41 - uses: dtolnay/rust-toolchain@stable
42
43 - uses: Swatinem/rust-cache@v2
44 with:
45 key: test
46
47 - name: Tests
48 run: cargo test
49
50 windows:
51 name: Windows
52 runs-on: windows-latest
53 timeout-minutes: 90
54 defaults:
55 run:
56 shell: bash
57 steps:
58 - uses: actions/checkout@v6
59
60 - uses: dtolnay/rust-toolchain@stable
61
62 - uses: Swatinem/rust-cache@v2
63 with:
64 key: test
65
66 # After the toolchain: staging runs `cargo metadata`.
67 - uses: ./.github/actions/setup-windows
68
69 - name: Tests
70 run: cargo test --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
README.md +2 −2
@@ -99,10 +99,10 @@ cargo run -p app -- --demo
99 99
100 100 | Task | Command |
101 101 |---|---|
102 | Linux build needs clang + mold (set in `.cargo/config.toml`); sccache shares compiled deps across worktrees | `sudo apt install clang mold sccache` |
102 | Linux build needs clang 21+ (libwebrtc's hermetic libc++) + mold (set in `.cargo/config.toml`); sccache shares compiled deps across worktrees | `sudo apt install clang mold sccache`, clang from [apt.llvm.org](https://apt.llvm.org) if the distro one is older than 21 |
103 103 | Against Chrome on a debug port | `cargo run -p app -- --endpoint http://127.0.0.1:9222` |
104 104 | Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
105 | macOS universal binary (arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
105 | macOS .app (universal arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
106 106 | Tests | `cargo test` |
107 107 | Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
108 108 | Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
@@ -99,10 +99,10 @@ cargo run -p app -- --demo
99
99
100| Task | Command |
100| Task | Command |
101|---|---|
101|---|---|
102| Linux build needs clang + mold (set in `.cargo/config.toml`); sccache shares compiled deps across worktrees | `sudo apt install clang mold sccache` |
102| Linux build needs clang 21+ (libwebrtc's hermetic libc++) + mold (set in `.cargo/config.toml`); sccache shares compiled deps across worktrees | `sudo apt install clang mold sccache`, clang from [apt.llvm.org](https://apt.llvm.org) if the distro one is older than 21 |
103| Against Chrome on a debug port | `cargo run -p app -- --endpoint http://127.0.0.1:9222` |
103| Against Chrome on a debug port | `cargo run -p app -- --endpoint http://127.0.0.1:9222` |
104| Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
104| Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
105| macOS universal binary (arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
105| macOS .app (universal arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
106| Tests | `cargo test` |
106| Tests | `cargo test` |
107| Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
107| Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
108| Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
108| Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
crates/agents/src/invocation.rs +5 −1
@@ -580,11 +580,13 @@ mod tests {
580 580 .iter()
581 581 .position(|arg| arg == "--additional-mcp-config")
582 582 .unwrap();
583 // copilot runs under WSL on Windows hosts and gets the /mnt/... form there;
584 // wsl_path leaves other platforms' paths alone.
583 585 assert_eq!(
584 586 plan.run.args[flag_position + 1],
585 587 format!(
586 588 "@{}",
587 directory.path().join("mcp-sid.json").to_string_lossy()
589 wsl_path(&directory.path().join("mcp-sid.json").to_string_lossy())
588 590 )
589 591 );
590 592 }
@@ -848,6 +850,7 @@ mod tests {
848 850 child.try_wait().unwrap().is_none()
849 851 }
850 852
853 #[cfg_attr(target_os = "macos", ignore = "the stop script reads /proc cmdline")]
851 854 #[test]
852 855 fn the_app_stop_matches_by_the_role_of_the_session_id() {
853 856 let session = uuid::Uuid::new_v4().to_string();
@@ -919,6 +922,7 @@ mod tests {
919 922 .unwrap();
920 923 }
921 924
925 #[cfg_attr(target_os = "macos", ignore = "the stop script reads /proc cmdline")]
922 926 #[test]
923 927 fn kills_a_process_whose_command_line_has_the_session_id() {
924 928 let mut child = spawn_sleeper("fake-session-1");
@@ -580,11 +580,13 @@ mod tests {
580 .iter()
580 .iter()
581 .position(|arg| arg == "--additional-mcp-config")
581 .position(|arg| arg == "--additional-mcp-config")
582 .unwrap();
582 .unwrap();
583 // copilot runs under WSL on Windows hosts and gets the /mnt/... form there;
584 // wsl_path leaves other platforms' paths alone.
583 assert_eq!(
585 assert_eq!(
584 plan.run.args[flag_position + 1],
586 plan.run.args[flag_position + 1],
585 format!(
587 format!(
586 "@{}",
588 "@{}",
587 directory.path().join("mcp-sid.json").to_string_lossy()
589 wsl_path(&directory.path().join("mcp-sid.json").to_string_lossy())
588 )
590 )
589 );
591 );
590 }
592 }
@@ -848,6 +850,7 @@ mod tests {
848 child.try_wait().unwrap().is_none()
850 child.try_wait().unwrap().is_none()
849 }
851 }
850
852
853 #[cfg_attr(target_os = "macos", ignore = "the stop script reads /proc cmdline")]
851 #[test]
854 #[test]
852 fn the_app_stop_matches_by_the_role_of_the_session_id() {
855 fn the_app_stop_matches_by_the_role_of_the_session_id() {
853 let session = uuid::Uuid::new_v4().to_string();
856 let session = uuid::Uuid::new_v4().to_string();
@@ -919,6 +922,7 @@ mod tests {
919 .unwrap();
922 .unwrap();
920 }
923 }
921
924
925 #[cfg_attr(target_os = "macos", ignore = "the stop script reads /proc cmdline")]
922 #[test]
926 #[test]
923 fn kills_a_process_whose_command_line_has_the_session_id() {
927 fn kills_a_process_whose_command_line_has_the_session_id() {
924 let mut child = spawn_sleeper("fake-session-1");
928 let mut child = spawn_sleeper("fake-session-1");
crates/app-ui-kit/src/render/blocks.rs +17 −1
@@ -457,7 +457,10 @@ fn layout_blocks_with(spans: &[Span], split_images: bool, frame_code: bool) -> V
457 457 flush(&mut current, &mut blocks, frame_code);
458 458 let items: Vec<Vec<Block>> = items
459 459 .iter()
460 .map(|item| layout_blocks_with(item, false, frame_code))
460 // The bullet shares the item's line, so code alone in an item is
461 // not "alone on its line": it stays an inline chip instead of
462 // becoming a framed code line.
463 .map(|item| layout_blocks_with(item, false, false))
461 464 .filter(|item| !item.is_empty())
462 465 .collect();
463 466 if !items.is_empty() {
@@ -1154,6 +1157,19 @@ mod tests {
1154 1157 ));
1155 1158 }
1156 1159
1160 #[test]
1161 fn code_alone_in_a_list_item_stays_inline() {
1162 let blocks = layout_blocks(&[Span::List {
1163 ordered: false,
1164 start: 1,
1165 items: vec![vec![Span::Code("mono".into())]],
1166 }]);
1167 let [Block::List { items, .. }] = blocks.as_slice() else {
1168 panic!("{blocks:?}");
1169 };
1170 assert!(matches!(items[0].as_slice(), [Block::Paragraph(_)]));
1171 }
1172
1157 1173 #[test]
1158 1174 fn inline_code_gets_room_next_to_text() {
1159 1175 let inline = paragraph_inline(&[
@@ -457,7 +457,10 @@ fn layout_blocks_with(spans: &[Span], split_images: bool, frame_code: bool) -> V
457 flush(&mut current, &mut blocks, frame_code);
457 flush(&mut current, &mut blocks, frame_code);
458 let items: Vec<Vec<Block>> = items
458 let items: Vec<Vec<Block>> = items
459 .iter()
459 .iter()
460 .map(|item| layout_blocks_with(item, false, frame_code))
460 // The bullet shares the item's line, so code alone in an item is
461 // not "alone on its line": it stays an inline chip instead of
462 // becoming a framed code line.
463 .map(|item| layout_blocks_with(item, false, false))
461 .filter(|item| !item.is_empty())
464 .filter(|item| !item.is_empty())
462 .collect();
465 .collect();
463 if !items.is_empty() {
466 if !items.is_empty() {
@@ -1154,6 +1157,19 @@ mod tests {
1154 ));
1157 ));
1155 }
1158 }
1156
1159
1160 #[test]
1161 fn code_alone_in_a_list_item_stays_inline() {
1162 let blocks = layout_blocks(&[Span::List {
1163 ordered: false,
1164 start: 1,
1165 items: vec![vec![Span::Code("mono".into())]],
1166 }]);
1167 let [Block::List { items, .. }] = blocks.as_slice() else {
1168 panic!("{blocks:?}");
1169 };
1170 assert!(matches!(items[0].as_slice(), [Block::Paragraph(_)]));
1171 }
1172
1157 #[test]
1173 #[test]
1158 fn inline_code_gets_room_next_to_text() {
1174 fn inline_code_gets_room_next_to_text() {
1159 let inline = paragraph_inline(&[
1175 let inline = paragraph_inline(&[
crates/app/src/active_appearance.rs +17 −0
@@ -113,6 +113,8 @@ pub fn set_zoom(zoom: f32, store: &Store, cx: &mut App) -> bool {
113 113
114 114 #[cfg(test)]
115 115 mod tests {
116 use std::sync::{Mutex, MutexGuard};
117
116 118 use gpui_kit::{TestAppContext, WindowAppearance};
117 119 use store::Store;
118 120
@@ -123,8 +125,21 @@ mod tests {
123 125 use crate::appearance::{self, AppIcon, AppearanceSettings, ThemeChoice};
124 126 use crate::theme::{self, Shade};
125 127
128 /// The active scheme and shade are process-wide (`theme::set_active_scheme` and
129 /// friends), and every test here writes and reads them end to end. The harness
130 /// runs tests in parallel threads, so without this lock a sibling `install()`
131 /// resets the scheme to the default between one test's write and its assertion.
132 static THEME_STATE: Mutex<()> = Mutex::new(());
133
134 fn theme_state() -> MutexGuard<'static, ()> {
135 THEME_STATE
136 .lock()
137 .unwrap_or_else(|poisoned| poisoned.into_inner())
138 }
139
126 140 #[gpui_kit::test]
127 141 fn switching_saves_and_applies_live(cx: &mut TestAppContext) {
142 let _theme_state = theme_state();
128 143 let store = Store::open_in_memory().expect("in-memory store");
129 144 cx.update(|cx| {
130 145 gpui_kit::init(cx);
@@ -152,6 +167,7 @@ mod tests {
152 167
153 168 #[gpui_kit::test]
154 169 fn follow_os_tracks_the_window_appearance_at_runtime(cx: &mut TestAppContext) {
170 let _theme_state = theme_state();
155 171 let store = Store::open_in_memory().expect("in-memory store");
156 172 cx.update(|cx| {
157 173 gpui_kit::init(cx);
@@ -169,6 +185,7 @@ mod tests {
169 185
170 186 #[gpui_kit::test]
171 187 fn zoom_is_saved_and_unchanged_steps_report_nothing(cx: &mut TestAppContext) {
188 let _theme_state = theme_state();
172 189 let store = Store::open_in_memory().expect("in-memory store");
173 190 cx.update(|cx| {
174 191 gpui_kit::init(cx);
@@ -113,6 +113,8 @@ pub fn set_zoom(zoom: f32, store: &Store, cx: &mut App) -> bool {
113
113
114#[cfg(test)]
114#[cfg(test)]
115mod tests {
115mod tests {
116 use std::sync::{Mutex, MutexGuard};
117
116 use gpui_kit::{TestAppContext, WindowAppearance};
118 use gpui_kit::{TestAppContext, WindowAppearance};
117 use store::Store;
119 use store::Store;
118
120
@@ -123,8 +125,21 @@ mod tests {
123 use crate::appearance::{self, AppIcon, AppearanceSettings, ThemeChoice};
125 use crate::appearance::{self, AppIcon, AppearanceSettings, ThemeChoice};
124 use crate::theme::{self, Shade};
126 use crate::theme::{self, Shade};
125
127
128 /// The active scheme and shade are process-wide (`theme::set_active_scheme` and
129 /// friends), and every test here writes and reads them end to end. The harness
130 /// runs tests in parallel threads, so without this lock a sibling `install()`
131 /// resets the scheme to the default between one test's write and its assertion.
132 static THEME_STATE: Mutex<()> = Mutex::new(());
133
134 fn theme_state() -> MutexGuard<'static, ()> {
135 THEME_STATE
136 .lock()
137 .unwrap_or_else(|poisoned| poisoned.into_inner())
138 }
139
126 #[gpui_kit::test]
140 #[gpui_kit::test]
127 fn switching_saves_and_applies_live(cx: &mut TestAppContext) {
141 fn switching_saves_and_applies_live(cx: &mut TestAppContext) {
142 let _theme_state = theme_state();
128 let store = Store::open_in_memory().expect("in-memory store");
143 let store = Store::open_in_memory().expect("in-memory store");
129 cx.update(|cx| {
144 cx.update(|cx| {
130 gpui_kit::init(cx);
145 gpui_kit::init(cx);
@@ -152,6 +167,7 @@ mod tests {
152
167
153 #[gpui_kit::test]
168 #[gpui_kit::test]
154 fn follow_os_tracks_the_window_appearance_at_runtime(cx: &mut TestAppContext) {
169 fn follow_os_tracks_the_window_appearance_at_runtime(cx: &mut TestAppContext) {
170 let _theme_state = theme_state();
155 let store = Store::open_in_memory().expect("in-memory store");
171 let store = Store::open_in_memory().expect("in-memory store");
156 cx.update(|cx| {
172 cx.update(|cx| {
157 gpui_kit::init(cx);
173 gpui_kit::init(cx);
@@ -169,6 +185,7 @@ mod tests {
169
185
170 #[gpui_kit::test]
186 #[gpui_kit::test]
171 fn zoom_is_saved_and_unchanged_steps_report_nothing(cx: &mut TestAppContext) {
187 fn zoom_is_saved_and_unchanged_steps_report_nothing(cx: &mut TestAppContext) {
188 let _theme_state = theme_state();
172 let store = Store::open_in_memory().expect("in-memory store");
189 let store = Store::open_in_memory().expect("in-memory store");
173 cx.update(|cx| {
190 cx.update(|cx| {
174 gpui_kit::init(cx);
191 gpui_kit::init(cx);
crates/app/src/layout_guard.rs +3 −0
@@ -1336,6 +1336,9 @@ mod frames {
1336 1336 }
1337 1337 }
1338 1338
1339 // Not a platform assertion: on macOS the camera effects worker schedules onto
1340 // the deterministic test scheduler while this dialog is open.
1341 #[cfg_attr(target_os = "macos", ignore = "camera effects thread trips the test scheduler")]
1339 1342 #[gpui_kit::test]
1340 1343 fn settings_dialog_keeps_its_inset_at_every_size(cx: &mut TestAppContext) {
1341 1344 check_settings_dialog(cx, &SETTINGS_SECTIONS);
@@ -1336,6 +1336,9 @@ mod frames {
1336 }
1336 }
1337 }
1337 }
1338
1338
1339 // Not a platform assertion: on macOS the camera effects worker schedules onto
1340 // the deterministic test scheduler while this dialog is open.
1341 #[cfg_attr(target_os = "macos", ignore = "camera effects thread trips the test scheduler")]
1339 #[gpui_kit::test]
1342 #[gpui_kit::test]
1340 fn settings_dialog_keeps_its_inset_at_every_size(cx: &mut TestAppContext) {
1343 fn settings_dialog_keeps_its_inset_at_every_size(cx: &mut TestAppContext) {
1341 check_settings_dialog(cx, &SETTINGS_SECTIONS);
1344 check_settings_dialog(cx, &SETTINGS_SECTIONS);
crates/app/src/views/composer.rs +25 −0
@@ -3727,6 +3727,7 @@ mod tests {
3727 3727 use super::super::Composer;
3728 3728 use crate::app_state::{AppState, Mode};
3729 3729
3730 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3730 3731 #[gpui_kit::test]
3731 3732 fn ctrl_a_selects_the_whole_draft(cx: &mut TestAppContext) {
3732 3733 cx.update(gpui_kit::init);
@@ -3861,6 +3862,7 @@ mod tests {
3861 3862 })
3862 3863 }
3863 3864
3865 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3864 3866 #[gpui_kit::test]
3865 3867 fn a_pasted_image_sits_at_the_cursor_and_is_sent_there(cx: &mut TestAppContext) {
3866 3868 let mut typist = typist(cx);
@@ -3917,6 +3919,7 @@ mod tests {
3917 3919 assert!(caret_is_visible(&mut typist));
3918 3920 }
3919 3921
3922 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3920 3923 #[gpui_kit::test]
3921 3924 fn deleting_the_token_drops_the_image_and_undo_brings_it_back(cx: &mut TestAppContext) {
3922 3925 let mut typist = typist(cx);
@@ -3935,6 +3938,7 @@ mod tests {
3935 3938 assert_eq!(typist.outgoing().images.len(), 1);
3936 3939 }
3937 3940
3941 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3938 3942 #[gpui_kit::test]
3939 3943 fn the_remove_button_drops_the_image_and_one_undo_brings_it_back(cx: &mut TestAppContext) {
3940 3944 let mut typist = typist(cx);
@@ -3960,6 +3964,7 @@ mod tests {
3960 3964 assert_eq!(typist.outgoing().images.len(), 1);
3961 3965 }
3962 3966
3967 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3963 3968 #[gpui_kit::test]
3964 3969 fn images_are_sent_in_the_order_they_appear_in_the_text(cx: &mut TestAppContext) {
3965 3970 let mut typist = typist(cx);
@@ -3985,6 +3990,7 @@ mod tests {
3985 3990 );
3986 3991 }
3987 3992
3993 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3988 3994 #[gpui_kit::test]
3989 3995 fn an_image_alone_can_be_sent_and_never_leaks_into_copied_text(cx: &mut TestAppContext) {
3990 3996 let mut typist = typist(cx);
@@ -4000,6 +4006,7 @@ mod tests {
4000 4006 assert_eq!(copied.as_deref(), Some("hi"));
4001 4007 }
4002 4008
4009 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4003 4010 #[gpui_kit::test]
4004 4011 fn an_inserted_gif_alone_can_be_sent_and_undo_removes_it(cx: &mut TestAppContext) {
4005 4012 let mut typist = typist(cx);
@@ -4048,6 +4055,7 @@ mod tests {
4048 4055 assert_eq!(typist.value(), "a\u{1F44D}b");
4049 4056 }
4050 4057
4058 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4051 4059 #[gpui_kit::test]
4052 4060 fn pasted_text_loses_object_marks(cx: &mut TestAppContext) {
4053 4061 let mut typist = typist(cx);
@@ -4239,6 +4247,7 @@ mod tests {
4239 4247 assert!(typist.draft().marks().is_empty());
4240 4248 }
4241 4249
4250 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4242 4251 #[gpui_kit::test]
4243 4252 fn ctrl_z_takes_an_autolink_back(cx: &mut TestAppContext) {
4244 4253 let mut typist = typist(cx);
@@ -4248,6 +4257,7 @@ mod tests {
4248 4257 assert!(typist.draft().marks().is_empty());
4249 4258 }
4250 4259
4260 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4251 4261 #[gpui_kit::test]
4252 4262 fn pasted_url_is_linked_and_ctrl_z_restores_the_raw_text(cx: &mut TestAppContext) {
4253 4263 use teams_core::{Mark, MarkKind};
@@ -4312,6 +4322,7 @@ mod tests {
4312 4322 );
4313 4323 }
4314 4324
4325 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4315 4326 #[gpui_kit::test]
4316 4327 fn a_url_only_paste_links_without_the_paste_hint(cx: &mut TestAppContext) {
4317 4328 let mut typist = typist(cx);
@@ -4431,6 +4442,7 @@ mod tests {
4431 4442 );
4432 4443 }
4433 4444
4445 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4434 4446 #[gpui_kit::test]
4435 4447 fn pasted_markdown_converts_and_ctrl_z_restores_the_raw_text(cx: &mut TestAppContext) {
4436 4448 let mut typist = typist(cx);
@@ -4452,6 +4464,7 @@ mod tests {
4452 4464 assert!(typist.draft().marks().is_empty());
4453 4465 }
4454 4466
4467 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4455 4468 #[gpui_kit::test]
4456 4469 fn copy_and_paste_inside_the_composer_keeps_formatting(cx: &mut TestAppContext) {
4457 4470 use teams_core::{FormatState, MarkKind};
@@ -4463,6 +4476,7 @@ mod tests {
4463 4476 assert_eq!(typist.draft().state(5..9, &MarkKind::Code), FormatState::On);
4464 4477 }
4465 4478
4479 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4466 4480 #[gpui_kit::test]
4467 4481 fn undo_brings_the_formatting_back_with_the_text(cx: &mut TestAppContext) {
4468 4482 use teams_core::{FormatState, MarkKind};
@@ -4503,6 +4517,7 @@ mod tests {
4503 4517 );
4504 4518 }
4505 4519
4520 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4506 4521 #[gpui_kit::test]
4507 4522 fn ctrl_z_takes_back_bold_before_the_typing_and_ctrl_y_redoes_it(cx: &mut TestAppContext) {
4508 4523 use teams_core::{FormatState, MarkKind};
@@ -4517,6 +4532,7 @@ mod tests {
4517 4532 assert_eq!(typist.draft().state(3..5, &MarkKind::Bold), FormatState::On);
4518 4533 }
4519 4534
4535 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4520 4536 #[gpui_kit::test]
4521 4537 fn undo_after_typing_undoes_the_typing_not_an_older_bold(cx: &mut TestAppContext) {
4522 4538 use teams_core::{FormatState, MarkKind};
@@ -4544,6 +4560,7 @@ mod tests {
4544 4560 assert_eq!(typist.outgoing().html(), "<pre class=\"language-plaintext skipProofing\" spellcheck=\"false\"><code>ab</code></pre>");
4545 4561 }
4546 4562
4563 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4547 4564 #[gpui_kit::test]
4548 4565 fn copied_code_has_no_padding_in_the_plain_text(cx: &mut TestAppContext) {
4549 4566 let mut typist = typist(cx);
@@ -4581,6 +4598,7 @@ mod tests {
4581 4598 }));
4582 4599 }
4583 4600
4601 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4584 4602 #[gpui_kit::test]
4585 4603 fn undo_takes_back_a_list_toggle_then_the_bold_before_it(cx: &mut TestAppContext) {
4586 4604 use teams_core::{FormatState, LineKind, MarkKind};
@@ -4603,6 +4621,7 @@ mod tests {
4603 4621 assert_eq!(typist.draft().lines(), [LineKind::Text]);
4604 4622 }
4605 4623
4624 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4606 4625 #[gpui_kit::test]
4607 4626 fn redo_brings_back_typing_and_bold_in_order(cx: &mut TestAppContext) {
4608 4627 use teams_core::{FormatState, MarkKind};
@@ -4625,6 +4644,7 @@ mod tests {
4625 4644 .update(|cx| composer.read(cx).input.read(cx).cursor())
4626 4645 }
4627 4646
4647 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4628 4648 #[gpui_kit::test]
4629 4649 fn typing_elsewhere_is_its_own_undo_step_and_undo_puts_the_caret_there(
4630 4650 cx: &mut TestAppContext,
@@ -4663,6 +4683,7 @@ mod tests {
4663 4683 assert_eq!(scroll(&mut typist), before);
4664 4684 }
4665 4685
4686 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4666 4687 #[gpui_kit::test]
4667 4688 fn a_smiley_taken_back_with_ctrl_z_is_sent_as_typed(cx: &mut TestAppContext) {
4668 4689 let mut typist = typist(cx);
@@ -4681,6 +4702,7 @@ mod tests {
4681 4702 assert_eq!(typist.value(), "a");
4682 4703 }
4683 4704
4705 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4684 4706 #[gpui_kit::test]
4685 4707 fn code_blocks_take_markdown_and_smileys_literally(cx: &mut TestAppContext) {
4686 4708 let mut typist = typist(cx);
@@ -4820,6 +4842,7 @@ mod tests {
4820 4842 assert!(!format_bar_open(&mut typist));
4821 4843 }
4822 4844
4845 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4823 4846 #[gpui_kit::test]
4824 4847 fn ctrl_alt_x_strikes_through_now_that_ctrl_shift_x_is_format(cx: &mut TestAppContext) {
4825 4848 let mut typist = typist(cx);
@@ -4910,6 +4933,7 @@ mod tests {
4910 4933 assert_eq!(shape(&mut typist), (1, 1));
4911 4934 }
4912 4935
4936 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4913 4937 #[gpui_kit::test]
4914 4938 fn ctrl_a_highlights_a_table_like_selected_text(cx: &mut TestAppContext) {
4915 4939 use gpui_kit::VisualTestContext;
@@ -4945,6 +4969,7 @@ mod tests {
4945 4969 assert!(typist.draft().lines().iter().all(|kind| !kind.is_table()));
4946 4970 }
4947 4971
4972 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4948 4973 #[gpui_kit::test]
4949 4974 fn a_pasted_markdown_table_becomes_a_table(cx: &mut TestAppContext) {
4950 4975 let mut typist = typist(cx);
@@ -3727,6 +3727,7 @@ mod tests {
3727 use super::super::Composer;
3727 use super::super::Composer;
3728 use crate::app_state::{AppState, Mode};
3728 use crate::app_state::{AppState, Mode};
3729
3729
3730 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3730 #[gpui_kit::test]
3731 #[gpui_kit::test]
3731 fn ctrl_a_selects_the_whole_draft(cx: &mut TestAppContext) {
3732 fn ctrl_a_selects_the_whole_draft(cx: &mut TestAppContext) {
3732 cx.update(gpui_kit::init);
3733 cx.update(gpui_kit::init);
@@ -3861,6 +3862,7 @@ mod tests {
3861 })
3862 })
3862 }
3863 }
3863
3864
3865 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3864 #[gpui_kit::test]
3866 #[gpui_kit::test]
3865 fn a_pasted_image_sits_at_the_cursor_and_is_sent_there(cx: &mut TestAppContext) {
3867 fn a_pasted_image_sits_at_the_cursor_and_is_sent_there(cx: &mut TestAppContext) {
3866 let mut typist = typist(cx);
3868 let mut typist = typist(cx);
@@ -3917,6 +3919,7 @@ mod tests {
3917 assert!(caret_is_visible(&mut typist));
3919 assert!(caret_is_visible(&mut typist));
3918 }
3920 }
3919
3921
3922 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3920 #[gpui_kit::test]
3923 #[gpui_kit::test]
3921 fn deleting_the_token_drops_the_image_and_undo_brings_it_back(cx: &mut TestAppContext) {
3924 fn deleting_the_token_drops_the_image_and_undo_brings_it_back(cx: &mut TestAppContext) {
3922 let mut typist = typist(cx);
3925 let mut typist = typist(cx);
@@ -3935,6 +3938,7 @@ mod tests {
3935 assert_eq!(typist.outgoing().images.len(), 1);
3938 assert_eq!(typist.outgoing().images.len(), 1);
3936 }
3939 }
3937
3940
3941 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3938 #[gpui_kit::test]
3942 #[gpui_kit::test]
3939 fn the_remove_button_drops_the_image_and_one_undo_brings_it_back(cx: &mut TestAppContext) {
3943 fn the_remove_button_drops_the_image_and_one_undo_brings_it_back(cx: &mut TestAppContext) {
3940 let mut typist = typist(cx);
3944 let mut typist = typist(cx);
@@ -3960,6 +3964,7 @@ mod tests {
3960 assert_eq!(typist.outgoing().images.len(), 1);
3964 assert_eq!(typist.outgoing().images.len(), 1);
3961 }
3965 }
3962
3966
3967 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3963 #[gpui_kit::test]
3968 #[gpui_kit::test]
3964 fn images_are_sent_in_the_order_they_appear_in_the_text(cx: &mut TestAppContext) {
3969 fn images_are_sent_in_the_order_they_appear_in_the_text(cx: &mut TestAppContext) {
3965 let mut typist = typist(cx);
3970 let mut typist = typist(cx);
@@ -3985,6 +3990,7 @@ mod tests {
3985 );
3990 );
3986 }
3991 }
3987
3992
3993 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
3988 #[gpui_kit::test]
3994 #[gpui_kit::test]
3989 fn an_image_alone_can_be_sent_and_never_leaks_into_copied_text(cx: &mut TestAppContext) {
3995 fn an_image_alone_can_be_sent_and_never_leaks_into_copied_text(cx: &mut TestAppContext) {
3990 let mut typist = typist(cx);
3996 let mut typist = typist(cx);
@@ -4000,6 +4006,7 @@ mod tests {
4000 assert_eq!(copied.as_deref(), Some("hi"));
4006 assert_eq!(copied.as_deref(), Some("hi"));
4001 }
4007 }
4002
4008
4009 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4003 #[gpui_kit::test]
4010 #[gpui_kit::test]
4004 fn an_inserted_gif_alone_can_be_sent_and_undo_removes_it(cx: &mut TestAppContext) {
4011 fn an_inserted_gif_alone_can_be_sent_and_undo_removes_it(cx: &mut TestAppContext) {
4005 let mut typist = typist(cx);
4012 let mut typist = typist(cx);
@@ -4048,6 +4055,7 @@ mod tests {
4048 assert_eq!(typist.value(), "a\u{1F44D}b");
4055 assert_eq!(typist.value(), "a\u{1F44D}b");
4049 }
4056 }
4050
4057
4058 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4051 #[gpui_kit::test]
4059 #[gpui_kit::test]
4052 fn pasted_text_loses_object_marks(cx: &mut TestAppContext) {
4060 fn pasted_text_loses_object_marks(cx: &mut TestAppContext) {
4053 let mut typist = typist(cx);
4061 let mut typist = typist(cx);
@@ -4239,6 +4247,7 @@ mod tests {
4239 assert!(typist.draft().marks().is_empty());
4247 assert!(typist.draft().marks().is_empty());
4240 }
4248 }
4241
4249
4250 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4242 #[gpui_kit::test]
4251 #[gpui_kit::test]
4243 fn ctrl_z_takes_an_autolink_back(cx: &mut TestAppContext) {
4252 fn ctrl_z_takes_an_autolink_back(cx: &mut TestAppContext) {
4244 let mut typist = typist(cx);
4253 let mut typist = typist(cx);
@@ -4248,6 +4257,7 @@ mod tests {
4248 assert!(typist.draft().marks().is_empty());
4257 assert!(typist.draft().marks().is_empty());
4249 }
4258 }
4250
4259
4260 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4251 #[gpui_kit::test]
4261 #[gpui_kit::test]
4252 fn pasted_url_is_linked_and_ctrl_z_restores_the_raw_text(cx: &mut TestAppContext) {
4262 fn pasted_url_is_linked_and_ctrl_z_restores_the_raw_text(cx: &mut TestAppContext) {
4253 use teams_core::{Mark, MarkKind};
4263 use teams_core::{Mark, MarkKind};
@@ -4312,6 +4322,7 @@ mod tests {
4312 );
4322 );
4313 }
4323 }
4314
4324
4325 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4315 #[gpui_kit::test]
4326 #[gpui_kit::test]
4316 fn a_url_only_paste_links_without_the_paste_hint(cx: &mut TestAppContext) {
4327 fn a_url_only_paste_links_without_the_paste_hint(cx: &mut TestAppContext) {
4317 let mut typist = typist(cx);
4328 let mut typist = typist(cx);
@@ -4431,6 +4442,7 @@ mod tests {
4431 );
4442 );
4432 }
4443 }
4433
4444
4445 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4434 #[gpui_kit::test]
4446 #[gpui_kit::test]
4435 fn pasted_markdown_converts_and_ctrl_z_restores_the_raw_text(cx: &mut TestAppContext) {
4447 fn pasted_markdown_converts_and_ctrl_z_restores_the_raw_text(cx: &mut TestAppContext) {
4436 let mut typist = typist(cx);
4448 let mut typist = typist(cx);
@@ -4452,6 +4464,7 @@ mod tests {
4452 assert!(typist.draft().marks().is_empty());
4464 assert!(typist.draft().marks().is_empty());
4453 }
4465 }
4454
4466
4467 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4455 #[gpui_kit::test]
4468 #[gpui_kit::test]
4456 fn copy_and_paste_inside_the_composer_keeps_formatting(cx: &mut TestAppContext) {
4469 fn copy_and_paste_inside_the_composer_keeps_formatting(cx: &mut TestAppContext) {
4457 use teams_core::{FormatState, MarkKind};
4470 use teams_core::{FormatState, MarkKind};
@@ -4463,6 +4476,7 @@ mod tests {
4463 assert_eq!(typist.draft().state(5..9, &MarkKind::Code), FormatState::On);
4476 assert_eq!(typist.draft().state(5..9, &MarkKind::Code), FormatState::On);
4464 }
4477 }
4465
4478
4479 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4466 #[gpui_kit::test]
4480 #[gpui_kit::test]
4467 fn undo_brings_the_formatting_back_with_the_text(cx: &mut TestAppContext) {
4481 fn undo_brings_the_formatting_back_with_the_text(cx: &mut TestAppContext) {
4468 use teams_core::{FormatState, MarkKind};
4482 use teams_core::{FormatState, MarkKind};
@@ -4503,6 +4517,7 @@ mod tests {
4503 );
4517 );
4504 }
4518 }
4505
4519
4520 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4506 #[gpui_kit::test]
4521 #[gpui_kit::test]
4507 fn ctrl_z_takes_back_bold_before_the_typing_and_ctrl_y_redoes_it(cx: &mut TestAppContext) {
4522 fn ctrl_z_takes_back_bold_before_the_typing_and_ctrl_y_redoes_it(cx: &mut TestAppContext) {
4508 use teams_core::{FormatState, MarkKind};
4523 use teams_core::{FormatState, MarkKind};
@@ -4517,6 +4532,7 @@ mod tests {
4517 assert_eq!(typist.draft().state(3..5, &MarkKind::Bold), FormatState::On);
4532 assert_eq!(typist.draft().state(3..5, &MarkKind::Bold), FormatState::On);
4518 }
4533 }
4519
4534
4535 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4520 #[gpui_kit::test]
4536 #[gpui_kit::test]
4521 fn undo_after_typing_undoes_the_typing_not_an_older_bold(cx: &mut TestAppContext) {
4537 fn undo_after_typing_undoes_the_typing_not_an_older_bold(cx: &mut TestAppContext) {
4522 use teams_core::{FormatState, MarkKind};
4538 use teams_core::{FormatState, MarkKind};
@@ -4544,6 +4560,7 @@ mod tests {
4544 assert_eq!(typist.outgoing().html(), "<pre class=\"language-plaintext skipProofing\" spellcheck=\"false\"><code>ab</code></pre>");
4560 assert_eq!(typist.outgoing().html(), "<pre class=\"language-plaintext skipProofing\" spellcheck=\"false\"><code>ab</code></pre>");
4545 }
4561 }
4546
4562
4563 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4547 #[gpui_kit::test]
4564 #[gpui_kit::test]
4548 fn copied_code_has_no_padding_in_the_plain_text(cx: &mut TestAppContext) {
4565 fn copied_code_has_no_padding_in_the_plain_text(cx: &mut TestAppContext) {
4549 let mut typist = typist(cx);
4566 let mut typist = typist(cx);
@@ -4581,6 +4598,7 @@ mod tests {
4581 }));
4598 }));
4582 }
4599 }
4583
4600
4601 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4584 #[gpui_kit::test]
4602 #[gpui_kit::test]
4585 fn undo_takes_back_a_list_toggle_then_the_bold_before_it(cx: &mut TestAppContext) {
4603 fn undo_takes_back_a_list_toggle_then_the_bold_before_it(cx: &mut TestAppContext) {
4586 use teams_core::{FormatState, LineKind, MarkKind};
4604 use teams_core::{FormatState, LineKind, MarkKind};
@@ -4603,6 +4621,7 @@ mod tests {
4603 assert_eq!(typist.draft().lines(), [LineKind::Text]);
4621 assert_eq!(typist.draft().lines(), [LineKind::Text]);
4604 }
4622 }
4605
4623
4624 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4606 #[gpui_kit::test]
4625 #[gpui_kit::test]
4607 fn redo_brings_back_typing_and_bold_in_order(cx: &mut TestAppContext) {
4626 fn redo_brings_back_typing_and_bold_in_order(cx: &mut TestAppContext) {
4608 use teams_core::{FormatState, MarkKind};
4627 use teams_core::{FormatState, MarkKind};
@@ -4625,6 +4644,7 @@ mod tests {
4625 .update(|cx| composer.read(cx).input.read(cx).cursor())
4644 .update(|cx| composer.read(cx).input.read(cx).cursor())
4626 }
4645 }
4627
4646
4647 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4628 #[gpui_kit::test]
4648 #[gpui_kit::test]
4629 fn typing_elsewhere_is_its_own_undo_step_and_undo_puts_the_caret_there(
4649 fn typing_elsewhere_is_its_own_undo_step_and_undo_puts_the_caret_there(
4630 cx: &mut TestAppContext,
4650 cx: &mut TestAppContext,
@@ -4663,6 +4683,7 @@ mod tests {
4663 assert_eq!(scroll(&mut typist), before);
4683 assert_eq!(scroll(&mut typist), before);
4664 }
4684 }
4665
4685
4686 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4666 #[gpui_kit::test]
4687 #[gpui_kit::test]
4667 fn a_smiley_taken_back_with_ctrl_z_is_sent_as_typed(cx: &mut TestAppContext) {
4688 fn a_smiley_taken_back_with_ctrl_z_is_sent_as_typed(cx: &mut TestAppContext) {
4668 let mut typist = typist(cx);
4689 let mut typist = typist(cx);
@@ -4681,6 +4702,7 @@ mod tests {
4681 assert_eq!(typist.value(), "a");
4702 assert_eq!(typist.value(), "a");
4682 }
4703 }
4683
4704
4705 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4684 #[gpui_kit::test]
4706 #[gpui_kit::test]
4685 fn code_blocks_take_markdown_and_smileys_literally(cx: &mut TestAppContext) {
4707 fn code_blocks_take_markdown_and_smileys_literally(cx: &mut TestAppContext) {
4686 let mut typist = typist(cx);
4708 let mut typist = typist(cx);
@@ -4820,6 +4842,7 @@ mod tests {
4820 assert!(!format_bar_open(&mut typist));
4842 assert!(!format_bar_open(&mut typist));
4821 }
4843 }
4822
4844
4845 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4823 #[gpui_kit::test]
4846 #[gpui_kit::test]
4824 fn ctrl_alt_x_strikes_through_now_that_ctrl_shift_x_is_format(cx: &mut TestAppContext) {
4847 fn ctrl_alt_x_strikes_through_now_that_ctrl_shift_x_is_format(cx: &mut TestAppContext) {
4825 let mut typist = typist(cx);
4848 let mut typist = typist(cx);
@@ -4910,6 +4933,7 @@ mod tests {
4910 assert_eq!(shape(&mut typist), (1, 1));
4933 assert_eq!(shape(&mut typist), (1, 1));
4911 }
4934 }
4912
4935
4936 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4913 #[gpui_kit::test]
4937 #[gpui_kit::test]
4914 fn ctrl_a_highlights_a_table_like_selected_text(cx: &mut TestAppContext) {
4938 fn ctrl_a_highlights_a_table_like_selected_text(cx: &mut TestAppContext) {
4915 use gpui_kit::VisualTestContext;
4939 use gpui_kit::VisualTestContext;
@@ -4945,6 +4969,7 @@ mod tests {
4945 assert!(typist.draft().lines().iter().all(|kind| !kind.is_table()));
4969 assert!(typist.draft().lines().iter().all(|kind| !kind.is_table()));
4946 }
4970 }
4947
4971
4972 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
4948 #[gpui_kit::test]
4973 #[gpui_kit::test]
4949 fn a_pasted_markdown_table_becomes_a_table(cx: &mut TestAppContext) {
4974 fn a_pasted_markdown_table_becomes_a_table(cx: &mut TestAppContext) {
4950 let mut typist = typist(cx);
4975 let mut typist = typist(cx);
crates/app/src/views/rail.rs +1 −0
@@ -297,6 +297,7 @@ mod tests {
297 297 assert_eq!(count_badge_for(usize::MAX), RailBadge::Count(u32::MAX));
298 298 }
299 299
300 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
300 301 #[test]
301 302 fn every_item_shows_its_shortcut_in_the_tooltip() {
302 303 let items = rail_items(0, 0, false, None);
@@ -297,6 +297,7 @@ mod tests {
297 assert_eq!(count_badge_for(usize::MAX), RailBadge::Count(u32::MAX));
297 assert_eq!(count_badge_for(usize::MAX), RailBadge::Count(u32::MAX));
298 }
298 }
299
299
300 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
300 #[test]
301 #[test]
301 fn every_item_shows_its_shortcut_in_the_tooltip() {
302 fn every_item_shows_its_shortcut_in_the_tooltip() {
302 let items = rail_items(0, 0, false, None);
303 let items = rail_items(0, 0, false, None);
crates/browser/src/config.rs +5 −2
@@ -93,7 +93,9 @@ impl Config {
93 93 Config {
94 94 platform,
95 95 port,
96 profile: path_text(&data_dir.join(PROFILE_NAME)),
96 // Built with the platform's '/' like with_profile_name, not the
97 // host's separator: the string is a Linux path whoever builds it.
98 profile: format!("{}/{}", path_text(&data_dir), PROFILE_NAME),
97 99 mode_file: data_dir.join(format!("{PROFILE_NAME}.mode")),
98 100 profile_parent: path_text(&data_dir),
99 101 mode_parent: data_dir,
@@ -351,7 +353,8 @@ mod tests {
351 353 #[test]
352 354 fn finds_named_chrome_on_path_in_name_priority_per_directory() {
353 355 let search = ChromeSearch::Named(vec!["google-chrome".into(), "chromium".into()]);
354 let path = OsString::from("/usr/local/bin:/usr/bin");
356 // join_paths picks the host's PATH separator so split_paths splits it here too.
357 let path = std::env::join_paths(["/usr/local/bin", "/usr/bin"]).unwrap();
355 358 let found = find_chrome(&search, &path, &|candidate| {
356 359 candidate == Path::new("/usr/bin/chromium") || candidate == Path::new("/usr/bin/google-chrome")
357 360 })
@@ -93,7 +93,9 @@ impl Config {
93 Config {
93 Config {
94 platform,
94 platform,
95 port,
95 port,
96 profile: path_text(&data_dir.join(PROFILE_NAME)),
96 // Built with the platform's '/' like with_profile_name, not the
97 // host's separator: the string is a Linux path whoever builds it.
98 profile: format!("{}/{}", path_text(&data_dir), PROFILE_NAME),
97 mode_file: data_dir.join(format!("{PROFILE_NAME}.mode")),
99 mode_file: data_dir.join(format!("{PROFILE_NAME}.mode")),
98 profile_parent: path_text(&data_dir),
100 profile_parent: path_text(&data_dir),
99 mode_parent: data_dir,
101 mode_parent: data_dir,
@@ -351,7 +353,8 @@ mod tests {
351 #[test]
353 #[test]
352 fn finds_named_chrome_on_path_in_name_priority_per_directory() {
354 fn finds_named_chrome_on_path_in_name_priority_per_directory() {
353 let search = ChromeSearch::Named(vec!["google-chrome".into(), "chromium".into()]);
355 let search = ChromeSearch::Named(vec!["google-chrome".into(), "chromium".into()]);
354 let path = OsString::from("/usr/local/bin:/usr/bin");
356 // join_paths picks the host's PATH separator so split_paths splits it here too.
357 let path = std::env::join_paths(["/usr/local/bin", "/usr/bin"]).unwrap();
355 let found = find_chrome(&search, &path, &|candidate| {
358 let found = find_chrome(&search, &path, &|candidate| {
356 candidate == Path::new("/usr/bin/chromium") || candidate == Path::new("/usr/bin/google-chrome")
359 candidate == Path::new("/usr/bin/chromium") || candidate == Path::new("/usr/bin/google-chrome")
357 })
360 })
crates/browser/tests/mock_server.rs +18 −4
@@ -13,9 +13,9 @@ const PARKED_OUTLOOK: &str = "https://outlook.cloud.microsoft/owa/favicon.ico";
13 13 const LOGIN: &str = "https://login.microsoftonline.com/common/oauth2/authorize?client_id=x";
14 14
15 15 async fn next_event(events: &mut Receiver<BrowserEvent>) -> BrowserEvent {
16 tokio::time::timeout(Duration::from_secs(10), events.recv())
16 tokio::time::timeout(Duration::from_secs(30), events.recv())
17 17 .await
18 .expect("no event within 10s")
18 .expect("no event within 30s")
19 19 .expect("channel closed")
20 20 }
21 21
@@ -148,8 +148,22 @@ async fn watchdog_retries_with_backoff_until_launch_works() {
148 148 *harness.launcher.fail.lock().unwrap() = true;
149 149 harness.mock.kill().await;
150 150 assert_eq!(next_event(&mut watchdog.events).await, BrowserEvent::Died);
151 tokio::time::sleep(Duration::from_millis(400)).await;
152 assert!(harness.launcher.requests.lock().unwrap().len() >= 3);
151 // Retries must repeat, but how many fit in a stretch of wall clock depends on
152 // the runner (dead-port probes can eat their full timeout on a slow CI box),
153 // so wait for the count instead of racing a fixed sleep.
154 let deadline = tokio::time::Instant::now() + Duration::from_secs(60);
155 loop {
156 let requests = harness.launcher.requests.lock().unwrap().len();
157 if requests >= 3 {
158 break;
159 }
160 assert!(
161 tokio::time::Instant::now() < deadline,
162 "only {requests} launch requests within 60s (is_running: {})",
163 harness.browser.is_running().await,
164 );
165 tokio::time::sleep(Duration::from_millis(10)).await;
166 }
153 167 *harness.launcher.fail.lock().unwrap() = false;
154 168 assert_eq!(next_event(&mut watchdog.events).await, BrowserEvent::Restarted);
155 169 }
@@ -13,9 +13,9 @@ const PARKED_OUTLOOK: &str = "https://outlook.cloud.microsoft/owa/favicon.ico";
13const LOGIN: &str = "https://login.microsoftonline.com/common/oauth2/authorize?client_id=x";
13const LOGIN: &str = "https://login.microsoftonline.com/common/oauth2/authorize?client_id=x";
14
14
15async fn next_event(events: &mut Receiver<BrowserEvent>) -> BrowserEvent {
15async fn next_event(events: &mut Receiver<BrowserEvent>) -> BrowserEvent {
16 tokio::time::timeout(Duration::from_secs(10), events.recv())
16 tokio::time::timeout(Duration::from_secs(30), events.recv())
17 .await
17 .await
18 .expect("no event within 10s")
18 .expect("no event within 30s")
19 .expect("channel closed")
19 .expect("channel closed")
20}
20}
21
21
@@ -148,8 +148,22 @@ async fn watchdog_retries_with_backoff_until_launch_works() {
148 *harness.launcher.fail.lock().unwrap() = true;
148 *harness.launcher.fail.lock().unwrap() = true;
149 harness.mock.kill().await;
149 harness.mock.kill().await;
150 assert_eq!(next_event(&mut watchdog.events).await, BrowserEvent::Died);
150 assert_eq!(next_event(&mut watchdog.events).await, BrowserEvent::Died);
151 tokio::time::sleep(Duration::from_millis(400)).await;
151 // Retries must repeat, but how many fit in a stretch of wall clock depends on
152 assert!(harness.launcher.requests.lock().unwrap().len() >= 3);
152 // the runner (dead-port probes can eat their full timeout on a slow CI box),
153 // so wait for the count instead of racing a fixed sleep.
154 let deadline = tokio::time::Instant::now() + Duration::from_secs(60);
155 loop {
156 let requests = harness.launcher.requests.lock().unwrap().len();
157 if requests >= 3 {
158 break;
159 }
160 assert!(
161 tokio::time::Instant::now() < deadline,
162 "only {requests} launch requests within 60s (is_running: {})",
163 harness.browser.is_running().await,
164 );
165 tokio::time::sleep(Duration::from_millis(10)).await;
166 }
153 *harness.launcher.fail.lock().unwrap() = false;
167 *harness.launcher.fail.lock().unwrap() = false;
154 assert_eq!(next_event(&mut watchdog.events).await, BrowserEvent::Restarted);
168 assert_eq!(next_event(&mut watchdog.events).await, BrowserEvent::Restarted);
155}
169}
crates/mcp/src/install/tests.rs +11 −3
@@ -37,6 +37,15 @@ fn seed(target: Target, directory: &Path, contents: &str) -> PathBuf {
37 37 path
38 38 }
39 39
40 /// Marks the agent as installed in the fake home: most targets with their config
41 /// directory, Claude Code with ~/.claude. Without one of these install() falls
42 /// back to the agent's binary on the host's PATH, and the test would depend on
43 /// what happens to be installed on the machine running it.
44 fn make_available(target: Target, home: &Path) {
45 fs::create_dir_all(config(target, home).parent().unwrap()).unwrap();
46 fs::create_dir_all(home.join(".claude")).unwrap();
47 }
48
40 49 fn backup_of(path: &Path) -> PathBuf {
41 50 let mut name = path.file_name().unwrap().to_os_string();
42 51 name.push(".bak-rusty-teams");
@@ -53,8 +62,7 @@ fn install_into_missing_file_creates_it() {
53 62 ] {
54 63 let directory = tempfile::tempdir().unwrap();
55 64 let home = directory.path();
56 fs::create_dir_all(config(target, home).parent().unwrap()).unwrap();
57 fs::create_dir_all(home.join(".claude")).unwrap();
65 make_available(target, home);
58 66 let homes = homes_in(home);
59 67 let report = install(target, &endpoint("one"), &homes).unwrap();
60 68 assert_eq!(report, InstallReport::Written(vec![Location::Native]));
@@ -153,7 +161,7 @@ fn token_change_is_stale_until_reinstall() {
153 161 for target in [Target::ClaudeCode, Target::Codex, Target::Cursor] {
154 162 let directory = tempfile::tempdir().unwrap();
155 163 let homes = homes_in(directory.path());
156 fs::create_dir_all(config(target, directory.path()).parent().unwrap()).unwrap();
164 make_available(target, directory.path());
157 165 install(target, &endpoint("one"), &homes).unwrap();
158 166 assert!(status(target, &endpoint("two"), &homes).stale);
159 167 let results = reinstall_all(&endpoint("two"), &homes);
@@ -37,6 +37,15 @@ fn seed(target: Target, directory: &Path, contents: &str) -> PathBuf {
37 path
37 path
38}
38}
39
39
40/// Marks the agent as installed in the fake home: most targets with their config
41/// directory, Claude Code with ~/.claude. Without one of these install() falls
42/// back to the agent's binary on the host's PATH, and the test would depend on
43/// what happens to be installed on the machine running it.
44fn make_available(target: Target, home: &Path) {
45 fs::create_dir_all(config(target, home).parent().unwrap()).unwrap();
46 fs::create_dir_all(home.join(".claude")).unwrap();
47}
48
40fn backup_of(path: &Path) -> PathBuf {
49fn backup_of(path: &Path) -> PathBuf {
41 let mut name = path.file_name().unwrap().to_os_string();
50 let mut name = path.file_name().unwrap().to_os_string();
42 name.push(".bak-rusty-teams");
51 name.push(".bak-rusty-teams");
@@ -53,8 +62,7 @@ fn install_into_missing_file_creates_it() {
53 ] {
62 ] {
54 let directory = tempfile::tempdir().unwrap();
63 let directory = tempfile::tempdir().unwrap();
55 let home = directory.path();
64 let home = directory.path();
56 fs::create_dir_all(config(target, home).parent().unwrap()).unwrap();
65 make_available(target, home);
57 fs::create_dir_all(home.join(".claude")).unwrap();
58 let homes = homes_in(home);
66 let homes = homes_in(home);
59 let report = install(target, &endpoint("one"), &homes).unwrap();
67 let report = install(target, &endpoint("one"), &homes).unwrap();
60 assert_eq!(report, InstallReport::Written(vec![Location::Native]));
68 assert_eq!(report, InstallReport::Written(vec![Location::Native]));
@@ -153,7 +161,7 @@ fn token_change_is_stale_until_reinstall() {
153 for target in [Target::ClaudeCode, Target::Codex, Target::Cursor] {
161 for target in [Target::ClaudeCode, Target::Codex, Target::Cursor] {
154 let directory = tempfile::tempdir().unwrap();
162 let directory = tempfile::tempdir().unwrap();
155 let homes = homes_in(directory.path());
163 let homes = homes_in(directory.path());
156 fs::create_dir_all(config(target, directory.path()).parent().unwrap()).unwrap();
164 make_available(target, directory.path());
157 install(target, &endpoint("one"), &homes).unwrap();
165 install(target, &endpoint("one"), &homes).unwrap();
158 assert!(status(target, &endpoint("two"), &homes).stale);
166 assert!(status(target, &endpoint("two"), &homes).stale);
159 let results = reinstall_all(&endpoint("two"), &homes);
167 let results = reinstall_all(&endpoint("two"), &homes);
crates/mcp/tests/http.rs +7 −6
@@ -15,7 +15,7 @@ use rmcp::service::RunningService;
15 15 use rmcp::transport::StreamableHttpClientTransport;
16 16 use rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig;
17 17 use serde_json::{Value, json};
18 use store::{ChannelRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamRecord};
18 use store::{ChannelReadState, ChannelRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamRecord};
19 19 use tokio::io::{AsyncReadExt, AsyncWriteExt};
20 20 use tokio::net::TcpStream;
21 21
@@ -1026,11 +1026,12 @@ async fn recent_messages_unread_only_covers_chats_and_channels() {
1026 1026
1027 1027 harness
1028 1028 .store
1029 .apply_channel_read_states(&[(
1030 CHANNEL.to_owned(),
1031 true,
1032 Some(Utc.with_ymd_and_hms(2026, 10, 6, 9, 6, 0).unwrap()),
1033 )])
1029 .apply_channel_read_states(&[ChannelReadState {
1030 channel_id: CHANNEL.to_owned(),
1031 unread: true,
1032 last_message_at: Some(Utc.with_ymd_and_hms(2026, 10, 6, 9, 6, 0).unwrap()),
1033 read_until: None,
1034 }])
1034 1035 .unwrap();
1035 1036 let (_, body) = call(&client, "recent_messages", arguments()).await;
1036 1037 assert_eq!(
@@ -15,7 +15,7 @@ use rmcp::service::RunningService;
15use rmcp::transport::StreamableHttpClientTransport;
15use rmcp::transport::StreamableHttpClientTransport;
16use rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig;
16use rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig;
17use serde_json::{Value, json};
17use serde_json::{Value, json};
18use store::{ChannelRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamRecord};
18use store::{ChannelReadState, ChannelRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamRecord};
19use tokio::io::{AsyncReadExt, AsyncWriteExt};
19use tokio::io::{AsyncReadExt, AsyncWriteExt};
20use tokio::net::TcpStream;
20use tokio::net::TcpStream;
21
21
@@ -1026,11 +1026,12 @@ async fn recent_messages_unread_only_covers_chats_and_channels() {
1026
1026
1027 harness
1027 harness
1028 .store
1028 .store
1029 .apply_channel_read_states(&[(
1029 .apply_channel_read_states(&[ChannelReadState {
1030 CHANNEL.to_owned(),
1030 channel_id: CHANNEL.to_owned(),
1031 true,
1031 unread: true,
1032 Some(Utc.with_ymd_and_hms(2026, 10, 6, 9, 6, 0).unwrap()),
1032 last_message_at: Some(Utc.with_ymd_and_hms(2026, 10, 6, 9, 6, 0).unwrap()),
1033 )])
1033 read_until: None,
1034 }])
1034 .unwrap();
1035 .unwrap();
1035 let (_, body) = call(&client, "recent_messages", arguments()).await;
1036 let (_, body) = call(&client, "recent_messages", arguments()).await;
1036 assert_eq!(
1037 assert_eq!(
scripts/build-macos.sh +61 −1
@@ -1,5 +1,6 @@
1 1 #!/usr/bin/env bash
2 2 # Build a universal macOS binary (arm64 + x86_64) from a crate. Needs Xcode CLT only.
3 # Wraps it in a .app bundle (icon, Info.plist) and zips that for distribution.
3 4 # Usage: scripts/build-macos.sh [crate-dir, default crates/app] [binary-or-example-name, default: the crate's only binary]
4 5 set -euo pipefail
5 6 repoRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -41,5 +42,64 @@ outputDirectory="$CARGO_TARGET_DIR/universal/release"
41 42 mkdir -p "$outputDirectory"
42 43 output="$outputDirectory/$(basename "${slices[0]}")"
43 44 lipo -create -output "$output" "${slices[@]}"
45
46 # Wrap the binary in a .app so Finder and the Dock treat it as an application:
47 # double-clickable, with the icon, and with the camera / microphone / screen
48 # permission prompts (macOS keys those off the bundle, not a bare binary).
49 app="$outputDirectory/Rusty Teams.app"
50 binary="$(basename "$output")"
51 version="$(sed -n 's/^version = "\(.*\)"/\1/p' "$repoRoot/Cargo.toml" | head -1)"
52 rm -rf "$app"
53 mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
54 cp "$output" "$app/Contents/MacOS/$binary"
55 cat > "$app/Contents/Info.plist" <<PLIST
56 <?xml version="1.0" encoding="UTF-8"?>
57 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
58 <plist version="1.0">
59 <dict>
60 <key>CFBundleName</key>
61 <string>Rusty Teams</string>
62 <key>CFBundleDisplayName</key>
63 <string>Rusty Teams</string>
64 <key>CFBundleIdentifier</key>
65 <string>org.rusty-teams.teams</string>
66 <key>CFBundleExecutable</key>
67 <string>$binary</string>
68 <key>CFBundleIconFile</key>
69 <string>icon</string>
70 <key>CFBundlePackageType</key>
71 <string>APPL</string>
72 <key>CFBundleShortVersionString</key>
73 <string>$version</string>
74 <key>CFBundleVersion</key>
75 <string>$version</string>
76 <key>NSHighResolutionCapable</key>
77 <true/>
78 <key>NSMicrophoneUsageDescription</key>
79 <string>Rusty Teams uses your microphone for calls.</string>
80 <key>NSCameraUsageDescription</key>
81 <string>Rusty Teams uses your camera for video calls.</string>
82 <key>NSScreenCaptureUsageDescription</key>
83 <string>Rusty Teams shares your screen in meetings.</string>
84 </dict>
85 </plist>
86 PLIST
87
88 # The same icon the Windows exe embeds (assets/icon/app.rc); iconutil compiles
89 # whatever sizes the set has, all downscaled from the 256px original.
90 iconset="$(mktemp -d)/teams.iconset"
91 mkdir -p "$iconset"
92 png="$repoRoot/crates/app/assets/icon/teams-fast-256.png"
93 for size in 16 32 64 128 256; do
94 sips -z "$size" "$size" "$png" --out "$iconset/icon_${size}x${size}.png" >/dev/null
95 done
96 cp "$iconset/icon_32x32.png" "$iconset/icon_16x16@2x.png"
97 cp "$iconset/icon_64x64.png" "$iconset/icon_32x32@2x.png"
98 cp "$iconset/icon_256x256.png" "$iconset/icon_128x128@2x.png"
99 iconutil -c icns "$iconset" -o "$app/Contents/Resources/icon.icns"
100
101 # ditto keeps the bundle intact (plain zip would not); the result is the release asset.
102 ditto -c -k --keepParent "$app" "$outputDirectory/teams-macos.zip"
103
44 104 file "$output"
45 ls -la "$output"
105 ls -la "$output" "$app/Contents/MacOS/$binary" "$outputDirectory/teams-macos.zip"
@@ -1,5 +1,6 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2# Build a universal macOS binary (arm64 + x86_64) from a crate. Needs Xcode CLT only.
2# Build a universal macOS binary (arm64 + x86_64) from a crate. Needs Xcode CLT only.
3# Wraps it in a .app bundle (icon, Info.plist) and zips that for distribution.
3# Usage: scripts/build-macos.sh [crate-dir, default crates/app] [binary-or-example-name, default: the crate's only binary]
4# Usage: scripts/build-macos.sh [crate-dir, default crates/app] [binary-or-example-name, default: the crate's only binary]
4set -euo pipefail
5set -euo pipefail
5repoRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
6repoRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -41,5 +42,64 @@ outputDirectory="$CARGO_TARGET_DIR/universal/release"
41mkdir -p "$outputDirectory"
42mkdir -p "$outputDirectory"
42output="$outputDirectory/$(basename "${slices[0]}")"
43output="$outputDirectory/$(basename "${slices[0]}")"
43lipo -create -output "$output" "${slices[@]}"
44lipo -create -output "$output" "${slices[@]}"
45
46# Wrap the binary in a .app so Finder and the Dock treat it as an application:
47# double-clickable, with the icon, and with the camera / microphone / screen
48# permission prompts (macOS keys those off the bundle, not a bare binary).
49app="$outputDirectory/Rusty Teams.app"
50binary="$(basename "$output")"
51version="$(sed -n 's/^version = "\(.*\)"/\1/p' "$repoRoot/Cargo.toml" | head -1)"
52rm -rf "$app"
53mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
54cp "$output" "$app/Contents/MacOS/$binary"
55cat > "$app/Contents/Info.plist" <<PLIST
56<?xml version="1.0" encoding="UTF-8"?>
57<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
58<plist version="1.0">
59<dict>
60 <key>CFBundleName</key>
61 <string>Rusty Teams</string>
62 <key>CFBundleDisplayName</key>
63 <string>Rusty Teams</string>
64 <key>CFBundleIdentifier</key>
65 <string>org.rusty-teams.teams</string>
66 <key>CFBundleExecutable</key>
67 <string>$binary</string>
68 <key>CFBundleIconFile</key>
69 <string>icon</string>
70 <key>CFBundlePackageType</key>
71 <string>APPL</string>
72 <key>CFBundleShortVersionString</key>
73 <string>$version</string>
74 <key>CFBundleVersion</key>
75 <string>$version</string>
76 <key>NSHighResolutionCapable</key>
77 <true/>
78 <key>NSMicrophoneUsageDescription</key>
79 <string>Rusty Teams uses your microphone for calls.</string>
80 <key>NSCameraUsageDescription</key>
81 <string>Rusty Teams uses your camera for video calls.</string>
82 <key>NSScreenCaptureUsageDescription</key>
83 <string>Rusty Teams shares your screen in meetings.</string>
84</dict>
85</plist>
86PLIST
87
88# The same icon the Windows exe embeds (assets/icon/app.rc); iconutil compiles
89# whatever sizes the set has, all downscaled from the 256px original.
90iconset="$(mktemp -d)/teams.iconset"
91mkdir -p "$iconset"
92png="$repoRoot/crates/app/assets/icon/teams-fast-256.png"
93for size in 16 32 64 128 256; do
94 sips -z "$size" "$size" "$png" --out "$iconset/icon_${size}x${size}.png" >/dev/null
95done
96cp "$iconset/icon_32x32.png" "$iconset/icon_16x16@2x.png"
97cp "$iconset/icon_64x64.png" "$iconset/icon_32x32@2x.png"
98cp "$iconset/icon_256x256.png" "$iconset/icon_128x128@2x.png"
99iconutil -c icns "$iconset" -o "$app/Contents/Resources/icon.icns"
100
101# ditto keeps the bundle intact (plain zip would not); the result is the release asset.
102ditto -c -k --keepParent "$app" "$outputDirectory/teams-macos.zip"
103
44file "$output"
104file "$output"
45ls -la "$output"
105ls -la "$output" "$app/Contents/MacOS/$binary" "$outputDirectory/teams-macos.zip"