Skip to content

[RFC] Tests using the Everything server #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/actions/setup-playwright/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Setup Playwright'
description: 'Install dependencies and setup Playwright'
inputs:
working-directory:
description: 'Directory where the project is located'
required: false
default: '.'
runs:
using: 'composite'
steps:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwoff1
shell: bash

- uses: actions/setup-node@v4
id: setup_node
with:
node-version-file: ${{ inputs.working-directory }}/package.json
cache: npm
cache-dependency-path: ${{ inputs.working-directory }}

- name: Install dependencies
run: npm ci
shell: bash
working-directory: ${{ inputs.working-directory }}

- name: Cache Playwright browsers
id: cache-playwright
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles(format('{0}/package-lock.json', inputs.working-directory)) }}
restore-keys: |
${{ runner.os }}-playwright-

- name: Install Playwright dependencies
run: npx playwright install-deps
shell: bash
working-directory: ${{ inputs.working-directory }}

- name: Install Playwright and browsers unless cached
run: npx playwright install --with-deps
shell: bash
working-directory: ${{ inputs.working-directory }}
if: steps.cache-playwright.outputs.cache-hit != 'true'
120 changes: 88 additions & 32 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,21 @@ name: Playwright Tests

on:
push:
branches: [main]
branches: [main, e2e-tests-everything-server]
pull_request:
branches: [main]

jobs:
test:
# Installing Playright dependencies can take quite awhile, and also depends on GitHub CI load.
# Installing Playwright dependencies can take quite awhile, and also depends on GitHub CI load.
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwoff1

- uses: actions/checkout@v4

- uses: actions/setup-node@v4
id: setup_node
with:
node-version-file: package.json
cache: npm

# Cache Playwright browsers
- name: Cache Playwright browsers
id: cache-playwright
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright # The default Playwright cache path
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }} # Cache key based on OS and package-lock.json
restore-keys: |
${{ runner.os }}-playwright-

- name: Install dependencies
run: npm ci

- name: Install Playwright dependencies
run: npx playwright install-deps

- name: Install Playwright and browsers unless cached
run: npx playwright install --with-deps
if: steps.cache-playwright.outputs.cache-hit != 'true'
# FIXME: Explicit path through .github is really necessary?
- uses: ./.github/actions/setup-playwright

- name: Run Playwright tests
id: playwright-tests
Expand All @@ -70,9 +42,93 @@ jobs:
comment-title: "🎭 Playwright E2E Test Results"
job-summary: true
icon-style: "emojis"
# FIXME: Node version should come from the composite setup-playwright action
custom-info: |
**Test Environment:** Ubuntu Latest, Node.js ${{ steps.setup_node.outputs.node-version }}
**Browsers:** Chromium, Firefox

📊 [View Detailed HTML Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) (download artifacts)
test-command: "npm run test:e2e"

test-everything-server:
if: github.ref == 'refs/heads/e2e-tests-everything-server'
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
path: inspector

- uses: ./inspector/.github/actions/setup-playwright
with:
working-directory: inspector

- uses: actions/checkout@v4
with:
repository: richardkmichael/servers
ref: add-structured-content-tool
path: servers

- name: Install and build everything server
working-directory: servers/src/everything
run: |
npm clean-install
npm run prepare

- name: Run Everything Server Playwright tests
working-directory: inspector
run: npm run test:e2e:everything
env:
EVERYTHING_SERVER_PATH: ${{ github.workspace }}/servers/src/everything

# FIXME:
#
# Revert to: always(), GitHub Actions are difficult to control with clarity.
#
# This step needs to run when the playwright-tests step ran whatsoever. These step conclusions
# seem to be: success, fail, cancelled (GitHub Action timeout; not Playwright timeout--
# that's fail).
#
# But not if the setup action didn't finish. For example, job timeout -- which is `cancelled()`:
# https://github.com/modelcontextprotocol/inspector/actions/runs/15860838530/job/44717383789#step:7:1152
#
# But yes, if the playwright-tests step caused the timeout -- `cancelled()`.
#
# It seems we need to know which *step* caused the overall job to be cancelled. The
# expression functions: success(), failure(), cancelled(), etc. refer to the *overall*
# job.
#
# Also, there is an implicit `success()` even with an `if: <CONDITION>`, i.e., `if: success() && <CONDITION>
# https://docs.github.com/en/actions/reference/evaluate-expressions-in-workflows-and-actions#failure-with-conditions
#
# Consider: cancelled() && step.[NAME].conclusion == "ANY"
#
- name: Upload Everything Server Playwright Report and Screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-everything-server
path: |
inspector/client/report-everything/
inspector/client/report-everything.json
inspector/client/report-everything.xml
inspector/client/e2e/results-everything/
retention-days: 2

# - name: Publish Everything Server Playwright Test Summary
# uses: daun/playwright-report-summary@v3
# if: always()
# with:
# create-comment: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
# report-file: client/results-everything.json
# comment-title: "🎭 Everything Server E2E Test Results"
# job-summary: true
# icon-style: "emojis"
# custom-info: |
# **Test Environment:** Ubuntu Latest, Node.js 20
# **Browsers:** Chromium
# **MCP Server:** Everything Server

# 📊 [View Detailed HTML Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) (download artifacts)
# test-command: "npm run test:e2e:everything"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ test-output
client/playwright-report/
client/results.json
client/test-results/
client/e2e/test-results-everything/

9 changes: 9 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# MCP Inspector Development Guide

## Exploring the Inspector yourself

- The MCP Inspector is a React app in the client/ directory
- The React app might be running at http://localhost:6274, if so you can use a browser tool to explore the UI
- Most React app functionality requires a connected MCP Server to test
- If not already filled, first fill in the form values to configure the MCP Server to run
- Use the `Connect` button in the UI to connect to the MCP Server
- Explore the running Inspector UI to learn the DOM structure and develop Playwright e2e tests

## Build Commands

- Build all: `npm run build`
Expand Down
6 changes: 6 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Playwright output, see: playwright.everything.config.ts
report-everything/
report-everything.json
report-everything.xml
e2e/results-everything/
Loading
Loading