website-content-updates #7

Merged
caperren merged 36 commits from website-content-updates into main 2025-11-10 09:18:11 +00:00
8 changed files with 131 additions and 99 deletions
Showing only changes of commit 2d7f2904a8 - Show all commits

View File

@@ -4,7 +4,7 @@ on:
types: [ opened, synchronize, reopened ]
jobs:
determine_version:
test:
runs-on: ubuntu-latest
outputs:
repo_name: ${{ steps.project_metadata.outputs.REPO_NAME }}
@@ -17,6 +17,12 @@ jobs:
- name: Setup Node Environment
uses: actions/setup-node@v4
- name: Run Unit Tests
run: npm run test
- name: Run E2E Tests
run: npm run e2e-test
- name: Acquire Project Metadata
id: project_metadata
run: |
@@ -25,7 +31,7 @@ jobs:
build_and_push:
runs-on: ubuntu-latest
needs: determine_version
needs: test
steps:
- name: Checkout caperren-com Repository
uses: actions/checkout@v4
@@ -53,12 +59,6 @@ jobs:
REPO_VERSION_HASH=${{ needs.determine_version.outputs.repo_version_hash }}
BUILD_ENVIRONMENT=staging
test:
runs-on: ubuntu-latest
needs: build_and_push
steps:
- run: echo "Placeholder"
deploy_staging:
runs-on: ubuntu-latest
needs: test

View File

@@ -1,8 +0,0 @@
import { test, expect } from '@playwright/test';
test('Has Title', async ({ page }) => {
await page.goto('/');
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Corwin Perren/);
});

View File

@@ -8,7 +8,8 @@
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"test": "vitest"
"test": "vitest",
"e2e-test": "playwright test"
},
"dependencies": {
"astro": "^5.15.4",

View File

@@ -12,7 +12,7 @@ import { defineConfig, devices } from '@playwright/test';
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e',
testDir: './test-e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -71,9 +71,10 @@ export default defineConfig({
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://localhost:3000',
// reuseExistingServer: !process.env.CI,
// },
webServer: {
command: 'npm run preview',
url: 'http://localhost:4321',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
});

View File

@@ -116,11 +116,11 @@ export const siteLayout: navLink[] = [
]
},
// {
// title: "Trips",
// navText: "Trips",
// path: "trips",
// children: [
// {title: "2025-08 | Alaska ", path: "2025-08-alaska"},
// {title: "2024-10 | Norway ", path: "2024-10-norway"}
// {navText: "2025-08 | Alaska ", path: "2025-08-alaska"},
// {navText: "2024-10 | Norway ", path: "2024-10-norway"}
// ]
// },
]
@@ -172,3 +172,22 @@ export const pathToMetadata = (path: string): navLink => {
return foundEntry;
}
export const getPaths = (
currentEntries: navLink[] = siteLayout,
paths: string[] = []
): string[] => {
let foundPaths: string[] = [];
for (const currentEntry of currentEntries) {
if (currentEntry.children && currentEntry.children.length > 0) {
foundPaths = [
...foundPaths,
...getPaths(currentEntry.children, [...paths, currentEntry.path || ""])
]
} else {
foundPaths.push("/" + [...paths, currentEntry.path || ""].join("/"));
}
}
return foundPaths.filter(path => path !== "/");
}

View File

@@ -0,0 +1,11 @@
import {test, expect} from '@playwright/test';
import {getPaths} from "@data/site-layout.ts";
for (const pagePath of getPaths()) {
test(`${pagePath} Navigable`, async ({page}) => {
const response = await page.request.get(pagePath);
await expect(response).toBeOK();
});
}

View File

@@ -1,15 +1,15 @@
import { experimental_AstroContainer as AstroContainer } from 'astro/container';
import { expect, test } from 'vitest';
import Navbar from "@components/Navbar.js"
import Navbar from "@components/Navbar.astro"
test('Card with slots', async () => {
const container = await AstroContainer.create();
const result = await container.renderToString(Card, {
const result = await container.renderToString(Navbar, {
slots: {
default: 'Card content',
},
});
expect(result).toContain('This is a card');
expect(result).toContain('Card content');
// expect(result).toContain('This is a card');
// expect(result).toContain('Card content');
});

View File

@@ -1,15 +1,23 @@
/// <reference types="vitest" />
// import {getViteConfig} from 'astro/config';
//
// export default getViteConfig(
// {
// test: {
// /* for example, use global to avoid globals imports (describe, test, expect): */
// // globals: true,
// },
// },
// {
// site: 'https://caperren.com/',
// trailingSlash: 'always',
// },
// );
import path from 'path';
import {getViteConfig} from 'astro/config';
export default getViteConfig(
{
test: {
exclude: [
"test-e2e/**",
"node_modules/**",
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
},
},
/* for example, use global to avoid globals imports (describe, test, expect): */
// globals: true,
},
},
{
site: 'https://caperren.com/'
},
);