From 7dab4abbd3073b32f544bb34c55e0d80ed6c19ca Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 02:40:01 +0200 Subject: [PATCH 01/41] ci: test if oidc works --- .forgejo/workflows/ci.yaml | 43 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 8989c51..8db9d2f 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -1,10 +1,6 @@ name: Visitenbuch CI on: push: - branches: - - "main" - tags: - - "v*" pull_request: jobs: @@ -32,25 +28,28 @@ jobs: steps: - name: πŸ‘οΈ Checkout repository uses: actions/checkout@v4 - - name: πŸ“¦ pnpm install + - name: Test run: | - pnpm install - cp .env.test .env - - name: 🧐 lint - run: | - npm run check - npm run lint - - name: πŸ§ͺ Unit test - run: npm run test:unit - - name: πŸ§ͺ Integration test - run: | - npx prisma migrate reset --force - npm run test:integration - - name: πŸ‘¨β€πŸ”¬ E2E test - run: | - npx playwright install --with-deps - npm run build - npm run test:e2e + curl http://oidc:3000/.well-known/openid-configuration + # - name: πŸ“¦ pnpm install + # run: | + # pnpm install + # cp .env.test .env + # - name: 🧐 lint + # run: | + # npm run check + # npm run lint + # - name: πŸ§ͺ Unit test + # run: npm run test:unit + # - name: πŸ§ͺ Integration test + # run: | + # npx prisma migrate reset --force + # npm run test:integration + # - name: πŸ‘¨β€πŸ”¬ E2E test + # run: | + # npx playwright install --with-deps + # npm run build + # npm run test:e2e release: runs-on: cimaster-latest From 04523b17e98551375d81d56b1c93090a32c01fe8 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 02:42:43 +0200 Subject: [PATCH 02/41] ci test --- .forgejo/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 8db9d2f..938735f 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -30,7 +30,9 @@ jobs: uses: actions/checkout@v4 - name: Test run: | + sleep 5 curl http://oidc:3000/.well-known/openid-configuration + sleep 360 # - name: πŸ“¦ pnpm install # run: | # pnpm install From a17ca9bbba3b02d652e5f7b1534a86fad2b75e66 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:20:18 +0200 Subject: [PATCH 03/41] ci: test --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 938735f..f1e4f84 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -32,7 +32,7 @@ jobs: run: | sleep 5 curl http://oidc:3000/.well-known/openid-configuration - sleep 360 + sleep 1000 # - name: πŸ“¦ pnpm install # run: | # pnpm install From e63888a1037130583e70b000de5f2677c34855b3 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:21:24 +0200 Subject: [PATCH 04/41] ci: test --- .forgejo/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index f1e4f84..019e0af 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -30,8 +30,6 @@ jobs: uses: actions/checkout@v4 - name: Test run: | - sleep 5 - curl http://oidc:3000/.well-known/openid-configuration sleep 1000 # - name: πŸ“¦ pnpm install # run: | From b0b2cb5bb953968d9eeeafb8389d459c1e6d8b40 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:35:20 +0200 Subject: [PATCH 05/41] ci: run container itself --- .forgejo/workflows/ci.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 019e0af..22df193 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -4,6 +4,21 @@ on: pull_request: jobs: + oidcmock: + runs-on: cimaster-latest + container: thetadev256/oidc-mock-server + env: + CLIENT_ID: visitenbuch + CLIENT_SECRET: supersecret + CLIENT_REDIRECT_URIS: http://localhost:4173/auth/callback/keycloak + CLIENT_LOGOUT_REDIRECT_URIS: http://localhost:4173/login?noAuto=1 + ISSUER_HOST: oidc:3000 + steps: + - name: Test + run: | + cd /app + node server.js + test: runs-on: cimaster-latest services: From e7de2f2588a16ee5c76623530a56e262964a7fe7 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:46:57 +0200 Subject: [PATCH 06/41] ci: only oidc-mock-server --- .forgejo/workflows/ci.yaml | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 22df193..2959826 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -4,29 +4,14 @@ on: pull_request: jobs: - oidcmock: - runs-on: cimaster-latest - container: thetadev256/oidc-mock-server - env: - CLIENT_ID: visitenbuch - CLIENT_SECRET: supersecret - CLIENT_REDIRECT_URIS: http://localhost:4173/auth/callback/keycloak - CLIENT_LOGOUT_REDIRECT_URIS: http://localhost:4173/login?noAuto=1 - ISSUER_HOST: oidc:3000 - steps: - - name: Test - run: | - cd /app - node server.js - test: runs-on: cimaster-latest services: - postgres: - image: postgres - env: - POSTGRES_DB: "test" - POSTGRES_PASSWORD: "1234" + # postgres: + # image: postgres + # env: + # POSTGRES_DB: "test" + # POSTGRES_PASSWORD: "1234" oidc: image: thetadev256/oidc-mock-server env: @@ -35,6 +20,7 @@ jobs: CLIENT_REDIRECT_URIS: http://localhost:4173/auth/callback/keycloak CLIENT_LOGOUT_REDIRECT_URIS: http://localhost:4173/login?noAuto=1 ISSUER_HOST: oidc:3000 + env: DATABASE_URL: "postgresql://postgres:1234@postgres:5432/test?schema=public" TEST_DATABASE_URL: "postgresql://postgres:1234@postgres:5432/test?schema=public" From 7ea87d42402c1b155a4cc27abe6365e2aad7ee86 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:48:36 +0200 Subject: [PATCH 07/41] ci: use test oidc image --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 2959826..be3233e 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: # POSTGRES_DB: "test" # POSTGRES_PASSWORD: "1234" oidc: - image: thetadev256/oidc-mock-server + image: thetadev256/oidc-mock-server:test env: CLIENT_ID: visitenbuch CLIENT_SECRET: supersecret From 1de0cf7d5905cc259557d06b4446bdbd20fd4e43 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:56:04 +0200 Subject: [PATCH 08/41] ci: fixed oidc-mock image --- .forgejo/workflows/ci.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index be3233e..a7d881e 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -7,13 +7,13 @@ jobs: test: runs-on: cimaster-latest services: - # postgres: - # image: postgres - # env: - # POSTGRES_DB: "test" - # POSTGRES_PASSWORD: "1234" + postgres: + image: postgres + env: + POSTGRES_DB: "test" + POSTGRES_PASSWORD: "1234" oidc: - image: thetadev256/oidc-mock-server:test + image: thetadev256/oidc-mock-server env: CLIENT_ID: visitenbuch CLIENT_SECRET: supersecret @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v4 - name: Test run: | - sleep 1000 + curl http://oidc:3000/.well-known/openid-configuration || sleep 1000 # - name: πŸ“¦ pnpm install # run: | # pnpm install From c21f9d1fdd230c38420f51a3e4be39b62b121f56 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 03:58:50 +0200 Subject: [PATCH 09/41] ci: retry with working oidc server image --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 8989c51..f1d9141 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -48,7 +48,7 @@ jobs: npm run test:integration - name: πŸ‘¨β€πŸ”¬ E2E test run: | - npx playwright install --with-deps + npx playwright install --with-deps chrome npm run build npm run test:e2e From c6ffea27395f97fb5b4f0ea7761c75178d2639fc Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 04:44:47 +0200 Subject: [PATCH 10/41] ci: fix playwright install --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index f1d9141..6e71e45 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -48,7 +48,7 @@ jobs: npm run test:integration - name: πŸ‘¨β€πŸ”¬ E2E test run: | - npx playwright install --with-deps chrome + npx playwright install npm run build npm run test:e2e From 04f8be468148e8d4c5b7a52c4ab079b56af8c83a Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 14:17:47 +0200 Subject: [PATCH 11/41] ci: retry --- .forgejo/workflows/ci.yaml | 2 +- .pre-commit-config.yaml | 1 + playwright.config.js | 3 ++- vitest.config.integration.js | 8 ++++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 6e71e45..8989c51 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -48,7 +48,7 @@ jobs: npm run test:integration - name: πŸ‘¨β€πŸ”¬ E2E test run: | - npx playwright install + npx playwright install --with-deps npm run build npm run test:e2e diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 24bca84..6d1751c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,4 +13,5 @@ repos: entry: npx eslint args: - "--max-warnings=0" + - "--cache" files: \.(js|ts|svelte)$ diff --git a/playwright.config.js b/playwright.config.js index afa7d21..928f1cb 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -4,7 +4,8 @@ export default defineConfig({ webServer: { command: "npm run preview -m test", port: 4173, - reuseExistingServer: true, + // eslint-disable-next-line no-undef + reuseExistingServer: !process.env.CI, }, testDir: "tests/e2e", testMatch: /\.[jt]s$/, diff --git a/vitest.config.integration.js b/vitest.config.integration.js index 81c290e..0289eb3 100644 --- a/vitest.config.integration.js +++ b/vitest.config.integration.js @@ -4,6 +4,11 @@ import { sveltekit } from "@sveltejs/kit/vite"; import { defineConfig } from "vitest/config"; +// eslint-disable-next-line no-undef +const DATABASE_URL = process.env.TEST_DATABASE_URL ?? "postgresql://postgres:1234@localhost:5432/test?schema=public"; +// eslint-disable-next-line no-console +console.log("TEST_DATABASE_URL", DATABASE_URL); + export default defineConfig({ plugins: [sveltekit()], test: { @@ -13,8 +18,7 @@ export default defineConfig({ maxConcurrency: 1, setupFiles: ["tests/helpers/setup.ts"], env: { - // eslint-disable-next-line no-undef - DATABASE_URL: process.env.TEST_DATABASE_URL ?? "postgresql://postgres:1234@localhost:5432/test?schema=public", + DATABASE_URL, }, }, }); From a5117b1515b164a5ac90b687f744f0d44df9d239 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 14:28:02 +0200 Subject: [PATCH 12/41] ci: upload E2E report --- .dockerignore | 1 + .forgejo/workflows/ci.yaml | 8 +++++++- .gitignore | 1 + playwright.config.js | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 62669bc..8567a5b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,7 @@ node_modules /.svelte-kit /package +/playwright-report .env .env.* .eslintcache diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 8989c51..6c02592 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -47,10 +47,16 @@ jobs: npx prisma migrate reset --force npm run test:integration - name: πŸ‘¨β€πŸ”¬ E2E test + id: e2etest run: | - npx playwright install --with-deps npm run build npm run test:e2e + - name: πŸ’’ Upload E2E report + if: ${{ failure() && steps.e2etest.conclusion == 'failure' }} + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: playwright-report release: runs-on: cimaster-latest diff --git a/.gitignore b/.gitignore index ffc5dfa..2b7e811 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules /build /.svelte-kit /package +/playwright-report .env .eslintcache vite.config.js.timestamp-* diff --git a/playwright.config.js b/playwright.config.js index 928f1cb..c0d3e22 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -11,4 +11,5 @@ export default defineConfig({ testMatch: /\.[jt]s$/, globalSetup: "tests/helpers/generate-mockdata.ts", outputDir: ".svelte-kit/test-results", + maxFailures: 0, }); From 5d30c7bb8510ec1aff9de8bd9a293e767ca2b91d Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 14:36:39 +0200 Subject: [PATCH 13/41] ci: fix upload E2E report --- playwright.config.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/playwright.config.js b/playwright.config.js index c0d3e22..82042e9 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -1,15 +1,22 @@ import { defineConfig } from "@playwright/test"; +// eslint-disable-next-line no-undef +const CI = process.env.CI; + export default defineConfig({ webServer: { command: "npm run preview -m test", port: 4173, - // eslint-disable-next-line no-undef - reuseExistingServer: !process.env.CI, + reuseExistingServer: !CI, }, testDir: "tests/e2e", testMatch: /\.[jt]s$/, globalSetup: "tests/helpers/generate-mockdata.ts", outputDir: ".svelte-kit/test-results", maxFailures: 0, + retries: CI ? 2 : 0, + reporter: CI ? [["list"], ["html"]] : "list", + use: { + trace: "on-first-retry", + }, }); From 5b3da498d6d98f7c4ff5bada528ad1375226ca52 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 14:41:08 +0200 Subject: [PATCH 14/41] ci: fix upload E2E report (2) --- .forgejo/workflows/ci.yaml | 2 +- playwright.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 6c02592..846b432 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -53,7 +53,7 @@ jobs: npm run test:e2e - name: πŸ’’ Upload E2E report if: ${{ failure() && steps.e2etest.conclusion == 'failure' }} - uses: actions/upload-artifact@v4 + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: name: playwright-report path: playwright-report diff --git a/playwright.config.js b/playwright.config.js index 82042e9..0230619 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -1,7 +1,7 @@ import { defineConfig } from "@playwright/test"; // eslint-disable-next-line no-undef -const CI = process.env.CI; +const CI = Boolean(process.env.CI); export default defineConfig({ webServer: { From cbc7d65103695565db64b4770cce71f5d37920b6 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 15:33:57 +0200 Subject: [PATCH 15/41] test: use fixtures for E2E tests, fix wrong OIDC URL in CI --- playwright.config.js | 3 +- tests/e2e/_test.ts | 90 +++++++++++++++++++++++++++++++++++++++++ tests/e2e/login.test.ts | 34 +++++----------- tests/e2e/plan.test.ts | 7 +--- tests/helpers/login.ts | 58 -------------------------- 5 files changed, 104 insertions(+), 88 deletions(-) create mode 100644 tests/e2e/_test.ts delete mode 100644 tests/helpers/login.ts diff --git a/playwright.config.js b/playwright.config.js index 0230619..ed4ee46 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -10,12 +10,11 @@ export default defineConfig({ reuseExistingServer: !CI, }, testDir: "tests/e2e", - testMatch: /\.[jt]s$/, globalSetup: "tests/helpers/generate-mockdata.ts", outputDir: ".svelte-kit/test-results", maxFailures: 0, retries: CI ? 2 : 0, - reporter: CI ? [["list"], ["html"]] : "list", + reporter: CI ? [["line"], ["html"]] : "list", use: { trace: "on-first-retry", }, diff --git a/tests/e2e/_test.ts b/tests/e2e/_test.ts new file mode 100644 index 0000000..d0ed5a2 --- /dev/null +++ b/tests/e2e/_test.ts @@ -0,0 +1,90 @@ +import { encode } from "@auth/core/jwt"; +import { test as base, expect, type Page } from "@playwright/test"; + +import { prisma } from "$lib/server/prisma"; + +export const OIDC_BASE_URL = process.env.KEYCLOAK_ISSUER + "/"; +const AUTH_COOKIE = "authjs.session-token"; + +type Account = { + id: number; + name: string; + email: string; + accessToken: string | null; +}; + +export async function isLoggedIn(page: Page): Promise { + const cookies = await page.context().cookies(); + return cookies.findIndex((c) => c.name === AUTH_COOKIE) !== -1; +} + +async function newSessionToken(user: Account): Promise { + return encode({ + salt: AUTH_COOKIE, + secret: process.env.AUTH_SECRET!, + token: { + name: user.name, + email: user.email, + sub: user.id.toString(), + id: user.id.toString(), + accessToken: user.accessToken, + }, + }); +} + +export const test = base.extend({ + account: [async ({ browser }, use, workerInfo) => { + // Unique username + const name = "user" + workerInfo.workerIndex; + const email = name + "@example.org"; + + // Create the account + const page = await browser.newPage(); + await page.goto("/"); + + if (page.url().startsWith(OIDC_BASE_URL)) { + await page.locator('input[name="login"]').fill(name); + await page.locator('input[name="password"]').fill("1234"); + await page.locator("button.login-submit").click(); + await page.getByRole("button", { name: "Continue" }).click(); + expect(await isLoggedIn(page)).toBe(true); + } + + // Get user data + const user = await prisma.user.findUniqueOrThrow({ + select: { + id: true, + accounts: { + select: { access_token: true }, + where: { provider: "keycloak" }, + }, + }, + where: { email }, + }); + expect(user.accounts.length).toBe(1); + + // Use the account data when calling the fixture + await use({ + id: user.id, name, email, accessToken: user.accounts[0].access_token, + }); + }, { scope: "worker" }], +}).extend<{ + login: Page, +}>({ + login: async ({ page, account }, use) => { + const token = await newSessionToken(account); + await page.context().addCookies([{ + name: AUTH_COOKIE, + value: token, + domain: "localhost", + path: "/", + httpOnly: true, + sameSite: "Lax", + }]); + await use(page); + }, +}); + +export { expect } from "@playwright/test"; diff --git a/tests/e2e/login.test.ts b/tests/e2e/login.test.ts index 3150585..9d51f53 100644 --- a/tests/e2e/login.test.ts +++ b/tests/e2e/login.test.ts @@ -1,39 +1,27 @@ -import { test, expect } from "@playwright/test"; - import { - isLoggedIn, loginIfNecessary, loginWithToken, USERNAME, OIDC_BASE_URL, -} from "$tests/helpers/login"; + test, expect, isLoggedIn, OIDC_BASE_URL, +} from "./_test"; -test.describe.configure({ mode: "serial" }); // Parallel account creation may cause issues - -test("login", async ({ page }) => { +test("login", async ({ login: page, account }) => { await page.goto("/"); - await loginIfNecessary(page); await expect(page).toHaveTitle("Visitenbuch"); - await expect(page.locator("h1.heading")).toHaveText("Hallo, Lucy Login"); + await expect(page.locator("h1.heading")).toHaveText("Hallo, " + account.name); // Test cases may create more entries expect(parseInt(await page.getByTestId("n-entries-todo").innerText())) .toBeGreaterThanOrEqual(193); }); -test("loginWithToken", async ({ page }) => { - await loginWithToken(page); +test("logout", async ({ login: page, baseURL }) => { await page.goto("/"); - await expect(page).toHaveTitle("Visitenbuch"); - await expect(page.locator("h1.heading")).toHaveText("Hallo, " + USERNAME); - // Test cases may create more entries - expect(parseInt(await page.getByTestId("n-entries-todo").innerText())) - .toBeGreaterThanOrEqual(193); -}); - -test("logout", async ({ page, baseURL }) => { - await page.goto("/"); - await loginIfNecessary(page); - await page.goto("/logout"); await page.getByTestId("btn-logout").click(); - await page.locator('button[value="yes"]').click(); + + // Sometimes the OIDC provider asks for login confirmation + if (page.url().startsWith(OIDC_BASE_URL)) { + await page.locator('button[value="yes"]').click(); + } + await page.waitForURL("/login?noAuto=1"); await expect(page.getByTestId("btn-login")).toBeVisible(); expect(await isLoggedIn(page)).toBe(false); diff --git a/tests/e2e/plan.test.ts b/tests/e2e/plan.test.ts index 3c6fcff..62aa555 100644 --- a/tests/e2e/plan.test.ts +++ b/tests/e2e/plan.test.ts @@ -1,9 +1,6 @@ -import { test, expect } from "@playwright/test"; +import { test, expect } from "./_test"; -import { loginWithToken } from "$tests/helpers/login"; - -test("filter", async ({ page }) => { - await loginWithToken(page); +test("filter", async ({ login: page }) => { await page.goto("/plan"); await expect(page).toHaveTitle("Planung"); diff --git a/tests/helpers/login.ts b/tests/helpers/login.ts deleted file mode 100644 index 3521ee9..0000000 --- a/tests/helpers/login.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { encode } from "@auth/core/jwt"; -import { expect, type Page } from "@playwright/test"; - -import { prisma } from "$lib/server/prisma"; - -const AUTH_COOKIE = "authjs.session-token"; - -export const OIDC_BASE_URL = "http://localhost:9090/interaction/"; -export const USERNAME = "Tico Testboy"; -export const USER_EMAIL = "t.testboy@example.org"; - -export async function loginIfNecessary(page: Page) { - if (page.url().startsWith(OIDC_BASE_URL)) { - await page.locator('input[name="login"]').fill("Lucy Login"); - await page.locator('input[name="password"]').fill("1234"); - await page.locator("button.login-submit").click(); - await page.getByRole("button", { name: "Continue" }).click(); - expect(await isLoggedIn(page)).toBe(true); - } -} - -export async function isLoggedIn(page: Page): Promise { - const cookies = await page.context().cookies(); - return cookies.findIndex((c) => c.name === AUTH_COOKIE) !== -1; -} - -/** - * Create a session token (Cookie: authjs.session-token) to use for E2E tests - * so we dont have to step through the login system every time - */ -export async function newSessionToken(user_id: number): Promise { - const user = await prisma.user.findUniqueOrThrow({ - select: { email: true, name: true }, - where: { id: user_id }, - }); - return encode({ - salt: AUTH_COOKIE, - secret: process.env.AUTH_SECRET!, - token: { - name: user.name, - email: user.email, - sub: user_id.toString(), - id: user_id.toString(), - }, - }); -} - -export async function loginWithToken(page: Page, user_id = 1) { - const token = await newSessionToken(user_id); - await page.context().addCookies([{ - name: AUTH_COOKIE, - value: token, - domain: "localhost", - path: "/", - httpOnly: true, - sameSite: "Lax", - }]); -} From 3aba85e41191f00a750efb140cc0c06a9ad9d5c5 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 15:40:18 +0200 Subject: [PATCH 16/41] ci: dont print build log for E2E tests --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 846b432..7dc226c 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -49,7 +49,7 @@ jobs: - name: πŸ‘¨β€πŸ”¬ E2E test id: e2etest run: | - npm run build + npm run build -l silent npm run test:e2e - name: πŸ’’ Upload E2E report if: ${{ failure() && steps.e2etest.conclusion == 'failure' }} From fd4cb0c96f70265031befa5e00ddc192dd5e00bb Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 15:52:53 +0200 Subject: [PATCH 17/41] ci: fix: use pnpm run --- .forgejo/workflows/ci.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 7dc226c..e6dfd6e 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -38,19 +38,19 @@ jobs: cp .env.test .env - name: 🧐 lint run: | - npm run check - npm run lint + pnpm run check + pnpm run lint - name: πŸ§ͺ Unit test - run: npm run test:unit + run: pnpm run test:unit - name: πŸ§ͺ Integration test run: | npx prisma migrate reset --force - npm run test:integration + pnpm run test:integration - name: πŸ‘¨β€πŸ”¬ E2E test id: e2etest run: | - npm run build -l silent - npm run test:e2e + pnpm run build -l silent + pnpm run test:e2e - name: πŸ’’ Upload E2E report if: ${{ failure() && steps.e2etest.conclusion == 'failure' }} uses: https://code.forgejo.org/forgejo/upload-artifact@v4 @@ -72,7 +72,7 @@ jobs: - name: πŸ“¦ pnpm install run: pnpm install - name: βš’οΈ Build web application - run: npm run build + run: pnpm run build - name: πŸ‹ Build docker image uses: https://code.thetadev.de/ThetaDev/action-kaniko@v1 with: From 3b2f34952ac18d5a209ff2b189bc899815419359 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 15:53:11 +0200 Subject: [PATCH 18/41] chore(release): release v0.3.3 --- CHANGELOG.md | 17 +++++++++++++++++ package.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 879e1cd..bda8d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. +## [v0.3.3](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.2..v0.3.3) - 2024-05-14 + +### πŸš€ Features + +- Add E2E testing - ([8d9b75c](https://code.thetadev.de/HSA/Visitenbuch/commit/8d9b75c5fd634ae547c2690a68957264a6d447e4)) +- Make page printable - ([04d9883](https://code.thetadev.de/HSA/Visitenbuch/commit/04d9883c9655379301e0c41cc55ebdaa90c68821)) + +### πŸ› Bug Fixes + +- Update ESLint config and fix lints - ([009729b](https://code.thetadev.de/HSA/Visitenbuch/commit/009729b877e4f050fa0d1159aaa86dd43d534621)) +- FilterList selection hides items from other FilterLists - ([cc1ebaf](https://code.thetadev.de/HSA/Visitenbuch/commit/cc1ebaff1a4573970f04dc44591ee7e9afb9a842)) + +### πŸ§ͺ Testing + +- Use fixtures for E2E tests, fix wrong OIDC URL in CI - ([cbc7d65](https://code.thetadev.de/HSA/Visitenbuch/commit/cbc7d65103695565db64b4770cce71f5d37920b6)) + + ## [v0.3.2](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.1..v0.3.2) - 2024-05-13 ### πŸ› Bug Fixes diff --git a/package.json b/package.json index 61fcd29..bc6e46c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visitenbuch", - "version": "0.3.2", + "version": "0.3.3", "private": true, "license": "AGPL-3.0", "scripts": { From 068c7961ae223324b827c9db71293fa5ad88485d Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 16:07:25 +0200 Subject: [PATCH 19/41] ci: set fetch-depth to 1 to extract tag messages --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index e6dfd6e..dc1114b 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -67,7 +67,7 @@ jobs: - name: πŸ‘οΈ Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 1 # important to fetch tag logs - name: πŸ“¦ pnpm install run: pnpm install From f76e7fd97f62d9b41ecbabc3334c2c1876be253d Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 16:28:23 +0200 Subject: [PATCH 20/41] fix: escape HTML for licenses file --- src/app.html | 2 +- vite.config.ts | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/app.html b/src/app.html index 5f0dd88..50038b5 100644 --- a/src/app.html +++ b/src/app.html @@ -1,5 +1,5 @@ - + diff --git a/vite.config.ts b/vite.config.ts index 9d34322..195765a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,7 +23,8 @@ export default defineConfig({ createViteLicensePlugin({ additionalFiles: { "oss-licenses.html": (packages) => { - let res = ` + let res = ` + Visitenbuch - Lizenzen @@ -31,6 +32,12 @@ export default defineConfig({

Open-Source-Lizenzen

JSON-formatted license list `; + const escapeHTML = (s: string | null) => s ? s.replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">") + .replaceAll('"', """) + .replaceAll("'", "'") : ""; + for (const _p of packages) { type LicenseMetaExt = LicenseMeta & { repository: string | null, @@ -54,13 +61,13 @@ export default defineConfig({ } res += `
\n`; - res += `

${p.name}

\n`; + res += `

${escapeHTML(p.name)}

\n`; res += `\n`; - res += `\n`; - if (aut) res += `\n`; - res += `\n`; - if (repoUrl) res += `\n`; - else if (rp) res += `\n`; + res += `\n`; + if (aut) res += `\n`; + res += `\n`; + if (repoUrl) res += `\n`; + else if (rp) res += `\n`; res += `
Version:${p.version}
Author:${aut}
License:${p.license}
Repository:${repoUrl}
Repository:${rp}
Version:${escapeHTML(p.version)}
Author:${escapeHTML(aut)}
License:${escapeHTML(p.license)}
Repository:${escapeHTML(repoUrl)}
Repository:${escapeHTML(rp)}
\n`; res += "
"; } From d5e9a9469f0c57939367141985a97d8404fd6fbe Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 14 May 2024 22:51:20 +0200 Subject: [PATCH 21/41] fix: use btn-id class for all tables --- src/lib/components/table/PatientTable.svelte | 2 +- src/routes/(app)/rooms/+page.svelte | 2 +- src/routes/(app)/stations/+page.svelte | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/components/table/PatientTable.svelte b/src/lib/components/table/PatientTable.svelte index b4ecfed..57f1fbe 100644 --- a/src/lib/components/table/PatientTable.svelte +++ b/src/lib/components/table/PatientTable.svelte @@ -37,7 +37,7 @@ > {patient.id} {#each data.rooms as room (room.id)} - {room.name} + {room.name} {room.station.name} {/each} diff --git a/src/routes/(app)/stations/+page.svelte b/src/routes/(app)/stations/+page.svelte index 010080e..e94e7bf 100644 --- a/src/routes/(app)/stations/+page.svelte +++ b/src/routes/(app)/stations/+page.svelte @@ -27,7 +27,7 @@ {#each data.stations as station (station.id)} - {station.name} + {station.name} {/each} From a4eebb944f55da8e87cc899eebada0bd3fd37aa8 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Thu, 16 May 2024 17:29:22 +0200 Subject: [PATCH 22/41] fix: avoid global state, use context for savedFilters --- .forgejo/workflows/ci.yaml | 1 + src/lib/components/filter/SavedFilters.svelte | 4 +++- src/lib/stores/index.ts | 5 ++++- src/routes/(app)/+layout.svelte | 8 +++++++- src/routes/(app)/+page.svelte | 4 +++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index dc1114b..d2ea852 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -50,6 +50,7 @@ jobs: id: e2etest run: | pnpm run build -l silent + npx playwright install chromium pnpm run test:e2e - name: πŸ’’ Upload E2E report if: ${{ failure() && steps.e2etest.conclusion == 'failure' }} diff --git a/src/lib/components/filter/SavedFilters.svelte b/src/lib/components/filter/SavedFilters.svelte index 5854b2b..20baa2c 100644 --- a/src/lib/components/filter/SavedFilters.svelte +++ b/src/lib/components/filter/SavedFilters.svelte @@ -8,12 +8,14 @@ import { toastError, toastInfo } from "$lib/shared/util/toast"; import Icon from "$lib/components/ui/Icon.svelte"; - import { savedFilters } from "$lib/stores"; + import { getSavedFilters } from "$lib/stores"; import Chip from "./SavedFilterChip.svelte"; export let view: string; + const savedFilters = getSavedFilters(); + $: filters = $savedFilters[view] ?? []; function getQuery(): string { diff --git a/src/lib/stores/index.ts b/src/lib/stores/index.ts index 556cc5d..8d2e2c8 100644 --- a/src/lib/stores/index.ts +++ b/src/lib/stores/index.ts @@ -1,3 +1,4 @@ +import { getContext } from "svelte"; import { derived, writable, type Writable } from "svelte/store"; import type { SavedFilter } from "$lib/shared/model"; @@ -6,4 +7,6 @@ import type { SavedFilter } from "$lib/shared/model"; export const screenWidth = writable(0); export const screenWidthSmall = derived(screenWidth, ($mainWidth) => $mainWidth < 500); -export const savedFilters: Writable> = writable({}); +// Context key: "savedFilters" +export type SavedFilters = Writable>; +export const getSavedFilters: () => SavedFilters = () => getContext("savedFilters"); diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index ef24f7a..8d10a77 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -3,16 +3,22 @@ import type { LayoutData } from "./$types"; import { mdiAccount, mdiHome } from "@mdi/js"; + import { setContext } from "svelte"; + import { writable } from "svelte/store"; import { defaultFilterUrl, defaultVisitUrl } from "$lib/shared/util"; import Icon from "$lib/components/ui/Icon.svelte"; import NavLink from "$lib/components/ui/NavLink.svelte"; - import { savedFilters } from "$lib/stores"; + import type { SavedFilters } from "$lib/stores"; export let data: LayoutData; + const savedFilters: SavedFilters = writable(); + $: savedFilters.set(data.savedFilters); + + setContext("savedFilters", savedFilters); From cdb344609cde80084876faea9f80e7b26b01d0f2 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Thu, 16 May 2024 18:47:16 +0200 Subject: [PATCH 24/41] fix: remove process.on hooks (not necessary) --- src/hooks.server.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/hooks.server.ts b/src/hooks.server.ts index a7fddf5..87c81a0 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -31,7 +31,3 @@ export const handle = sequence( authorization, createTRPCHandle({ router, createContext }), ); - -// Allow server application to exit -process.on("SIGINT", () => process.exit()); // Ctrl+C -process.on("SIGTERM", () => process.exit()); // docker stop From 88a5040f9c4e19ae3efb5ad0894c8dc5b905a92e Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Thu, 16 May 2024 19:42:26 +0200 Subject: [PATCH 25/41] fix: autocomplete not closing on tab --- src/lib/components/filter/Autocomplete.svelte | 51 ++++++++----------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/lib/components/filter/Autocomplete.svelte b/src/lib/components/filter/Autocomplete.svelte index 035b387..7a20f6d 100644 --- a/src/lib/components/filter/Autocomplete.svelte +++ b/src/lib/components/filter/Autocomplete.svelte @@ -166,6 +166,14 @@ if (opened) { onClose(kb); } + // select remaining item if autoselect is enabled + if (!selection) { + if (!noAutoselect1 && filteredItems.length === 1) { + selectListItem(filteredItems[0], true); + } else { + setInputValue(""); + } + } opened = false; } @@ -185,43 +193,38 @@ } function onKeyDown(e: KeyboardEvent): void { - let { key } = e; - if (key === "Tab" && e.shiftKey) key = "ShiftTab"; - const fnmap: Record void> = { - Tab: () => close, - ShiftTab: () => close, - ArrowDown: () => { + switch (e.key) { + case "Tab": + close(); + break; + case "ArrowDown": open(); if (highlightIndex < filteredItems.length - 1) { highlightIndex++; highlight(); } - }, - ArrowUp: () => { + break; + case "ArrowUp": open(); if (highlightIndex > 0) { highlightIndex--; highlight(); } - }, - Escape: () => { + break; + case "Escape": e.stopPropagation(); if (opened) { if (inputElm) inputElm.focus(); close(); } - }, - Backspace: () => { + break; + case "Backspace": if (inputValue().length === 0) { onBackspace(); } else if (selection) { clearSelection(); } - }, - }; - const fn = fnmap[key]; - if (typeof fn === "function") { - fn(); + break; } } @@ -234,17 +237,6 @@ } } - function onBlur(): void { - if (!selection) { - if (!noAutoselect1 && filteredItems.length === 1) { - selectListItem(filteredItems[0], true); - } else { - setInputValue(""); - } - } - close(true); - } - function highlight(): void { if (browser && opened) { window.setTimeout(() => { @@ -304,12 +296,11 @@ on:focus={open} on:keydown={onKeyDown} on:keypress={onKeyPress} - on:blur={onBlur} use:floatingRef /> {#if opened && filteredItems.length > 0} -
+
{#each filteredItems as item, i}
Date: Thu, 16 May 2024 20:19:55 +0200 Subject: [PATCH 26/41] feat: select table entries on doubleclick --- src/lib/components/table/EntryTable.svelte | 3 +++ src/lib/components/table/PatientTable.svelte | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/lib/components/table/EntryTable.svelte b/src/lib/components/table/EntryTable.svelte index 42c2990..4af0262 100644 --- a/src/lib/components/table/EntryTable.svelte +++ b/src/lib/components/table/EntryTable.svelte @@ -1,4 +1,6 @@ +
{#each { length: 4 } as _, i} - - -
From b696ee88940f4d259b7f2287ab20b7236b08cf54 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 20 May 2024 15:11:32 +0200 Subject: [PATCH 38/41] chore(release): release v0.3.5 --- CHANGELOG.md | 22 ++++++++++++++++++++++ package.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e50f81d..0540fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. +## [v0.3.5](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.4..v0.3.5) - 2024-05-20 + +### πŸš€ Features + +- Focus filter bar when pressing F - ([ad796dc](https://code.thetadev.de/HSA/Visitenbuch/commit/ad796dcb578b79b566559d1c22c99f0231a03251)) +- Add optional Keycloak endpoint config - ([d746e47](https://code.thetadev.de/HSA/Visitenbuch/commit/d746e4787d70080bbc22b37263bbfa695c1a7d72)) + +### πŸ› Bug Fixes + +- Dont create entry executions if entry is only postponed - ([34e54fa](https://code.thetadev.de/HSA/Visitenbuch/commit/34e54fa4afdf17e7258cbc5ccac5a3d094ee161b)) +- HumanDate capitalization - ([f4f03ab](https://code.thetadev.de/HSA/Visitenbuch/commit/f4f03ab4914f850b15acf7bb39da34b1abb587a7)) +- Filterbar does not exclude present filters from URL, text filters dont confirm when defocused - ([9ed5f15](https://code.thetadev.de/HSA/Visitenbuch/commit/9ed5f15b9ef237cc400b069928baeb920b2d3681)) +- [**breaking**] Ensure category, room and station names are unique - ([98c62ac](https://code.thetadev.de/HSA/Visitenbuch/commit/98c62ac4603fa6d7c97e1a439f613379db7a2587)) +- Allow multiple date filters - ([2a4bda7](https://code.thetadev.de/HSA/Visitenbuch/commit/2a4bda70c6cfd85b4a32989a2e19ba718cc7717e)) +- Add dumb-init to docker image - ([47f0a08](https://code.thetadev.de/HSA/Visitenbuch/commit/47f0a08ea3dbd8b1721a11c52b36c42ad56e8e29)) +- Remove test route - ([03f6c58](https://code.thetadev.de/HSA/Visitenbuch/commit/03f6c5848201eff02999c6b9323ec1515d68fd5a)) + +### βš™οΈ Miscellaneous Tasks + +- Remove unused zod-form-data dependency - ([882ae66](https://code.thetadev.de/HSA/Visitenbuch/commit/882ae66a6a137259388525df2c91b8e1ed924d86)) + + ## [v0.3.4](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.3..v0.3.4) - 2024-05-16 ### πŸš€ Features diff --git a/package.json b/package.json index 67220ca..1bde82a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visitenbuch", - "version": "0.3.4", + "version": "0.3.5", "private": true, "license": "AGPL-3.0", "scripts": { From 8179c83383756006fb2cb4429ce1ddb6b61e5d94 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 20 May 2024 22:59:27 +0200 Subject: [PATCH 39/41] update README --- README.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1f1a26e..5eec35a 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,24 @@ The project template was created using [`create-svelte`](https://github.com/svel Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: ```bash -npm run dev +pnpm run dev # or start the server and open the app in a new browser tab -npm run dev -- --open +pnpm run dev -- --open ``` -### Handle the prisma ORM +### Test environment + +The project depends on a PostgreSQL database and an OIDC authentication server. +You can setup both using the `run/db_up.sh` script. This creates a new testing environment using +docker-compose and fills the test database with mock data + +### Use the Pisma ORM + +If you apply changes to the database scheme, you have to create a new migration to apply these changes to +the database. ```bash -./run/db_up.sh # Start the docker container, create a new database and run migrations + insert test data npx prisma migrate dev --name my_migration --create-only # Create a new migration npx prisma migrate dev # Apply migrations to the database ``` @@ -28,13 +36,21 @@ npx prisma migrate dev # Apply migrations to the database To create a production version of your app: ```bash -npm run build +pnpm run build ``` You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +### Test + +```bash +pnpm test # Unit- und Integrationstests +pnpm test:e2e # End2End-Tests +``` + + ### Release To release a new version, tun the release script with the new version as a parameter @@ -42,3 +58,10 @@ To release a new version, tun the release script with the new version as a param ```bash ./release.sh 1.0.0 ``` + +### Building docker image + +```bash +pnpm run build +docker build -t thetadev256/visitenbuch . +``` From 297f5cfa925925956b7951ef3afeff7058971f30 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 21 May 2024 03:58:13 +0200 Subject: [PATCH 40/41] update README --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5eec35a..cc42fac 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ for the university hospital in Augsburg ## Development -The project template was created using [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). +The project template was created using +[`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: +Once you've created a project and installed dependencies with `npm install` (or +`pnpm install` or `yarn`), start a development server: ```bash pnpm run dev @@ -17,14 +19,17 @@ pnpm run dev -- --open ### Test environment -The project depends on a PostgreSQL database and an OIDC authentication server. -You can setup both using the `run/db_up.sh` script. This creates a new testing environment using -docker-compose and fills the test database with mock data +Copy the `.env.example` file to `.env` to get access to the required configuration +variables. + +The project depends on a PostgreSQL database and an OIDC authentication server. You can +setup both using the `run/db_up.sh` script. This creates a new testing environment using +docker-compose and fills the test database with mock data. ### Use the Pisma ORM -If you apply changes to the database scheme, you have to create a new migration to apply these changes to -the database. +If you apply changes to the database scheme, you have to create a new migration to apply +these changes to the database. ```bash npx prisma migrate dev --name my_migration --create-only # Create a new migration @@ -41,7 +46,8 @@ pnpm run build You can preview the production build with `npm run preview`. -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +> To deploy your app, you may need to install an +> [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. ### Test @@ -50,7 +56,6 @@ pnpm test # Unit- und Integrationstests pnpm test:e2e # End2End-Tests ``` - ### Release To release a new version, tun the release script with the new version as a parameter From 4cbf1ca7c3d4e5a604095ef3a8913ec54f32e4ea Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 24 May 2024 17:49:06 +0200 Subject: [PATCH 41/41] ci: set fetch-depth to 0 --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index d2ea852..c286741 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -68,7 +68,7 @@ jobs: - name: πŸ‘οΈ Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 1 # important to fetch tag logs + fetch-depth: 0 # important to fetch tag logs - name: πŸ“¦ pnpm install run: pnpm install