Skip to content

feat: headless app and api for testing js-waku in browser #2371

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

Merged
merged 1 commit into from
May 29, 2025
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
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/node_modules
**/.git
**/.vscode
**/dist
**/build
**/.DS_Store
**/.env*
**/*.log

# Exclude all packages except browser-tests and browser-container
packages/discovery/
packages/tests/
packages/utils/
packages/sds/
packages/sdk/
packages/relay/
packages/rln/
packages/message-hash/
packages/proto/
packages/enr/
packages/interfaces/
packages/message-encryption/
packages/core/
packages/react-native-polyfills/
packages/build-utils/
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
"project": ["./tsconfig.json"]
},
"env": { "es6": true },
"ignorePatterns": ["node_modules", "build", "coverage", "proto"],
"ignorePatterns": [
"node_modules",
"build",
"coverage",
"proto"
],
"plugins": ["import", "eslint-comments", "functional"],
"extends": [
"eslint:recommended",
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
with:
repository: waku-org/js-waku

- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
Expand All @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
Expand All @@ -62,7 +62,7 @@ jobs:
HOME: "/root"
steps:
- uses: actions/checkout@v3
with:
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
token: ${{ secrets.CI_TOKEN }}

- uses: actions/checkout@v3
with:
with:
repository: waku-org/js-waku
if: ${{ steps.release.outputs.releases_created }}

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:

- uses: ./.github/actions/npm

- name: Build browser container
run: npm run build --workspace=@waku/headless-tests

- name: Build browser test environment
run: npm run build --workspace=@waku/browser-tests

- name: Run Playwright tests
run: npm run test --workspace=@waku/browser-tests

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ example
packages/discovery/mock_local_storage
.cursorrules
.giga
.cursor
.cursor
.DS_Store
CLAUDE.md
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM node:20-slim

# Install Chrome dependencies
RUN apt-get update && apt-get install -y \
procps \
libglib2.0-0 \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2 \
libpango-1.0-0 \
libcairo2 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy package files
COPY package*.json ./
COPY packages/browser-tests/package.json ./packages/browser-tests/
COPY packages/headless-tests/package.json ./packages/headless-tests/

# Install dependencies and serve
RUN npm install && npm install -g serve

# Copy source files
COPY tsconfig.json ./
COPY packages/ ./packages/

# Build packages
RUN npm run build -w packages/headless-tests && \
npm run build:server -w packages/browser-tests && \
npx playwright install chromium

EXPOSE 3000

CMD ["npm", "run", "start:server", "-w", "packages/browser-tests"]
Loading
Loading