Skip to content
Merged
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
32 changes: 32 additions & 0 deletions .config/vite-plugins/examples-middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { createReadStream, statSync } from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { Plugin } from 'vite';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
const EXAMPLES_DIR = join(__dirname, '..', '..', 'examples');

export function examplesMiddlewarePlugin(): Plugin {
return {
name: 'examples-middleware',
configureServer(server) {
server.middlewares.use('/__examples__', (req, res, next) => {
const filePath = join(EXAMPLES_DIR, req.url ?? '/');

try {
statSync(filePath);
} catch {
next();
return;
}

res.writeHead(200, {
'Content-Type': 'application/octet-stream',
'Access-Control-Allow-Origin': '*',
});

createReadStream(filePath).pipe(res);
});
},
};
}
154 changes: 154 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: CI

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened, closed]
push:
branches: [master]

permissions:
contents: write
pull-requests: write

jobs:
check:
if: github.event.action != 'closed'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci

- name: Typecheck
run: npm run typecheck

- name: Lint
run: npm run lint

- name: Test
run: npm test

deploy:
if: github.event_name == 'push'
needs: check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci

- name: Build
run: npm run build
env:
VITE_BASE_PATH: /browser-wd-tracer/

- name: Copy examples
run: cp -r examples dist/

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist

deploy-preview:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
needs: check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci

- name: Build
run: npm run build
env:
VITE_BASE_PATH: /browser-wd-tracer/pr-${{ github.event.number }}/

- name: Copy examples
run: cp -r examples dist/

- name: Deploy PR preview
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
destination_dir: pr-${{ github.event.number }}
keep_files: true

- name: Comment preview link
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
const baseUrl = `https://gemini-testing.github.io/browser-wd-tracer/pr-${prNumber}/`;
const previewUrl = `${baseUrl}?logUrl=${baseUrl}examples/webdriver.txt`;
const body = [
'### 🔍 PR Preview',
'',
`**[► Open preview](${previewUrl})**`,
'',
'_Preview will be removed when this PR is closed._',
].join('\n');

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});

const existing = comments.find((c) => c.body.includes('PR Preview'));

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body,
});
}

cleanup-preview:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: gh-pages

- name: Remove PR preview folder
run: |
if [ -d "pr-${{ github.event.number }}" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git rm -rf "pr-${{ github.event.number }}"
git commit -m "chore: remove PR #${{ github.event.number }} preview"
git push
fi
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Dependencies
node_modules/

# Build
dist/
build/
*.tsbuildinfo

# Coverage
coverage/
.nyc_output/

# Environment
.env
.env.local
.env.*.local

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Output files
trace*.json
output*.json
*.trace

# OS
.DS_Store
Thumbs.db

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Temp
tmp/
temp/
*.tmp
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.12.0
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
node_modules
coverage
package-lock.json
*.min.js
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2026 Testplane
Copyright (c) 2024 YANDEX LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
# browser-wd-tracer
UI-tool to explore raw webdriver logs

[![CI](https://github.com/gemini-testing/browser-wd-tracer/actions/workflows/ci.yaml/badge.svg)](https://github.com/gemini-testing/browser-wd-tracer/actions/workflows/ci.yaml)

A browser-based ui-tool for parsing and exploring WebDriver logs. Raw WebDriver logs are large and hard to navigate as plain text — this tool makes it easy to explore commands, responses, console output, and more, all parsed in-browser with no server required.

**[► Try it live with example logs](https://gemini-testing.github.io/browser-wd-tracer/?logUrl=https://gemini-testing.github.io/browser-wd-tracer/examples/webdriver.txt)**

**Supported parsers:**
- ChromeDriver

## Requirements

- Node.js >= 20

## Development

Install dependencies:

```bash
npm ci
```

Start the dev server:

```bash
npm run dev
```

Start the dev server with a bundled example log:

```bash
npm run dev:example
```

## Deployment

Build the app:

```bash
git clone https://github.com/gemini-testing/browser-wd-tracer
cd browser-wd-tracer
npm ci
npm run build
```

After the build, the `dist/` folder contains a ready-to-serve SPA. Serve it with any static HTTP server:

```bash
npx http-server dist/ -p 3000
```

Then open the app and pass a log URL via the query parameter:

```
http://localhost:3000/?logUrl=http://your-log-server/webdriver.txt
```
16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import tseslint from 'typescript-eslint';

export default tseslint.config(
{ ignores: ['dist/**', 'coverage/**'] },

...tseslint.configs.recommended,

{
languageOptions: {
parserOptions: {
project: ['./tsconfig.json', './tsconfig.test.json'],
tsconfigRootDir: import.meta.dirname,
},
},
}
);
Loading