diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..9c13d21 --- /dev/null +++ b/.env.test @@ -0,0 +1,9 @@ +NUXT_PUBLIC_LOGROCKET_APP_ID="" +DATABASE_URL="postgresql://prisma:prisma@localhost:5433/tests" + +# Analytics +NUXT_PUBLIC_UMAMI_HOST="" +NUXT_PUBLIC_UMAMI_ID="" + +# Floatie +NUXT_PUBLIC_FLOATIE_CLIENT_KEY='' \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..0367b20 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,13 @@ +version: '3.9' + +services: + db: + image: postgres:16 + restart: always + container_name: integration-tests-prisma + ports: + - '5433:5432' + environment: + POSTGRES_USER: prisma + POSTGRES_PASSWORD: prisma + POSTGRES_DB: tests diff --git a/package.json b/package.json index 873da47..529b29e 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,9 @@ "scripts": { "build": "prisma generate && prisma migrate deploy && nuxt build", "dev": "prisma migrate dev && nuxt dev", + "dev:test": "dotenv -e .env.test -- pnpm prisma migrate reset --force && prisma migrate dev && nuxt dev --dotenv .env.test --port 3001", + "docker:up": "docker-compose up -d", + "docker:down": "docker-compose down", "start": "node .output/server/index.mjs", "generate": "nuxt generate", "preview": "nuxt preview", @@ -28,6 +31,7 @@ "@types/node": "^20.10.0", "@vueuse/core": "^10.6.1", "@vueuse/nuxt": "^10.6.1", + "dotenv-cli": "^7.3.0", "nuxt": "3.8.2", "prisma": "^5.6.0", "vue-tsc": "^1.8.22" diff --git a/playwright.config.ts b/playwright.config.ts index 5f22d2e..b548eed 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -23,7 +23,7 @@ export default defineConfig({ reporter: 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { - baseURL: 'http://localhost:3000', + baseURL: 'http://localhost:3001', trace: 'on-first-retry', }, @@ -64,9 +64,9 @@ export default defineConfig({ ], /* Run your local dev server before starting the tests */ - // webServer: { - // command: 'pnpm dev', - // url: 'http://127.0.0.1:3000', - // reuseExistingServer: !process.env.CI, - // }, + webServer: { + command: 'pnpm dev:test', + url: 'http://localhost:3001', + reuseExistingServer: !process.env.CI, + }, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5fa35bf..d3692ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,6 +73,9 @@ devDependencies: '@vueuse/nuxt': specifier: ^10.6.1 version: 10.6.1(nuxt@3.8.2)(vue@3.3.9) + dotenv-cli: + specifier: ^7.3.0 + version: 7.3.0 nuxt: specifier: 3.8.2 version: 3.8.2(@types/node@20.10.0)(typescript@5.3.2)(vite@4.5.0)(vue-tsc@1.8.22) @@ -3278,6 +3281,21 @@ packages: dependencies: type-fest: 3.13.1 + /dotenv-cli@7.3.0: + resolution: {integrity: sha512-314CA4TyK34YEJ6ntBf80eUY+t1XaFLyem1k9P0sX1gn30qThZ5qZr/ZwE318gEnzyYP9yj9HJk6SqwE0upkfw==} + hasBin: true + dependencies: + cross-spawn: 7.0.3 + dotenv: 16.3.1 + dotenv-expand: 10.0.0 + minimist: 1.2.8 + dev: true + + /dotenv-expand@10.0.0: + resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==} + engines: {node: '>=12'} + dev: true + /dotenv@16.3.1: resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} engines: {node: '>=12'} @@ -4482,7 +4500,6 @@ packages: /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - dev: false /minipass-collect@1.0.2: resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==}