diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml new file mode 100644 index 0000000000..35529306d0 --- /dev/null +++ b/.github/workflows/e2e-test.yml @@ -0,0 +1,74 @@ +name: E2E Tests + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + inputs: + branch: + description: "Branch to test" + required: false + default: "" + type: string + +jobs: + check-fork: + runs-on: ubuntu-latest + if: github.actor != 'dependabot[bot]' && (github.event_name == 'workflow_dispatch' || github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) + steps: + - run: echo "Not a fork PR - proceeding with e2e tests" + + changes: + runs-on: ubuntu-latest + needs: check-fork + outputs: + code: ${{ steps.filter.outputs.code }} + steps: + - name: Checkout Code + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || github.ref }} + + - name: Check for code changes + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # pin@v3 + id: filter + with: + filters: | + code: + - '!documentation/**' + + e2e-tests: + name: Desktop E2E Tests + runs-on: macos-latest + needs: changes + if: needs.changes.outputs.code == 'true' || github.event_name == 'workflow_dispatch' + steps: + - name: Checkout Code + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || github.ref }} + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 + + - name: Build and run E2E tests + env: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + GOOSE_PROVIDER: anthropic + GOOSE_MODEL: claude-haiku-4-5-20251001 + GOOSE_DISABLE_KEYRING: "1" + run: source ./bin/activate-hermit && just run-ui-playwright + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: test-results + path: ui/desktop/test-results/ + retention-days: 5 diff --git a/Cargo.lock b/Cargo.lock index b0b248e73e..32a5dfee15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4558,6 +4558,7 @@ dependencies = [ "serde_path_to_error", "serde_yaml", "socket2 0.6.2", + "subtle", "tempfile", "thiserror 1.0.69", "tokio", diff --git a/Justfile b/Justfile index b3a637f369..e86b0957a5 100644 --- a/Justfile +++ b/Justfile @@ -127,12 +127,18 @@ run-ui: @echo "Running UI..." cd ui/desktop && pnpm install && pnpm run start-gui -run-ui-playwright: +run-ui-playwright-video: #!/usr/bin/env sh just release-binary echo "Running UI with Playwright" cd ui/desktop && pnpm run test-e2e:video +run-ui-playwright: + #!/usr/bin/env sh + just release-binary + echo "Running UI with Playwright" + cd ui/desktop && pnpm run test-e2e + run-ui-only: @echo "Running UI..." cd ui/desktop && pnpm install && pnpm run start-gui