From 226df14ad06c7f4edf32636d3f425454785fa636 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 17:07:59 +0300 Subject: [PATCH 01/13] feat: add simple e2e tests --- .github/workflows/e2e.yml | 44 +++++ e2e/.gitignore | 7 + e2e/config.e2e.yaml | 22 +++ e2e/docker-compose.e2e.yml | 34 ++++ e2e/fixtures/auth.fixtures.ts | 47 +++++ e2e/package.json | 30 +++ e2e/playwright.config.ts | 46 +++++ e2e/pnpm-lock.yaml | 338 ++++++++++++++++++++++++++++++++++ e2e/specs/apps.spec.ts | 28 +++ e2e/specs/auth.spec.ts | 48 +++++ 10 files changed, 644 insertions(+) create mode 100644 .github/workflows/e2e.yml create mode 100644 e2e/.gitignore create mode 100644 e2e/config.e2e.yaml create mode 100644 e2e/docker-compose.e2e.yml create mode 100644 e2e/fixtures/auth.fixtures.ts create mode 100644 e2e/package.json create mode 100644 e2e/playwright.config.ts create mode 100644 e2e/pnpm-lock.yaml create mode 100644 e2e/specs/apps.spec.ts create mode 100644 e2e/specs/auth.spec.ts diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..3aa4105e --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,44 @@ +name: Run e2e tests +on: + workflow_dispatch: + pull_request: + branches: + - main + +jobs: + test: + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + + - name: Setup pnpm + uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # ratchet:pnpm/action-setup@v6 + with: + package_json_file: ./e2e/package.json + + - name: Set up Docker + uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # ratchet:docker/setup-docker-action@v5 + + - name: Install dependencies + run: npm install -g pnpm && pnpm install + with: + working-directory: e2e + + - name: Install Playwright Browsers + run: pnpm exec playwright install --with-deps + with: + working-directory: e2e + + - name: Run Playwright tests + run: pnpm exec playwright test + with: + working-directory: e2e + + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: e2e/playwright-report/ + retention-days: 5 diff --git a/e2e/.gitignore b/e2e/.gitignore new file mode 100644 index 00000000..276a277c --- /dev/null +++ b/e2e/.gitignore @@ -0,0 +1,7 @@ +# playwright files +/node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ +/playwright/.auth/ diff --git a/e2e/config.e2e.yaml b/e2e/config.e2e.yaml new file mode 100644 index 00000000..9ea3d482 --- /dev/null +++ b/e2e/config.e2e.yaml @@ -0,0 +1,22 @@ +appUrl: http://tinyauth.127.0.0.1.sslip.io + +log: + level: debug + +auth: + users: + # user1:password,user2:password,user3:password:token + - user1:$2a$10$h1laww4k5a4bJcG5KwE3nO45YKSC4mOKHxbcccgxr3Y7H9zHlQe8e + - user2:$2a$10$h1laww4k5a4bJcG5KwE3nO45YKSC4mOKHxbcccgxr3Y7H9zHlQe8e + - user3:$2a$10$h1laww4k5a4bJcG5KwE3nO45YKSC4mOKHxbcccgxr3Y7H9zHlQe8e:MVR4JQWNXYKNM6HHJEYEFP2O74QIIEJE + # disable rate limits for multiple workers to work + loginMaxRetries: 0 + +apps: + whoami: + config: + domain: whoami.127.0.0.1.sslip.io + path: + allow: /foo + users: + allow: user1 \ No newline at end of file diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml new file mode 100644 index 00000000..280c2c90 --- /dev/null +++ b/e2e/docker-compose.e2e.yml @@ -0,0 +1,34 @@ +services: + traefik: + image: traefik:v3.6 + command: | + --api.insecure=true + --providers.docker + --entrypoints.web.address=:80 + ports: + - 80:80 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + whoami: + image: traefik/whoami:latest + labels: + traefik.enable: true + traefik.http.routers.whoami.rule: Host(`whoami.127.0.0.1.sslip.io`) + traefik.http.routers.whoami.middlewares: tinyauth + + tinyauth: + build: + context: ../ + dockerfile: Dockerfile + args: + - VERSION=e2e + - BUILD_TAGS=nomsgpack + - LD_FLAGS=-s -w + command: ["--configfile", "/app/config.yaml"] + volumes: + - ./config.e2e.yaml:/app/config.yaml:ro + labels: + traefik.enable: true + traefik.http.routers.tinyauth.rule: Host(`tinyauth.127.0.0.1.sslip.io`) + traefik.http.middlewares.tinyauth.forwardauth.address: http://tinyauth:3000/api/auth/traefik \ No newline at end of file diff --git a/e2e/fixtures/auth.fixtures.ts b/e2e/fixtures/auth.fixtures.ts new file mode 100644 index 00000000..73b612fc --- /dev/null +++ b/e2e/fixtures/auth.fixtures.ts @@ -0,0 +1,47 @@ +import {expect, Page} from '@playwright/test'; +import { OTP } from 'otplib'; + +export class LoginFixture { + constructor(public readonly page: Page) {} + + async run(username: string, password: string) { + await expect(this.page.getByText('Welcome back, please login')).toBeVisible(); + await this.page.getByLabel('Username').fill(username); + await this.page.getByLabel('Password').fill(password); + await this.page.getByRole('button', { name: 'Login' }).click(); + } + + async expectSuccess(username: string) { + await expect(this.page.getByText(`You are currently logged in as ${username}.`)).toBeVisible() + } +} + +export class LogoutFixture { + constructor(public readonly page: Page) {} + + async run() { + await expect(this.page.getByText('Click the button below to logout.')).toBeVisible(); + await this.page.getByRole('button', { name: 'Logout' }).click(); + } + + async expectSuccess() { + await expect(this.page.getByText('Welcome back, please login')).toBeVisible(); + } +} + +export class TOTPFixture { + constructor(public readonly page: Page) {} + + async run(secret: string) { + await expect(this.page.getByText('Enter your TOTP code')).toBeVisible(); + const otp = new OTP(); + const token = await otp.generate({ secret }); + await this.page.getByPlaceholder('XXXXXX').fill(token); + // we shouldn't need to click continue, it will auto submit + // await this.page.getByRole('button', { name: 'Continue' }).click(); + } + + async expectSuccess(username: string) { + await expect(this.page.getByText(`You are currently logged in as ${username}.`)).toBeVisible() + } +} \ No newline at end of file diff --git a/e2e/package.json b/e2e/package.json new file mode 100644 index 00000000..b42e3b59 --- /dev/null +++ b/e2e/package.json @@ -0,0 +1,30 @@ +{ + "name": "e2e", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "down": "docker compose -f docker-compose.e2e.yml down", + "up": "docker compose -f docker-compose.e2e.yml up --build --pull=always --force-recreate --remove-orphans", + "test": "playwright test", + "report": "playwright show-report" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devEngines": { + "packageManager": { + "name": "pnpm", + "version": "^11.1.2", + "onFail": "download" + } + }, + "type": "module", + "devDependencies": { + "@playwright/test": "^1.61.1", + "@types/node": "^26.1.1" + }, + "dependencies": { + "otplib": "^13.4.1" + } +} diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts new file mode 100644 index 00000000..46c128a9 --- /dev/null +++ b/e2e/playwright.config.ts @@ -0,0 +1,46 @@ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + testDir: './specs', + fullyParallel: true, + forbidOnly: false, + retries: 0, + workers: 4, + reporter: 'html', + use: { + trace: 'on-first-retry', + video: 'on', + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + { + name: 'Mobile Chrome', + use: { ...devices['Pixel 5'] }, + }, + { + name: 'Mobile Safari', + use: { ...devices['iPhone 12'] }, + }, + ], + webServer: { + command: 'docker compose -f docker-compose.e2e.yml up --build --pull=always --force-recreate --remove-orphans', + url: 'http://tinyauth.127.0.0.1.sslip.io/api/healthz', + reuseExistingServer: true, + gracefulShutdown: { + signal: 'SIGINT', + timeout: 1000, + }, + }, +}); diff --git a/e2e/pnpm-lock.yaml b/e2e/pnpm-lock.yaml new file mode 100644 index 00000000..93b50bea --- /dev/null +++ b/e2e/pnpm-lock.yaml @@ -0,0 +1,338 @@ +--- +lockfileVersion: '9.0' + +importers: + + .: + configDependencies: {} + packageManagerDependencies: + '@pnpm/exe': + specifier: ^11.1.2 + version: 11.13.1 + pnpm: + specifier: ^11.1.2 + version: 11.13.1 + +packages: + + '@pnpm/exe@11.13.1': + resolution: {integrity: sha512-P4euEK6lOFnd5oTHEc5M/HhvyF4XUhTnVsklEcM6rmY0QJxPD6xbT+u1+gskEIBp4nSRorz20IJQtAU1Nerggg==} + hasBin: true + + '@pnpm/linux-arm64@11.13.1': + resolution: {integrity: sha512-wB8zloqrYrudPyuA5qbuTCnJGe4eETPwqOjoPjoyyyvA4zFI5XfLpxgqOOcaY5UJBoqzckcGpRVDwhSRfsQ/6A==} + cpu: [arm64] + os: [linux] + + '@pnpm/linux-x64@11.13.1': + resolution: {integrity: sha512-A+wnEvzfWEvanXiwww3tnOPmtjPSrrf5tOP6vk8+K0BRFEe/Df0oPytm2nWgGcn5iwPnqtr1Btkof913McnSPA==} + cpu: [x64] + os: [linux] + + '@pnpm/linuxstatic-arm64@11.13.1': + resolution: {integrity: sha512-k4t65VeqRX4COMFe45TF58CVmCpmAsKZShaR1HobmUeleo98mWTctggKolrA2MHcVUeSS+12yB5Urb3uDazhmw==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@pnpm/linuxstatic-x64@11.13.1': + resolution: {integrity: sha512-A65GqPzwCl0bAMk3kRWfbjSRBm5RRaqR2oMxV/9AYZrwO0X9yEfngbLBISCPHjt6/Qe4nH7DFemyhy6yODYwEw==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@pnpm/macos-arm64@11.13.1': + resolution: {integrity: sha512-MJvOtyGOWSfBoqdVEfAH8ljmHs13mt82k/UxN4f+q7koDxJRR2n4Nie6Og6RwbnbaubCz0Fh2bTeL1+MxDSFpA==} + cpu: [arm64] + os: [darwin] + + '@pnpm/win-arm64@11.13.1': + resolution: {integrity: sha512-kl/g1cCKOJPe4HntspyrAJW0LRco0UHnVfxHSspezo4Zj4AanJAZ8WzLqfa6/w3lBSKHTEN4x0pb3m4J7B7Vpw==} + cpu: [arm64] + os: [win32] + + '@pnpm/win-x64@11.13.1': + resolution: {integrity: sha512-Bcb14NeBlbHS2Gq1qr8VnCiAz5eC1lYzXOls7zH0bnV0Taaj4/xyfm0HVO4dn9R2TQtVtz1qnBZHHL9PDFumqQ==} + cpu: [x64] + os: [win32] + + '@reflink/reflink-darwin-arm64@0.1.19': + resolution: {integrity: sha512-ruy44Lpepdk1FqDz38vExBY/PVUsjxZA+chd9wozjUH9JjuDT/HEaQYA6wYN9mf041l0yLVar6BCZuWABJvHSA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + '@reflink/reflink-darwin-x64@0.1.19': + resolution: {integrity: sha512-By85MSWrMZa+c26TcnAy8SDk0sTUkYlNnwknSchkhHpGXOtjNDUOxJE9oByBnGbeuIE1PiQsxDG3Ud+IVV9yuA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + '@reflink/reflink-linux-arm64-gnu@0.1.19': + resolution: {integrity: sha512-7P+er8+rP9iNeN+bfmccM4hTAaLP6PQJPKWSA4iSk2bNvo6KU6RyPgYeHxXmzNKzPVRcypZQTpFgstHam6maVg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@reflink/reflink-linux-arm64-musl@0.1.19': + resolution: {integrity: sha512-37iO/Dp6m5DDaC2sf3zPtx/hl9FV3Xze4xoYidrxxS9bgP3S8ALroxRK6xBG/1TtfXKTvolvp+IjrUU6ujIGmA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@reflink/reflink-linux-x64-gnu@0.1.19': + resolution: {integrity: sha512-jbI8jvuYCaA3MVUdu8vLoLAFqC+iNMpiSuLbxlAgg7x3K5bsS8nOpTRnkLF7vISJ+rVR8W+7ThXlXlUQ93ulkw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@reflink/reflink-linux-x64-musl@0.1.19': + resolution: {integrity: sha512-e9FBWDe+lv7QKAwtKOt6A2W/fyy/aEEfr0g6j/hWzvQcrzHCsz07BNQYlNOjTfeytrtLU7k449H1PI95jA4OjQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@reflink/reflink-win32-arm64-msvc@0.1.19': + resolution: {integrity: sha512-09PxnVIQcd+UOn4WAW73WU6PXL7DwGS6wPlkMhMg2zlHHG65F3vHepOw06HFCq+N42qkaNAc8AKIabWvtk6cIQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + + '@reflink/reflink-win32-x64-msvc@0.1.19': + resolution: {integrity: sha512-E//yT4ni2SyhwP8JRjVGWr3cbnhWDiPLgnQ66qqaanjjnMiu3O/2tjCPQXlcGc/DEYofpDc9fvhv6tALQsMV9w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + + '@reflink/reflink@0.1.19': + resolution: {integrity: sha512-DmCG8GzysnCZ15bres3N5AHCmwBwYgp0As6xjhQ47rAUTUXxJiK+lLUxaGsX3hd/30qUpVElh05PbGuxRPgJwA==} + engines: {node: '>= 10'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + pnpm@11.13.1: + resolution: {integrity: sha512-svx2g7imUlQU59E+G6KMqt3elr9m7FQL+ut+cCuB8+C+TR8pXt9/n+A5Z0Co3ORQnFgt33mJH0VD/qMtN2RfJQ==} + engines: {node: '>=22.13'} + hasBin: true + +snapshots: + + '@pnpm/exe@11.13.1': + dependencies: + '@reflink/reflink': 0.1.19 + detect-libc: 2.1.2 + optionalDependencies: + '@pnpm/linux-arm64': 11.13.1 + '@pnpm/linux-x64': 11.13.1 + '@pnpm/linuxstatic-arm64': 11.13.1 + '@pnpm/linuxstatic-x64': 11.13.1 + '@pnpm/macos-arm64': 11.13.1 + '@pnpm/win-arm64': 11.13.1 + '@pnpm/win-x64': 11.13.1 + + '@pnpm/linux-arm64@11.13.1': + optional: true + + '@pnpm/linux-x64@11.13.1': + optional: true + + '@pnpm/linuxstatic-arm64@11.13.1': + optional: true + + '@pnpm/linuxstatic-x64@11.13.1': + optional: true + + '@pnpm/macos-arm64@11.13.1': + optional: true + + '@pnpm/win-arm64@11.13.1': + optional: true + + '@pnpm/win-x64@11.13.1': + optional: true + + '@reflink/reflink-darwin-arm64@0.1.19': + optional: true + + '@reflink/reflink-darwin-x64@0.1.19': + optional: true + + '@reflink/reflink-linux-arm64-gnu@0.1.19': + optional: true + + '@reflink/reflink-linux-arm64-musl@0.1.19': + optional: true + + '@reflink/reflink-linux-x64-gnu@0.1.19': + optional: true + + '@reflink/reflink-linux-x64-musl@0.1.19': + optional: true + + '@reflink/reflink-win32-arm64-msvc@0.1.19': + optional: true + + '@reflink/reflink-win32-x64-msvc@0.1.19': + optional: true + + '@reflink/reflink@0.1.19': + optionalDependencies: + '@reflink/reflink-darwin-arm64': 0.1.19 + '@reflink/reflink-darwin-x64': 0.1.19 + '@reflink/reflink-linux-arm64-gnu': 0.1.19 + '@reflink/reflink-linux-arm64-musl': 0.1.19 + '@reflink/reflink-linux-x64-gnu': 0.1.19 + '@reflink/reflink-linux-x64-musl': 0.1.19 + '@reflink/reflink-win32-arm64-msvc': 0.1.19 + '@reflink/reflink-win32-x64-msvc': 0.1.19 + + detect-libc@2.1.2: {} + + pnpm@11.13.1: {} + +--- +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + otplib: + specifier: ^13.4.1 + version: 13.4.1 + devDependencies: + '@playwright/test': + specifier: ^1.61.1 + version: 1.61.1 + '@types/node': + specifier: ^26.1.1 + version: 26.1.1 + +packages: + + '@noble/hashes@2.2.0': + resolution: {integrity: sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==} + engines: {node: '>= 20.19.0'} + + '@otplib/core@13.4.1': + resolution: {integrity: sha512-KIXgK1hNtWJEBMTastbe1bpmuais+3f+ATeO8TkMs2rNkfGO1FbQy8+/UWVEu3TR/iTJerU0idkPudaPmLP2BA==} + + '@otplib/hotp@13.4.1': + resolution: {integrity: sha512-g9q04SwpG5ZtMnVkUcgcoAlwCH4YLROZN1qhyBwgkBzqYYVSYhpP6gSGaxGHwePLt1c+e6NqDlgIZN+e1/XPuA==} + + '@otplib/plugin-base32-scure@13.4.1': + resolution: {integrity: sha512-Fs/r5qisC05SRhT6xWXaypB6PVC0vgWf6zztmi0J5RnQ09OJiPDWCJFH6cDm6ANsrdvB9di7X+Jb7L13BoEbUA==} + + '@otplib/plugin-crypto-noble@13.4.1': + resolution: {integrity: sha512-PJfVW8/1hdS6CfxLheKPZSLTwDq4TijZbN4yRjxlv0ODdzmxpM+wGwWr1JXMdy0xJPxLziydQD5gdVqrR4/gAg==} + + '@otplib/totp@13.4.1': + resolution: {integrity: sha512-QOkBVPrf6AM4qZaReZPSk9/I8ATVdZpIISJz115MqeVtcrbcr5llPZ0J7804tpnjnp1vCRkI5Qjd47HhgVteBQ==} + + '@otplib/uri@13.4.1': + resolution: {integrity: sha512-xaIm7bvICMhoB2rZIR5luiaMdssWR5nY5nXnR1fdezUgZuEO58D6zrGzLp7pQuBmlpmL0HagnscDQFoskp9yiA==} + + '@playwright/test@1.61.1': + resolution: {integrity: sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig==} + engines: {node: '>=18'} + hasBin: true + + '@scure/base@2.2.0': + resolution: {integrity: sha512-b8XEupJibegiXV+tDUseI8oLQc8ei3d/4Jkb2RpbHh3MfE054ov3uIz2dhFkB3FI8iwYkEh0gGCApkrYggkPNg==} + + '@types/node@26.1.1': + resolution: {integrity: sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw==} + + fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + otplib@13.4.1: + resolution: {integrity: sha512-o5CxfDw6bh7hoDv0NUUIcc0RqzJ9ipfUrzeKheKJ+vs4rXZnDlA9n4a/7R1cDjpmLjKLix4BgNVRmoDkm5rLSQ==} + + playwright-core@1.61.1: + resolution: {integrity: sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==} + engines: {node: '>=18'} + hasBin: true + + playwright@1.61.1: + resolution: {integrity: sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ==} + engines: {node: '>=18'} + hasBin: true + + undici-types@8.3.0: + resolution: {integrity: sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==} + +snapshots: + + '@noble/hashes@2.2.0': {} + + '@otplib/core@13.4.1': {} + + '@otplib/hotp@13.4.1': + dependencies: + '@otplib/core': 13.4.1 + '@otplib/uri': 13.4.1 + + '@otplib/plugin-base32-scure@13.4.1': + dependencies: + '@otplib/core': 13.4.1 + '@scure/base': 2.2.0 + + '@otplib/plugin-crypto-noble@13.4.1': + dependencies: + '@noble/hashes': 2.2.0 + '@otplib/core': 13.4.1 + + '@otplib/totp@13.4.1': + dependencies: + '@otplib/core': 13.4.1 + '@otplib/hotp': 13.4.1 + '@otplib/uri': 13.4.1 + + '@otplib/uri@13.4.1': + dependencies: + '@otplib/core': 13.4.1 + + '@playwright/test@1.61.1': + dependencies: + playwright: 1.61.1 + + '@scure/base@2.2.0': {} + + '@types/node@26.1.1': + dependencies: + undici-types: 8.3.0 + + fsevents@2.3.2: + optional: true + + otplib@13.4.1: + dependencies: + '@otplib/core': 13.4.1 + '@otplib/hotp': 13.4.1 + '@otplib/plugin-base32-scure': 13.4.1 + '@otplib/plugin-crypto-noble': 13.4.1 + '@otplib/totp': 13.4.1 + '@otplib/uri': 13.4.1 + + playwright-core@1.61.1: {} + + playwright@1.61.1: + dependencies: + playwright-core: 1.61.1 + optionalDependencies: + fsevents: 2.3.2 + + undici-types@8.3.0: {} diff --git a/e2e/specs/apps.spec.ts b/e2e/specs/apps.spec.ts new file mode 100644 index 00000000..f79d977b --- /dev/null +++ b/e2e/specs/apps.spec.ts @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test'; +import {LoginFixture, LogoutFixture} from "../fixtures/auth.fixtures"; + +test('should be able to login to app with forward-auth', async ({ page }) => { + const loginFixture = new LoginFixture(page); + await page.goto('http://whoami.127.0.0.1.sslip.io'); + // redirect to tinyauth + await expect(page.getByText('Welcome back, please login')).toBeVisible() + await loginFixture.run('user1', 'password') + // redirect to app + await expect(page.getByText('whoami.127.0.0.1.sslip.io')).toBeVisible() +}); + +test('non authorized user should not be able to access app', async ({ page }) => { + const loginFixture = new LoginFixture(page); + await page.goto('http://whoami.127.0.0.1.sslip.io'); + // redirect to tinyauth + await expect(page.getByText('Welcome back, please login')).toBeVisible() + // user2 is not authorized to access app + await loginFixture.run('user2', 'password') + // redirect to app + await expect(page.getByText('The user with username user2 is not authorized to access the resource whoami.')).toBeVisible() +}) + +test('allowed path should skip authentication', async ({ page }) => { + await page.goto('http://whoami.127.0.0.1.sslip.io/foo'); + await expect(page.getByText('whoami.127.0.0.1.sslip.io')).toBeVisible() +}) \ No newline at end of file diff --git a/e2e/specs/auth.spec.ts b/e2e/specs/auth.spec.ts new file mode 100644 index 00000000..83eb1e96 --- /dev/null +++ b/e2e/specs/auth.spec.ts @@ -0,0 +1,48 @@ +import { test, expect } from '@playwright/test'; +import {LoginFixture, LogoutFixture, TOTPFixture} from "../fixtures/auth.fixtures"; + +test('should be able to login', async ({ page }) => { + const loginFixture = new LoginFixture(page); + await page.goto('http://tinyauth.127.0.0.1.sslip.io'); + await loginFixture.run('user1', 'password') + await loginFixture.expectSuccess('user1') +}); + +test('should fail to login with wrong credentials', async ({ page }) => { + const loginFixture = new LoginFixture(page); + await page.goto('http://tinyauth.127.0.0.1.sslip.io'); + await loginFixture.run('user27267', 'password') + const toast = page.locator('[data-sonner-toast]').first(); + await expect(toast).toBeVisible(); + await expect(toast).toContainText('Failed to log in'); +}); + + +test('should be able to logout', async ({ page }) => { + const loginFixture = new LoginFixture(page); + await page.goto('http://tinyauth.127.0.0.1.sslip.io'); + await loginFixture.run('user1', 'password') + await loginFixture.expectSuccess('user1') + const logoutFixture = new LogoutFixture(page); + await logoutFixture.run() +}) + +test('should be able to login with totp', async ({ page }) => { + const loginFixture = new LoginFixture(page); + const totpFixture = new TOTPFixture(page); + await page.goto('http://tinyauth.127.0.0.1.sslip.io'); + await loginFixture.run('user3', 'password') + await totpFixture.run('MVR4JQWNXYKNM6HHJEYEFP2O74QIIEJE') + await loginFixture.expectSuccess('user3'); +}); + +test('should fail to login with wrong totp', async ({ page }) => { + const loginFixture = new LoginFixture(page); + const totpFixture = new TOTPFixture(page); + await page.goto('http://tinyauth.127.0.0.1.sslip.io'); + await loginFixture.run('user3', 'password') + await totpFixture.run('VZVMOMQCBN24DJ5VRFAL5TJAZGBHXMN3') + const toast = page.locator('[data-sonner-toast]').first(); + await expect(toast).toBeVisible(); + await expect(toast).toContainText('Failed to verify code'); +}); From 423ad7b7a0593be4755efa98aae9c225c6d5d52a Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 17:18:31 +0300 Subject: [PATCH 02/13] fix: rabbit fixes --- .github/workflows/e2e.yml | 13 ++++++------- e2e/docker-compose.e2e.yml | 4 ++-- e2e/playwright.config.ts | 1 + e2e/specs/apps.spec.ts | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 3aa4105e..dd67328f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7 + with: + persist-credentials: false - name: Setup pnpm uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # ratchet:pnpm/action-setup@v6 @@ -22,19 +24,16 @@ jobs: uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # ratchet:docker/setup-docker-action@v5 - name: Install dependencies - run: npm install -g pnpm && pnpm install - with: - working-directory: e2e + run: pnpm ci + working-directory: e2e - name: Install Playwright Browsers run: pnpm exec playwright install --with-deps - with: - working-directory: e2e + working-directory: e2e - name: Run Playwright tests run: pnpm exec playwright test - with: - working-directory: e2e + working-directory: e2e - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 if: ${{ !cancelled() }} diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index 280c2c90..99885ce1 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -1,6 +1,6 @@ services: traefik: - image: traefik:v3.6 + image: traefik:v3.7.8 command: | --api.insecure=true --providers.docker @@ -11,7 +11,7 @@ services: - /var/run/docker.sock:/var/run/docker.sock whoami: - image: traefik/whoami:latest + image: traefik/whoami:v1.11.0 labels: traefik.enable: true traefik.http.routers.whoami.rule: Host(`whoami.127.0.0.1.sslip.io`) diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index 46c128a9..fc2384ec 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -38,6 +38,7 @@ export default defineConfig({ command: 'docker compose -f docker-compose.e2e.yml up --build --pull=always --force-recreate --remove-orphans', url: 'http://tinyauth.127.0.0.1.sslip.io/api/healthz', reuseExistingServer: true, + timeout: 5 * 60 * 1000, gracefulShutdown: { signal: 'SIGINT', timeout: 1000, diff --git a/e2e/specs/apps.spec.ts b/e2e/specs/apps.spec.ts index f79d977b..ea77b141 100644 --- a/e2e/specs/apps.spec.ts +++ b/e2e/specs/apps.spec.ts @@ -1,5 +1,5 @@ -import { test, expect } from '@playwright/test'; -import {LoginFixture, LogoutFixture} from "../fixtures/auth.fixtures"; +import {expect, test} from '@playwright/test'; +import {LoginFixture} from "../fixtures/auth.fixtures"; test('should be able to login to app with forward-auth', async ({ page }) => { const loginFixture = new LoginFixture(page); From d8ee3e77f8d2dd390337cc8d87b2ecab3dae96b5 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 18:21:18 +0300 Subject: [PATCH 03/13] feat: add netcheck command for debugging --- e2e/docker-compose.e2e.yml | 2 ++ e2e/package.json | 5 +++-- e2e/playwright.config.ts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index 99885ce1..c7bf32ad 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -1,6 +1,7 @@ services: traefik: image: traefik:v3.7.8 + pull_policy: missing command: | --api.insecure=true --providers.docker @@ -12,6 +13,7 @@ services: whoami: image: traefik/whoami:v1.11.0 + pull_policy: missing labels: traefik.enable: true traefik.http.routers.whoami.rule: Host(`whoami.127.0.0.1.sslip.io`) diff --git a/e2e/package.json b/e2e/package.json index b42e3b59..e58501a8 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -5,9 +5,10 @@ "main": "index.js", "scripts": { "down": "docker compose -f docker-compose.e2e.yml down", - "up": "docker compose -f docker-compose.e2e.yml up --build --pull=always --force-recreate --remove-orphans", + "up": "docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans", "test": "playwright test", - "report": "playwright show-report" + "report": "playwright show-report", + "netcheck": "curl http://tinyauth.127.0.0.1.sslip.io/api/healthz && curl localhost" }, "keywords": [], "author": "", diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index fc2384ec..4fd2d019 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -35,7 +35,7 @@ export default defineConfig({ }, ], webServer: { - command: 'docker compose -f docker-compose.e2e.yml up --build --pull=always --force-recreate --remove-orphans', + command: 'pnpm run up && pnpm run netcheck', url: 'http://tinyauth.127.0.0.1.sslip.io/api/healthz', reuseExistingServer: true, timeout: 5 * 60 * 1000, From 4eeede6bcb406f1138e572d9287999accb5b9e9a Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 18:27:42 +0300 Subject: [PATCH 04/13] chore: run dev server in background to see why actions can't reach sslip --- e2e/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/package.json b/e2e/package.json index e58501a8..d4c6331b 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -5,10 +5,10 @@ "main": "index.js", "scripts": { "down": "docker compose -f docker-compose.e2e.yml down", - "up": "docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans", + "up": "docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans -d", "test": "playwright test", "report": "playwright show-report", - "netcheck": "curl http://tinyauth.127.0.0.1.sslip.io/api/healthz && curl localhost" + "netcheck": "cat /etc/resolv.conf && curl http://tinyauth.127.0.0.1.sslip.io/api/healthz && curl localhost" }, "keywords": [], "author": "", From 90ff78b3b8f17b1d9305d886fe83999c7d916bd2 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 18:36:41 +0300 Subject: [PATCH 05/13] chore: add sslip to hosts --- .github/workflows/e2e.yml | 3 +++ e2e/package.json | 6 +++--- e2e/playwright.config.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index dd67328f..fc532e23 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -31,6 +31,9 @@ jobs: run: pnpm exec playwright install --with-deps working-directory: e2e + - name: Add sslip domains to hosts file + run: echo "127.0.0.1 tinyauth.127.0.0.1.sslip.io whoami.127.0.0.1.sslip.io" | sudo tee -a /etc/hosts + - name: Run Playwright tests run: pnpm exec playwright test working-directory: e2e diff --git a/e2e/package.json b/e2e/package.json index d4c6331b..0936fae3 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -5,10 +5,10 @@ "main": "index.js", "scripts": { "down": "docker compose -f docker-compose.e2e.yml down", - "up": "docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans -d", + "up": "docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans", + "logs": "docker compose -f docker-compose.e2e.yml logs -f", "test": "playwright test", - "report": "playwright show-report", - "netcheck": "cat /etc/resolv.conf && curl http://tinyauth.127.0.0.1.sslip.io/api/healthz && curl localhost" + "report": "playwright show-report" }, "keywords": [], "author": "", diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index 4fd2d019..661c7108 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -35,7 +35,7 @@ export default defineConfig({ }, ], webServer: { - command: 'pnpm run up && pnpm run netcheck', + command: 'pnpm run up', url: 'http://tinyauth.127.0.0.1.sslip.io/api/healthz', reuseExistingServer: true, timeout: 5 * 60 * 1000, From 6b77777d59a7d65b39fe9cfc615470653a0257db Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 18:46:33 +0300 Subject: [PATCH 06/13] chore: try a newer nodejs version --- .github/workflows/e2e.yml | 10 ++++++---- e2e/docker-compose.e2e.yml | 1 + e2e/package.json | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index fc532e23..6025b111 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -15,6 +15,11 @@ jobs: with: persist-credentials: false + - name: Setup node + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # ratchet:actions/setup-node@v7 + with: + node-version: 25 + - name: Setup pnpm uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # ratchet:pnpm/action-setup@v6 with: @@ -31,11 +36,8 @@ jobs: run: pnpm exec playwright install --with-deps working-directory: e2e - - name: Add sslip domains to hosts file - run: echo "127.0.0.1 tinyauth.127.0.0.1.sslip.io whoami.127.0.0.1.sslip.io" | sudo tee -a /etc/hosts - - name: Run Playwright tests - run: pnpm exec playwright test + run: pnpm test working-directory: e2e - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index c7bf32ad..1e81b0f0 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -6,6 +6,7 @@ services: --api.insecure=true --providers.docker --entrypoints.web.address=:80 + --log.level=INFO ports: - 80:80 volumes: diff --git a/e2e/package.json b/e2e/package.json index 0936fae3..0320ef85 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -6,7 +6,6 @@ "scripts": { "down": "docker compose -f docker-compose.e2e.yml down", "up": "docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans", - "logs": "docker compose -f docker-compose.e2e.yml logs -f", "test": "playwright test", "report": "playwright show-report" }, From b327dd136523aab1105edddb40d65a0e8e11233b Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 18:51:11 +0300 Subject: [PATCH 07/13] chore: try a different traefik version --- .github/workflows/e2e.yml | 5 ----- e2e/docker-compose.e2e.yml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6025b111..55f4d852 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -15,11 +15,6 @@ jobs: with: persist-credentials: false - - name: Setup node - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # ratchet:actions/setup-node@v7 - with: - node-version: 25 - - name: Setup pnpm uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # ratchet:pnpm/action-setup@v6 with: diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index 1e81b0f0..63685fc6 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -1,6 +1,6 @@ services: traefik: - image: traefik:v3.7.8 + image: traefik:v3.6.23 pull_policy: missing command: | --api.insecure=true From 86c6c71b4e094394e2e1af873e4adab3723b1805 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 19:03:39 +0300 Subject: [PATCH 08/13] fix: use correct docker socket path --- .github/workflows/e2e.yml | 3 +++ e2e/docker-compose.e2e.yml | 4 ++-- e2e/playwright.config.ts | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 55f4d852..a339c2cd 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -21,6 +21,7 @@ jobs: package_json_file: ./e2e/package.json - name: Set up Docker + id: docker uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # ratchet:docker/setup-docker-action@v5 - name: Install dependencies @@ -34,6 +35,8 @@ jobs: - name: Run Playwright tests run: pnpm test working-directory: e2e + env: + DOCKER_SOCKET_PATH: ${{ steps.docker.outputs.sock }} - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 if: ${{ !cancelled() }} diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index 63685fc6..f6689562 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -1,6 +1,6 @@ services: traefik: - image: traefik:v3.6.23 + image: traefik:v3.7.8 pull_policy: missing command: | --api.insecure=true @@ -10,7 +10,7 @@ services: ports: - 80:80 volumes: - - /var/run/docker.sock:/var/run/docker.sock + - ${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock whoami: image: traefik/whoami:v1.11.0 diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index 661c7108..5fa326a6 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -43,5 +43,7 @@ export default defineConfig({ signal: 'SIGINT', timeout: 1000, }, + stderr: 'pipe', + stdout: 'pipe', }, }); From afacc5cb96cfdb5a042284d5993aac43515ebb9f Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 19:09:35 +0300 Subject: [PATCH 09/13] fix: strip out unix prefix from docker socket --- .github/workflows/e2e.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a339c2cd..5ec76358 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -24,6 +24,12 @@ jobs: id: docker uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # ratchet:docker/setup-docker-action@v5 + - name: Get docker socket + id: docker-socket + env: + SOCK: ${{ steps.docker.outputs.sock }} + run: echo "DOCKER_SOCK=${SOCK#unix://}" >> "$GITHUB_ENV" + - name: Install dependencies run: pnpm ci working-directory: e2e @@ -36,7 +42,7 @@ jobs: run: pnpm test working-directory: e2e env: - DOCKER_SOCKET_PATH: ${{ steps.docker.outputs.sock }} + DOCKER_SOCKET_PATH: ${{ steps.docker-socket.outputs.DOCKER_SOCK }} - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 if: ${{ !cancelled() }} From bf83708067efce928ec9fb830111d871933bc836 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 19:17:00 +0300 Subject: [PATCH 10/13] chore: try to omit playwright --- .github/workflows/e2e.yml | 43 +++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 5ec76358..7e4f5e05 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -30,23 +30,30 @@ jobs: SOCK: ${{ steps.docker.outputs.sock }} run: echo "DOCKER_SOCK=${SOCK#unix://}" >> "$GITHUB_ENV" - - name: Install dependencies - run: pnpm ci + - name: Spin up docker-compose + run: docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans -d working-directory: e2e - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps - working-directory: e2e - - - name: Run Playwright tests - run: pnpm test - working-directory: e2e - env: - DOCKER_SOCKET_PATH: ${{ steps.docker-socket.outputs.DOCKER_SOCK }} - - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: playwright-report - path: e2e/playwright-report/ - retention-days: 5 + - name: Check if the url is accessible + run: sleep 20s && curl -v http://tinyauth.127.0.0.1.sslip.io + +# - name: Install dependencies +# run: pnpm ci +# working-directory: e2e +# +# - name: Install Playwright Browsers +# run: pnpm exec playwright install --with-deps +# working-directory: e2e + +# - name: Run Playwright tests +# run: pnpm test +# working-directory: e2e +# env: +# DOCKER_SOCKET_PATH: ${{ steps.docker-socket.outputs.DOCKER_SOCK }} +# +# - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 +# if: ${{ !cancelled() }} +# with: +# name: playwright-report +# path: e2e/playwright-report/ +# retention-days: 5 From 21389021bf24eabcd2820df844c0ea363831e2c3 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 19:20:33 +0300 Subject: [PATCH 11/13] fix: remove custom socket stuff --- .github/workflows/e2e.yml | 7 ------- e2e/docker-compose.e2e.yml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7e4f5e05..f96703d6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -21,15 +21,8 @@ jobs: package_json_file: ./e2e/package.json - name: Set up Docker - id: docker uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # ratchet:docker/setup-docker-action@v5 - - name: Get docker socket - id: docker-socket - env: - SOCK: ${{ steps.docker.outputs.sock }} - run: echo "DOCKER_SOCK=${SOCK#unix://}" >> "$GITHUB_ENV" - - name: Spin up docker-compose run: docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans -d working-directory: e2e diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index f6689562..1e81b0f0 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -10,7 +10,7 @@ services: ports: - 80:80 volumes: - - ${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock + - /var/run/docker.sock:/var/run/docker.sock whoami: image: traefik/whoami:v1.11.0 From 9f9a87eaacd0a3774cb82dee5949eb1136f8a551 Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 19:23:25 +0300 Subject: [PATCH 12/13] idk: use docker ps --- .github/workflows/e2e.yml | 2 +- e2e/docker-compose.e2e.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index f96703d6..8ec6b495 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -28,7 +28,7 @@ jobs: working-directory: e2e - name: Check if the url is accessible - run: sleep 20s && curl -v http://tinyauth.127.0.0.1.sslip.io + run: sleep 10s && docker ps && curl -v http://tinyauth.127.0.0.1.sslip.io # - name: Install dependencies # run: pnpm ci diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index 1e81b0f0..8e515d1d 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -27,7 +27,7 @@ services: args: - VERSION=e2e - BUILD_TAGS=nomsgpack - - LD_FLAGS=-s -w + - LDFLAGS=-s -w command: ["--configfile", "/app/config.yaml"] volumes: - ./config.e2e.yaml:/app/config.yaml:ro From bb1aa7275429fe74933e109b0dc99a193a59b26c Mon Sep 17 00:00:00 2001 From: Stavros Date: Thu, 16 Jul 2026 19:38:19 +0300 Subject: [PATCH 13/13] refactor: replace traefik with caddy --- .github/workflows/e2e.yml | 37 ++++++++++++++----------------------- e2e/conf/Caddyfile | 15 +++++++++++++++ e2e/docker-compose.e2e.yml | 21 ++++----------------- 3 files changed, 33 insertions(+), 40 deletions(-) create mode 100644 e2e/conf/Caddyfile diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8ec6b495..55f4d852 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -23,30 +23,21 @@ jobs: - name: Set up Docker uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # ratchet:docker/setup-docker-action@v5 - - name: Spin up docker-compose - run: docker compose -f docker-compose.e2e.yml up --build --force-recreate --remove-orphans -d + - name: Install dependencies + run: pnpm ci working-directory: e2e - - name: Check if the url is accessible - run: sleep 10s && docker ps && curl -v http://tinyauth.127.0.0.1.sslip.io + - name: Install Playwright Browsers + run: pnpm exec playwright install --with-deps + working-directory: e2e -# - name: Install dependencies -# run: pnpm ci -# working-directory: e2e -# -# - name: Install Playwright Browsers -# run: pnpm exec playwright install --with-deps -# working-directory: e2e + - name: Run Playwright tests + run: pnpm test + working-directory: e2e -# - name: Run Playwright tests -# run: pnpm test -# working-directory: e2e -# env: -# DOCKER_SOCKET_PATH: ${{ steps.docker-socket.outputs.DOCKER_SOCK }} -# -# - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 -# if: ${{ !cancelled() }} -# with: -# name: playwright-report -# path: e2e/playwright-report/ -# retention-days: 5 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: e2e/playwright-report/ + retention-days: 5 diff --git a/e2e/conf/Caddyfile b/e2e/conf/Caddyfile new file mode 100644 index 00000000..2c2ddca0 --- /dev/null +++ b/e2e/conf/Caddyfile @@ -0,0 +1,15 @@ +{ + auto_https off +} + +http://whoami.127.0.0.1.sslip.io { + forward_auth tinyauth:3000 { + uri /api/auth/caddy + copy_headers Remote-User Remote-Name Remote-Email Remote-Groups + } + reverse_proxy whoami:80 +} + +http://tinyauth.127.0.0.1.sslip.io { + reverse_proxy tinyauth:3000 +} \ No newline at end of file diff --git a/e2e/docker-compose.e2e.yml b/e2e/docker-compose.e2e.yml index 8e515d1d..358e1741 100644 --- a/e2e/docker-compose.e2e.yml +++ b/e2e/docker-compose.e2e.yml @@ -1,24 +1,15 @@ services: - traefik: - image: traefik:v3.7.8 + caddy: + image: caddy:2.11.4 pull_policy: missing - command: | - --api.insecure=true - --providers.docker - --entrypoints.web.address=:80 - --log.level=INFO ports: - 80:80 volumes: - - /var/run/docker.sock:/var/run/docker.sock + - ./conf:/etc/caddy whoami: image: traefik/whoami:v1.11.0 pull_policy: missing - labels: - traefik.enable: true - traefik.http.routers.whoami.rule: Host(`whoami.127.0.0.1.sslip.io`) - traefik.http.routers.whoami.middlewares: tinyauth tinyauth: build: @@ -30,8 +21,4 @@ services: - LDFLAGS=-s -w command: ["--configfile", "/app/config.yaml"] volumes: - - ./config.e2e.yaml:/app/config.yaml:ro - labels: - traefik.enable: true - traefik.http.routers.tinyauth.rule: Host(`tinyauth.127.0.0.1.sslip.io`) - traefik.http.middlewares.tinyauth.forwardauth.address: http://tinyauth:3000/api/auth/traefik \ No newline at end of file + - ./config.e2e.yaml:/app/config.yaml:ro \ No newline at end of file