Skip to content

Commit f665f83

Browse files
committed
wip playwright
1 parent 90b264f commit f665f83

File tree

14 files changed

+208
-783
lines changed

14 files changed

+208
-783
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ prisma/data
99
! .env.example
1010
.vscode
1111
node_modules
12+
/test-results/
13+
/playwright-report/
14+
/blob-report/
15+
/playwright/.cache/

Dockerfile

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,40 @@
11
# syntax = docker/dockerfile:1
2-
32
# Adjust NODE_VERSION as desired
43
ARG NODE_VERSION=22.9.0
5-
FROM node:${NODE_VERSION}-slim as base
6-
4+
FROM node:${NODE_VERSION}-slim AS base
75
LABEL fly_launch_runtime="Node.js/Prisma"
8-
96
# Node.js/Prisma app lives here
107
WORKDIR /app
11-
128
# Set production environment
139
ENV NODE_ENV="production"
14-
1510
# Install pnpm
1611
ARG PNPM_VERSION=9.11.0
1712
RUN npm install -g pnpm@$PNPM_VERSION
18-
19-
2013
# Throw-away build stage to reduce size of final image
21-
FROM base as build
22-
14+
FROM base AS build
2315
# Install packages needed to build node modules
2416
RUN apt-get update -qq && \
2517
apt-get install --no-install-recommends -y build-essential node-gyp openssl pkg-config python-is-python3
26-
2718
# Install node modules
2819
COPY package.json pnpm-lock.yaml ./
2920
RUN pnpm install --frozen-lockfile --prod=false
30-
3121
# Generate Prisma Client
3222
COPY prisma .
3323
RUN npx prisma generate
34-
3524
# Copy application code
3625
COPY . .
37-
3826
# Build application
3927
RUN pnpm run build
40-
4128
# Remove development dependencies
4229
RUN pnpm prune --prod
43-
44-
4530
# Final stage for app image
4631
FROM base
47-
4832
# Install packages needed for deployment
4933
RUN apt-get update -qq && \
5034
apt-get install --no-install-recommends -y chromium chromium-sandbox openssl && \
5135
rm -rf /var/lib/apt/lists /var/cache/apt/archives
52-
5336
# Copy built application
5437
COPY --from=build /app /app
55-
5638
# Start the server by default, this can be overwritten at runtime
5739
EXPOSE 3000
5840
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium"

Procfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
container_name: api-docker
44
build:
55
context: .
6-
dockerfile: Dockerfile.dev
6+
dockerfile: Dockerfile
77
env_file:
88
- .env
99
ports:
@@ -20,7 +20,7 @@ services:
2020
image: postgres:alpine
2121
restart: always
2222
env_file:
23-
- .env
23+
- .env
2424
ports:
2525
- ${POSTGRES_PORT}:5432
2626
volumes:
@@ -33,4 +33,4 @@ services:
3333

3434
volumes:
3535
postgres-data:
36-
external: false
36+
external: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"keywords": [],
2222
"author": "Jasper Mayone <[email protected]>",
2323
"dependencies": {
24+
"@playwright/test": "^1.49.1",
2425
"@prisma/client": "6.1.0",
2526
"axios": "^1.7.9",
2627
"bcrypt": "^5.1.1",
@@ -33,7 +34,6 @@
3334
"jsonwebtoken": "^9.0.2",
3435
"moment": "^2.30.1",
3536
"node-statsd": "^0.1.1",
36-
"puppeteer": "^22.15.0",
3737
"request-ip": "^3.3.0",
3838
"response-time": "^2.3.3",
3939
"stripe": "^16.12.0",

playwright.config.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { defineConfig, devices } from "@playwright/test";
2+
3+
/**
4+
* Read environment variables from file.
5+
* https://github.com/motdotla/dotenv
6+
*/
7+
// import dotenv from 'dotenv';
8+
// import path from 'path';
9+
// dotenv.config({ path: path.resolve(__dirname, '.env') });
10+
11+
/**
12+
* See https://playwright.dev/docs/test-configuration.
13+
*/
14+
export default defineConfig({
15+
// /* Run tests in files in parallel */
16+
// fullyParallel: true,
17+
// /* Fail the build on CI if you accidentally left test.only in the source code. */
18+
// forbidOnly: !!process.env.CI,
19+
// /* Retry on CI only */
20+
// retries: process.env.CI ? 2 : 0,
21+
// /* Opt out of parallel tests on CI. */
22+
// workers: process.env.CI ? 1 : undefined,
23+
// /* Reporter to use. See https://playwright.dev/docs/test-reporters */
24+
// reporter: "html",
25+
// /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
26+
// use: {
27+
// /* Base URL to use in actions like `await page.goto('/')`. */
28+
// // baseURL: 'http://127.0.0.1:3000',
29+
30+
// /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
31+
// trace: "on-first-retry",
32+
// },
33+
34+
/* Configure projects for major browsers */
35+
projects: [
36+
{
37+
name: "chromium",
38+
use: { ...devices["Desktop Chrome"] },
39+
},
40+
{
41+
name: "Mobile Chrome",
42+
use: { ...devices["Pixel 5"] },
43+
},
44+
],
45+
});

0 commit comments

Comments
 (0)