Merge pull request #1 from developbob/feature/version-display

Feature/version display
pull/639/head
developbob 2 weeks ago committed by GitHub
commit 32e244f522
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -20,7 +20,12 @@
<% else %>
<div class="flex items-center justify-center space-x-4 mr-1">
<%= render 'shared/navbar_buttons' %>
<%= link_to t('settings'), settings_profile_index_path, class: 'hidden md:inline-flex font-medium text-lg', id: 'account_settings_button' %>
<div class="hidden md:flex flex-col items-start leading-none">
<%= link_to t('settings'), settings_profile_index_path, class: 'inline-flex font-medium text-lg', id: 'account_settings_button' %>
<% if ENV['APP_VERSION'].present? %>
<span class="text-xs text-base-content/60" id="app_version"><%= ENV['APP_VERSION'] %></span>
<% end %>
</div>
</div>
<% end %>
<div class="dropdown dropdown-end">

@ -0,0 +1,5 @@
node_modules/
test-results/
playwright-report/
blob-report/
playwright/.cache/

@ -0,0 +1,39 @@
# DocuSeal Playwright Tests
End-to-end tests for DocuSeal fork features.
## Setup
```bash
cd playwright
npm install
npm run install:browsers
```
## Running
```bash
# Against local dev server (http://localhost:3000)
npm test
# Against UAT
PLAYWRIGHT_BASE_URL=https://docuseal-uat.example.com npm test
# Headed / debug UI
npm run test:headed
npm run test:ui
```
## Env vars
- `PLAYWRIGHT_BASE_URL` — explicit target URL (overrides everything)
- `DOCUSEAL_UAT_URL` — default UAT URL when `PLAYWRIGHT_BASE_URL` absent
- `DOCUSEAL_ADMIN_EMAIL` / `DOCUSEAL_ADMIN_PASSWORD` — credentials for login helpers
## Layout
One spec per feature (mirrors `PLAN.md` version numbering):
- `v0.4.0-version-display.spec.ts`
- `v0.1.0-config-overrides.spec.ts`
- ...

@ -0,0 +1,15 @@
{
"name": "docuseal-playwright",
"private": true,
"version": "0.0.0",
"description": "Playwright end-to-end tests for DocuSeal fork features",
"scripts": {
"test": "playwright test",
"test:headed": "playwright test --headed",
"test:ui": "playwright test --ui",
"install:browsers": "playwright install --with-deps chromium"
},
"devDependencies": {
"@playwright/test": "^1.47.0"
}
}

@ -0,0 +1,29 @@
import { defineConfig, devices } from '@playwright/test';
// Base URL order: PLAYWRIGHT_BASE_URL > UAT default > localhost
const baseURL =
process.env.PLAYWRIGHT_BASE_URL ||
process.env.DOCUSEAL_UAT_URL ||
'http://localhost:3000';
export default defineConfig({
testDir: './tests',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: [['list'], ['html', { open: 'never' }]],
use: {
baseURL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
ignoreHTTPSErrors: true,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});

@ -0,0 +1,17 @@
import { Page, expect } from '@playwright/test';
// Credentials come from env so tests work against any environment.
export const adminEmail = process.env.DOCUSEAL_ADMIN_EMAIL || 'admin@example.com';
export const adminPassword = process.env.DOCUSEAL_ADMIN_PASSWORD || 'password';
export async function loginAs(page: Page, email: string, password: string): Promise<void> {
await page.goto('/users/sign_in');
await page.getByLabel(/email/i).fill(email);
await page.getByLabel(/password/i).fill(password);
await page.getByRole('button', { name: /sign in|log in/i }).click();
await expect(page).not.toHaveURL(/sign_in/);
}
export async function loginAsAdmin(page: Page): Promise<void> {
await loginAs(page, adminEmail, adminPassword);
}

@ -0,0 +1,25 @@
import { test, expect } from '@playwright/test';
import { loginAsAdmin } from './helpers/auth';
// Phase 0.4 — Version Display
// Assumes the app is running with APP_VERSION=v0.4.0 (kustomize configmap in UAT).
test.describe('Version display', () => {
test('navbar shows APP_VERSION below Settings link', async ({ page }) => {
await loginAsAdmin(page);
await page.goto('/');
const version = page.locator('#app_version');
await expect(version).toBeVisible();
await expect(version).toHaveText(/^v\d+\.\d+\.\d+/);
});
test('settings nav bottom version badge links to upstream releases', async ({ page }) => {
await loginAsAdmin(page);
await page.goto('/settings/profile');
const badge = page.locator('a[href="https://github.com/docusealco/docuseal/releases"]');
await expect(badge).toBeVisible();
await expect(badge).toHaveText(/^v\d+\.\d+\.\d+/);
});
});
Loading…
Cancel
Save