Skip to content
This repository was archived by the owner on May 18, 2023. It is now read-only.

Commit 0883ae4

Browse files
committed
chore: add dockerfile for puppeteer tests
1 parent d15ae6d commit 0883ae4

File tree

6 files changed

+71
-7
lines changed

6 files changed

+71
-7
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ TEST_ACCOUNT=
1212
TEST_SEED=
1313
TEST_PKEY=
1414
TEST_PASS=
15-
TEST_BASE_URL=
15+
TEST_BASE_URL=
16+
PUPPETEER_EXEC_PATH=""

Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM node:14.17-alpine
4+
5+
RUN apk update
6+
RUN apk add --no-cache \
7+
xvfb \
8+
xvfb-run \
9+
git \
10+
chromium \
11+
nss \
12+
freetype \
13+
harfbuzz \
14+
ca-certificates \
15+
ttf-freefont \
16+
nodejs
17+
18+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
19+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
20+
TEST_BASE_URL=http://127.0.0.1:3000
21+
22+
WORKDIR /app
23+
24+
COPY package*.json ./
25+
26+
RUN npm install
27+
28+
COPY . ./
29+
30+
CMD ["xvfb-run", "-a", "npm", "run", "e2e"]
31+
32+
33+

package.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
"pre-commit": "lint-staged",
1616
"prettier": "prettier --write 'src/**/*.{ts,tsx}'",
1717
"lint": "next lint",
18-
"test": "jest",
19-
"test:watch": "jest --watch",
20-
"test:ci": "jest --ci --collectCoverage",
21-
"test:e2e": "yarn jest --testPathPattern=test/e2e",
18+
"test": "jest --testPathPattern=test/unit",
19+
"test:watch": "jest --testPathPattern=test/unit --watch",
20+
"test:ci": "jest --testPathPattern=test/unit --ci --collectCoverage",
21+
"e2e:run": "yarn jest --testPathPattern=test/e2e",
22+
"e2e:safe": "wait-on -l http://localhost:3000 && yarn e2e:run",
23+
"e2e": "concurrently -k -s first -n \"app,e2e\" \"yarn dev\" \"yarn e2e:safe\"",
2224
"storybook": "start-storybook -p 6006",
2325
"build-storybook": "build-storybook",
2426
"postinstall": "yarn lingui"
@@ -119,6 +121,7 @@
119121
"babel-loader": "^8.2.2",
120122
"babel-plugin-macros": "^3.1.0",
121123
"combinate": "^1.1.7",
124+
"concurrently": "^6.4.0",
122125
"cookie-cutter": "^0.2.0",
123126
"copy-to-clipboard": "^3.3.1",
124127
"cross-env": "^7.0.3",

test/e2e/swap.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ describe('Trident Swap:', () => {
2626
headless: false,
2727
defaultViewport: null,
2828
slowMo: 5,
29+
args: ['--no-sandbox', '--disable-setuid-sandbox'],
30+
executablePath: process.env.PUPPETEER_EXEC_PATH,
2931
})
3032
try {
3133
metamask = await setupMetamask(browser, { seed: seed, password: pass })

yarn.lock

+26-2
Original file line numberDiff line numberDiff line change
@@ -8475,6 +8475,20 @@ concat-stream@^1.5.0, concat-stream@^1.5.1:
84758475
readable-stream "^2.2.2"
84768476
typedarray "^0.0.6"
84778477

8478+
concurrently@^6.4.0:
8479+
version "6.4.0"
8480+
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-6.4.0.tgz#5387ee86be435a0eb51c292ade8a00acf479f170"
8481+
integrity sha512-HZ3D0RTQMH3oS4gvtYj1P+NBc6PzE2McEra6yEFcQKrUQ9HvtTGU4Dbne083F034p+LRb7kWU0tPRNvSGs1UCQ==
8482+
dependencies:
8483+
chalk "^4.1.0"
8484+
date-fns "^2.16.1"
8485+
lodash "^4.17.21"
8486+
rxjs "^6.6.3"
8487+
spawn-command "^0.0.2-1"
8488+
supports-color "^8.1.0"
8489+
tree-kill "^1.2.2"
8490+
yargs "^16.2.0"
8491+
84788492
console-browserify@^1.1.0:
84798493
version "1.2.0"
84808494
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336"
@@ -19910,6 +19924,11 @@ space-separated-tokens@^1.0.0:
1991019924
resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz#85f32c3d10d9682007e917414ddc5c26d1aa6899"
1991119925
integrity sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==
1991219926

19927+
spawn-command@^0.0.2-1:
19928+
version "0.0.2-1"
19929+
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
19930+
integrity sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=
19931+
1991319932
spawndamnit@^2.0.0:
1991419933
version "2.0.0"
1991519934
resolved "https://registry.yarnpkg.com/spawndamnit/-/spawndamnit-2.0.0.tgz#9f762ac5c3476abb994b42ad592b5ad22bb4b0ad"
@@ -20477,7 +20496,7 @@ superstruct@^0.10.12:
2047720496
resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.10.13.tgz#705535a5598ff231bd976601a7b6b534a71a821b"
2047820497
integrity sha512-W4SitSZ9MOyMPbHreoZVEneSZyPEeNGbdfJo/7FkJyRs/M3wQRFzq+t3S/NBwlrFSWdx1ONLjLb9pB+UKe4IqQ==
2047920498

20480-
supports-color@8.1.1, supports-color@^8.0.0:
20499+
supports-color@8.1.1, supports-color@^8.0.0, supports-color@^8.1.0:
2048120500
version "8.1.1"
2048220501
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
2048320502
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
@@ -21015,6 +21034,11 @@ tr46@~0.0.3:
2101521034
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
2101621035
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
2101721036

21037+
tree-kill@^1.2.2:
21038+
version "1.2.2"
21039+
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
21040+
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
21041+
2101821042
trim-newlines@^3.0.0:
2101921043
version "3.0.1"
2102021044
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
@@ -21785,7 +21809,7 @@ w3c-xmlserializer@^2.0.0:
2178521809
dependencies:
2178621810
xml-name-validator "^3.0.0"
2178721811

21788-
wait-on@6.0.0:
21812+
wait-on@6.0.0, wait-on@^6.0.0:
2178921813
version "6.0.0"
2179021814
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-6.0.0.tgz#7e9bf8e3d7fe2daecbb7a570ac8ca41e9311c7e7"
2179121815
integrity sha512-tnUJr9p5r+bEYXPUdRseolmz5XqJTTj98JgOsfBn7Oz2dxfE2g3zw1jE+Mo8lopM3j3et/Mq1yW7kKX6qw7RVw==

0 commit comments

Comments
 (0)