Skip to content

Commit 3d871e3

Browse files
committed
feat: headless app and api for testing js-waku in browser
1 parent f85a476 commit 3d871e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+17940
-376
lines changed

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/node_modules
2+
**/.git
3+
**/.vscode
4+
**/dist
5+
**/build
6+
**/.DS_Store
7+
**/.env*
8+
**/*.log
9+
10+
# Exclude all packages except browser-tests and browser-container
11+
packages/discovery/
12+
packages/tests/
13+
packages/utils/
14+
packages/sds/
15+
packages/sdk/
16+
packages/relay/
17+
packages/rln/
18+
packages/message-hash/
19+
packages/proto/
20+
packages/enr/
21+
packages/interfaces/
22+
packages/message-encryption/
23+
packages/core/
24+
packages/react-native-polyfills/
25+
packages/build-utils/

.eslintrc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"project": ["./tsconfig.json"]
66
},
77
"env": { "es6": true },
8-
"ignorePatterns": ["node_modules", "build", "coverage", "proto"],
8+
"ignorePatterns": [
9+
"node_modules",
10+
"build",
11+
"coverage",
12+
"proto"
13+
],
914
"plugins": ["import", "eslint-comments", "functional"],
1015
"extends": [
1116
"eslint:recommended",

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v3
25-
with:
25+
with:
2626
repository: waku-org/js-waku
27-
27+
2828
- uses: actions/setup-node@v3
2929
with:
3030
node-version: ${{ env.NODE_JS }}
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838
steps:
3939
- uses: actions/checkout@v3
40-
with:
40+
with:
4141
repository: waku-org/js-waku
4242
- uses: actions/setup-node@v3
4343
with:
@@ -62,7 +62,7 @@ jobs:
6262
HOME: "/root"
6363
steps:
6464
- uses: actions/checkout@v3
65-
with:
65+
with:
6666
repository: waku-org/js-waku
6767
- uses: actions/setup-node@v3
6868
with:
@@ -150,7 +150,7 @@ jobs:
150150
token: ${{ secrets.CI_TOKEN }}
151151

152152
- uses: actions/checkout@v3
153-
with:
153+
with:
154154
repository: waku-org/js-waku
155155
if: ${{ steps.release.outputs.releases_created }}
156156

.github/workflows/playwright.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ jobs:
2929

3030
- uses: ./.github/actions/npm
3131

32+
- name: Build browser container
33+
run: npm run build --workspace=@waku/browser-container
34+
35+
- name: Build browser test environment
36+
run: npm run build --workspace=@waku/browser-tests
37+
3238
- name: Run Playwright tests
3339
run: npm run test --workspace=@waku/browser-tests
3440

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ example
1515
packages/discovery/mock_local_storage
1616
.cursorrules
1717
.giga
18-
.cursor
18+
.cursor
19+
.DS_Store

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM node:20-slim
2+
3+
# Install Chrome dependencies
4+
RUN apt-get update && apt-get install -y \
5+
procps \
6+
libglib2.0-0 \
7+
libnss3 \
8+
libnspr4 \
9+
libatk1.0-0 \
10+
libatk-bridge2.0-0 \
11+
libcups2 \
12+
libdrm2 \
13+
libxkbcommon0 \
14+
libxcomposite1 \
15+
libxdamage1 \
16+
libxfixes3 \
17+
libxrandr2 \
18+
libgbm1 \
19+
libasound2 \
20+
libpango-1.0-0 \
21+
libcairo2 \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
WORKDIR /app
25+
26+
# Copy package files
27+
COPY package*.json ./
28+
COPY packages/browser-tests/package.json ./packages/browser-tests/
29+
COPY packages/headless-tests/package.json ./packages/headless-tests/
30+
31+
# Install dependencies and serve
32+
RUN npm install && npm install -g serve
33+
34+
# Copy source files
35+
COPY tsconfig.json ./
36+
COPY packages/ ./packages/
37+
38+
# Build packages
39+
RUN npm run build -w packages/headless-tests && \
40+
npm run build:server -w packages/browser-tests && \
41+
npx playwright install chromium
42+
43+
EXPOSE 3000
44+
45+
CMD ["npm", "run", "start:server", "-w", "packages/browser-tests"]

0 commit comments

Comments
 (0)