Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06e4898c30 |
@@ -5,13 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
# Cancel superseded runs: pushing a new commit to a PR (or an empty
|
|
||||||
# re-trigger) aborts the previous still-running checks instead of running
|
|
||||||
# a second full matrix alongside them.
|
|
||||||
concurrency:
|
|
||||||
group: pr-checks-${{ gitea.event.pull_request.number }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: privaterepo.sitaru.org
|
REGISTRY: privaterepo.sitaru.org
|
||||||
BACKEND_IMAGE_NAME: ${{ gitea.repository }}-backend
|
BACKEND_IMAGE_NAME: ${{ gitea.repository }}-backend
|
||||||
@@ -30,22 +23,12 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
|
cache: npm
|
||||||
# Cache the resolved node_modules (452 MB / 460 packages) keyed on the
|
cache-dependency-path: nextjs-app/package-lock.json
|
||||||
# lockfile. On a hit — the common case, since deps change rarely — the
|
|
||||||
# whole `npm ci` step is skipped, not just its download phase. The key
|
|
||||||
# pins OS + node major so we never restore incompatible native binaries.
|
|
||||||
- name: Cache node_modules
|
|
||||||
id: node-modules-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: nextjs-app/node_modules
|
|
||||||
key: nextjs-node-modules-${{ runner.os }}-node22-${{ hashFiles('nextjs-app/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: steps.node-modules-cache.outputs.cache-hit != 'true'
|
|
||||||
working-directory: nextjs-app
|
working-directory: nextjs-app
|
||||||
run: npm ci --prefer-offline --no-audit --no-fund
|
run: npm ci
|
||||||
|
|
||||||
- name: Typecheck
|
- name: Typecheck
|
||||||
working-directory: nextjs-app
|
working-directory: nextjs-app
|
||||||
|
|||||||
+26
-11
@@ -19,6 +19,27 @@ function schoolLinks(page: Page) {
|
|||||||
return page.locator('a[href^="/school/"]');
|
return page.locator('a[href^="/school/"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Two URNs guaranteed to be pure-primary (same phase). The compare page's
|
||||||
|
* phase tabs split all-through schools (which carry KS4 data) onto the
|
||||||
|
* secondary tab, so picking two arbitrary "primary" search hits can land
|
||||||
|
* them on different tabs where only the active one renders. Selecting via
|
||||||
|
* the API by exact phase keeps both on the same tab. Data-invariant: uses
|
||||||
|
* whatever primaries the environment holds.
|
||||||
|
*/
|
||||||
|
async function twoPrimaryUrns(page: Page): Promise<[string, string]> {
|
||||||
|
const res = await page.request.get('/api/schools?search=primary&per_page=50');
|
||||||
|
expect(res.ok()).toBeTruthy();
|
||||||
|
const body = await res.json();
|
||||||
|
const urns: string[] = (body.schools ?? [])
|
||||||
|
.filter((s: { phase?: string; rwm_expected_pct?: number | null }) =>
|
||||||
|
s.phase === 'Primary' && s.rwm_expected_pct != null,
|
||||||
|
)
|
||||||
|
.map((s: { urn: number }) => String(s.urn));
|
||||||
|
expect(urns.length).toBeGreaterThanOrEqual(2);
|
||||||
|
return [urns[0], urns[1]];
|
||||||
|
}
|
||||||
|
|
||||||
test('home page loads with hero search', async ({ page }) => {
|
test('home page loads with hero search', async ({ page }) => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
await expect(page.locator('h1').first()).toBeVisible();
|
await expect(page.locator('h1').first()).toBeVisible();
|
||||||
@@ -139,19 +160,13 @@ test('results map fullscreen falls back to an overlay on iOS', async ({ page })
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('comparing two schools shows the parent-first sections side by side', async ({ page }) => {
|
test('comparing two schools shows the parent-first sections side by side', async ({ page }) => {
|
||||||
// Collect two school URNs from search results, then load the share URL
|
// Two same-phase (pure primary) schools so both stay on one tab.
|
||||||
await searchByName(page, 'primary');
|
const [urn0, urn1] = await twoPrimaryUrns(page);
|
||||||
await expect(schoolLinks(page).first()).toBeVisible({ timeout: 15_000 });
|
|
||||||
const hrefs = await schoolLinks(page).evaluateAll((links) =>
|
|
||||||
links.map((l) => (l as HTMLAnchorElement).getAttribute('href') || '')
|
|
||||||
);
|
|
||||||
const urns = [...new Set(hrefs.map((h) => h.match(/\/school\/(\d+)/)?.[1]).filter(Boolean))];
|
|
||||||
expect(urns.length).toBeGreaterThanOrEqual(2);
|
|
||||||
|
|
||||||
await page.goto(`/compare?urns=${urns[0]},${urns[1]}`);
|
await page.goto(`/compare?urns=${urn0},${urn1}`);
|
||||||
// Both schools' detail links should render in the comparison view
|
// Both schools' detail links should render in the comparison view
|
||||||
await expect(page.locator(`a[href*="${urns[0]}"]`).first()).toBeVisible({ timeout: 15_000 });
|
await expect(page.locator(`a[href*="${urn0}"]`).first()).toBeVisible({ timeout: 15_000 });
|
||||||
await expect(page.locator(`a[href*="${urns[1]}"]`).first()).toBeVisible();
|
await expect(page.locator(`a[href*="${urn1}"]`).first()).toBeVisible();
|
||||||
|
|
||||||
// The parent-first sections render in order (data-invariant: headings only)
|
// The parent-first sections render in order (data-invariant: headings only)
|
||||||
for (const heading of [
|
for (const heading of [
|
||||||
|
|||||||
Reference in New Issue
Block a user