Skip to content
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
2 changes: 0 additions & 2 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Run WDIO Tests with OBOT Docker

on:
workflow_dispatch:
repository_dispatch:
types: [pr-created]

jobs:
wdio-tests:
Expand Down
124 changes: 124 additions & 0 deletions .github/workflows/pr-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Run WDIO Tests with OBOT Docker

on:
repository_dispatch:
types: [pr-created]

jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
pr_number: ${{ steps.set-matrix.outputs.pr_number }}
steps:
- name: Set matrix data
id: set-matrix
run: |
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "matrix=${{ toJson(github.event.client_payload.changed_files) }}" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.client_payload.pr_number }}" >> $GITHUB_OUTPUT
else
# Default empty matrix for workflow_dispatch
echo 'matrix=[{"file":"default","containerizedConfig":null,"env":null}]' >> $GITHUB_OUTPUT
echo "pr_number=" >> $GITHUB_OUTPUT
fi

wdio-tests:
needs: prepare-matrix
runs-on: ubuntu-latest
if: needs.prepare-matrix.outputs.matrix != '[]'
strategy:
fail-fast: false
matrix:
server: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}

permissions:
id-token: write
actions: read
checks: read

steps:
- name: Checkout Repository
uses: actions/checkout@v5

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22

- name: Cache NPM Dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run OBOT container
run: |
docker run -d --name obot \
-p 8080:8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
-e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \
-e OBOT_SERVER_DISABLE_UPDATE_CHECK=true \
ghcr.io/obot-platform/obot:latest

- name: Wait for OBOT to be ready
run: |
echo "Waiting for OBOT container..."
for i in {1..12}; do
if curl -sf http://localhost:8080/api/me | grep -q '"username":"nobody"'; then
echo "OBOT API is ready."
break
fi
echo "Not ready yet... retry #$i"
sleep 5
done

- name: Remove file extension
env:
MATRIX_SERVER_FILE: ${{ matrix.server.file }}
run: |
MCP_SERVER_NAME="${MATRIX_SERVER_FILE/.yaml/}"
echo "MCP_SERVER_NAME=$MCP_SERVER_NAME" >> $GITHUB_ENV

- name: Create catalog entry
run: |
curl localhost:8080/api/mcp-catalogs/default/entries -X POST -H "Content-Type: application/json" \
-d '{
"name": "test-${MCP_SERVER_NAME}",
"description": "testing ${MCP_SERVER_NAME} mcp",
"icon": "https://avatars.githubusercontent.com/u/9919?v=4",
"repoURL": "https://github.com/testing/testing",
"runtime": "containerized",
"containerizedConfig": {
"image": "${{ matrix.server.containerizedConfig.image }}",
"port": ${{ matrix.server.containerizedConfig.port }},
"path": "${{ matrix.server.containerizedConfig.path }}",
"args": ${{ toJson(matrix.server.containerizedConfig.args) }}
},
"metadata": {
"categories": "testing"
}
}'

- name: Install dependencies
run: npm ci

- name: Run WDIO Tests
env:
WP_URL: ${{ secrets.WP_URL }}
WP_USERNAME: ${{ secrets.WP_USERNAME }}
WP_PASSWORD: ${{ secrets.WP_PASSWORD }}
OBOT_URL: ${{ secrets.OBOT_URL }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
npx wdio run wdio.conf.ts --cucumberOpts.tagExpression='@${MCP_SERVER_NAME}'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Once you've installed the dependencies and set up your environment, you can run
2. **Run a specific test**:
If you want to run a specific scenario or feature, use:
```bash
npm run wdio:byScenario --spec src/features/obot.feature:10
npx wdio run wdio.conf.ts --cucumberOpts.tagExpression='@gitlab'
```
Replace `10` with the line number of the scenario you want to execute.
Replace `@gitlab` with the tag corresponding to the scenario you want to execute.

3. **Run in headless mode** (useful for CI/CD):
You can run the tests in headless mode (without opening the browser window) by configuring the `wdio.conf.ts` file to enable headless execution, and then run the tests with:
Expand Down
Loading