Implements the profile-weekly-distance change (specs/profile-weekly-distance):
- getWeeklyDistance(ownerId, { publicOnly, weeks=12 }) in activities.server.ts:
one query that gap-fills in SQL — generate_series of week-starts LEFT JOINed
to activities — so it returns exactly 12 contiguous { weekStart, distance }
rows with matching Postgres week boundaries, viewer-scoped, no cache, no
schema change.
- WeeklyDistanceChart: SVG bars normalized to the busiest week (empty weeks keep
their slot as zero-height bars), per-bar title distance, localized label;
renders nothing when there's no distance in the window. Mounted under the
ProfileStats header.
- i18n journal.profileStats.weeklyDistance (en + de).
Tests: WeeklyDistanceChart component (jsdom: bar count incl. zero weeks, empty
→ hidden, normalization); e2e creates an activity with distance and asserts the
chart renders. typecheck + lint + unit (journal 321) green; verified in the
browser.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
185 lines
4.5 KiB
TypeScript
185 lines
4.5 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
export default defineConfig({
|
|
testDir: "./e2e",
|
|
outputDir: "./e2e/results",
|
|
fullyParallel: true,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: process.env.CI
|
|
? [["github"], ["html", { open: "never" }], ["json", { outputFile: "playwright-results.json" }]]
|
|
: "list",
|
|
use: {
|
|
baseURL: "http://localhost:3000",
|
|
trace: "on-first-retry",
|
|
screenshot: "only-on-failure",
|
|
},
|
|
// NOTE: specs only run if a project below matches them — a new
|
|
// e2e/*.test.ts file MUST be registered here or it silently never
|
|
// executes.
|
|
projects: [
|
|
{
|
|
name: "journal",
|
|
testMatch: "journal.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "planner",
|
|
testMatch: "planner-*.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3001",
|
|
},
|
|
},
|
|
{
|
|
name: "auth",
|
|
testMatch: "auth.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "public-content",
|
|
testMatch: "public-content.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "demo-bot",
|
|
testMatch: "demo-bot.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "integration",
|
|
testMatch: "integration.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
},
|
|
},
|
|
{
|
|
name: "journal-planner-save",
|
|
testMatch: "journal-planner-save.test.ts",
|
|
use: {
|
|
// No baseURL — the test navigates between both apps using
|
|
// absolute URLs.
|
|
...devices["Desktop Chrome"],
|
|
},
|
|
},
|
|
{
|
|
name: "notifications",
|
|
testMatch: "notifications.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "komoot-import",
|
|
testMatch: "komoot-import.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "settings",
|
|
testMatch: "settings.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "explore",
|
|
testMatch: "explore.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "social",
|
|
testMatch: "social.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "activity-sport-type",
|
|
testMatch: "activity-sport-type.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "elevation-profile",
|
|
testMatch: "elevation-profile.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "list-map-previews",
|
|
testMatch: "list-map-previews.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "profile-stats",
|
|
testMatch: "profile-stats.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
{
|
|
name: "profile-weekly-distance",
|
|
testMatch: "profile-weekly-distance.test.ts",
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://localhost:3000",
|
|
},
|
|
},
|
|
],
|
|
webServer: process.env.CI
|
|
? [
|
|
{
|
|
command: "npx react-router-serve ./build/server/index.js",
|
|
url: "http://localhost:3000",
|
|
cwd: "./apps/journal",
|
|
reuseExistingServer: false,
|
|
},
|
|
{
|
|
command: "node --experimental-strip-types server.ts",
|
|
url: "http://localhost:3001",
|
|
cwd: "./apps/planner",
|
|
reuseExistingServer: false,
|
|
},
|
|
]
|
|
: [
|
|
{
|
|
command: "pnpm --filter @trails-cool/journal dev",
|
|
url: "http://localhost:3000",
|
|
reuseExistingServer: true,
|
|
},
|
|
{
|
|
command: "pnpm --filter @trails-cool/planner dev",
|
|
url: "http://localhost:3001",
|
|
reuseExistingServer: true,
|
|
},
|
|
],
|
|
});
|