website-content-updates #7
@@ -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
|
||||
|
||||
@@ -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/);
|
||||
});
|
||||
@@ -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",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
import {defineConfig, devices} from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Read environment variables from 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. */
|
||||
@@ -36,7 +36,7 @@ export default defineConfig({
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
use: {...devices['Desktop Chrome']},
|
||||
},
|
||||
|
||||
// {
|
||||
@@ -52,7 +52,7 @@ export default defineConfig({
|
||||
/* Test against mobile viewports. */
|
||||
{
|
||||
name: 'Mobile Chrome',
|
||||
use: { ...devices['Pixel 5'] },
|
||||
use: {...devices['Pixel 5']},
|
||||
},
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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 !== "/");
|
||||
}
|
||||
11
test-e2e/all-site-layout-pages-navigable.spec.ts
Normal file
11
test-e2e/all-site-layout-pages-navigable.spec.ts
Normal 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();
|
||||
});
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
@@ -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/'
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user