Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fbbed2d4f7 | |||
| 52769be0f9 | |||
| 7e75740bef | |||
| af0548c0ac | |||
| 2db6304bc5 | |||
| 7b69bd741a | |||
| 0ea932ceb0 | |||
| 428dc3778c | |||
| 36278dcc46 | |||
| 9af48bda75 | |||
| b248b517b8 | |||
| 94af10a98e | |||
| 7f8927177e | |||
| d1e2bd29f8 | |||
| 7056fce297 | |||
| 933e553fe4 | |||
| a4e483af2c | |||
| abca6b05cb |
@@ -93,26 +93,45 @@ jobs:
|
||||
# The Debian runner omits pip and python3-venv. Use pip's official
|
||||
# zipapp and install into the checkout so CI remains isolated without
|
||||
# sudo or a mutable runner-global Python environment.
|
||||
curl -fsSLo /tmp/pip.pyz https://bootstrap.pypa.io/pip/pip.pyz
|
||||
install_parser_dependencies() {
|
||||
rm -rf .python-ci
|
||||
parser_pip_cache="$(mktemp -d)"
|
||||
PIP_CACHE_DIR="$parser_pip_cache" python3 /tmp/pip.pyz install --target .python-ci --require-hashes \
|
||||
--extra-index-url https://download.pytorch.org/whl/cpu \
|
||||
-r requirements-linux.lock
|
||||
python_tmp="$(mktemp -d)"
|
||||
trap 'rm -rf -- "$python_tmp"' EXIT
|
||||
curl -fsSLo "$python_tmp/pip.pyz" https://bootstrap.pypa.io/pip/pip.pyz
|
||||
install_locked() {
|
||||
local interpreter="$1" destination="$2" attempt scratch
|
||||
shift 2
|
||||
for attempt in 1 2 3; do
|
||||
scratch="$(mktemp -d "$python_tmp/install.XXXXXX")"
|
||||
if PIP_CACHE_DIR="$scratch/cache" "$interpreter" "$python_tmp/pip.pyz" install \
|
||||
--target "$scratch/site" --require-hashes "$@"; then
|
||||
mv "$scratch/site" "$destination"
|
||||
return
|
||||
fi
|
||||
echo "Locked Python dependency install attempt $attempt failed."
|
||||
done
|
||||
return 1
|
||||
}
|
||||
parser_install_succeeded=false
|
||||
for attempt in 1 2 3; do
|
||||
if install_parser_dependencies; then
|
||||
parser_install_succeeded=true
|
||||
break
|
||||
fi
|
||||
echo "Parser dependency install attempt $attempt failed — retrying with a fresh isolated cache..."
|
||||
done
|
||||
test "$parser_install_succeeded" = true
|
||||
PIP_CACHE_DIR="$parser_pip_cache" python3 /tmp/pip.pyz install --upgrade --target .python-ci pytest==8.3.5 httpx2==2.12.0
|
||||
python3 --version
|
||||
PYTHONFAULTHANDLER=1 PYTHONPATH="$PWD/.python-ci" AI_SERVICE_SKIP_MODEL_LOAD=1 python3 -m pytest -q
|
||||
install_locked python3 "$python_tmp/sidecar" --extra-index-url https://download.pytorch.org/whl/cpu \
|
||||
-r requirements-dev-linux.lock
|
||||
PYTHONFAULTHANDLER=1 PYTHONPATH="$python_tmp/sidecar" AI_SERVICE_SKIP_MODEL_LOAD=1 \
|
||||
python3 -m pytest -q --ignore=tests/test_document_extractor.py
|
||||
|
||||
# The CV parser uses a separate dependency set. Its lock already pins
|
||||
# pluggy and pygments; add the remaining hashed pytest requirements.
|
||||
# The Docling lock targets Python 3.12, while the Debian runner uses 3.11.
|
||||
cv_archive="$python_tmp/cv-python.tar.gz"
|
||||
curl -fsSL --retry 2 -o "$cv_archive" \
|
||||
'https://github.com/astral-sh/python-build-standalone/releases/download/20250517/cpython-3.12.10%2B20250517-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz'
|
||||
echo "0356bd1db292781a20e011d789f0c41ea5ec04731c8236c8185b53a54faf2871 $cv_archive" | sha256sum -c -
|
||||
tar -xzf "$cv_archive" -C "$python_tmp"
|
||||
cv_python="$python_tmp/python/bin/python3"
|
||||
"$cv_python" --version
|
||||
awk '/^[^[:space:]#]/ { include = /^(iniconfig|packaging|pytest)==/ }
|
||||
include && !/^[[:space:]]*#/ { print }' requirements-dev-linux.lock > "$python_tmp/cv-test-tools.lock"
|
||||
test "$(grep -Ec '^(iniconfig|packaging|pytest)==' "$python_tmp/cv-test-tools.lock")" -eq 3
|
||||
install_locked "$cv_python" "$python_tmp/cv-parser" -r requirements-cv-import.lock -r "$python_tmp/cv-test-tools.lock"
|
||||
PYTHONFAULTHANDLER=1 PYTHONPATH="$python_tmp/cv-parser" OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 \
|
||||
"$cv_python" -m pytest -q tests/test_document_extractor.py
|
||||
|
||||
- name: Restore backend
|
||||
# The runner/proxy has occasionally supplied checksum-invalid NuGet cache entries (NU3008).
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
using System.Data.Common;
|
||||
using System.Diagnostics;
|
||||
using JobTrackerApi.Controllers;
|
||||
using JobTrackerApi.Data;
|
||||
using JobTrackerApi.Models;
|
||||
using JobTrackerApi.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using MySqlConnector;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace JobTrackerApi.MariaDb.Tests;
|
||||
|
||||
[CollectionDefinition("Rules MariaDB measurements", DisableParallelization = true)]
|
||||
public sealed class RulesMariaDbMeasurementCollection;
|
||||
|
||||
[Collection("Rules MariaDB measurements")]
|
||||
public sealed class RulesFreshnessMariaDbTests(ITestOutputHelper output)
|
||||
{
|
||||
private const string Owner = "rules-owner";
|
||||
private const string Other = "rules-other";
|
||||
private const string Fallback = "rules-fallback";
|
||||
private const int Repetitions = 100;
|
||||
|
||||
[Fact]
|
||||
public async Task Timed_out_save_preserves_committed_rules_and_retry_reaches_existing_readers()
|
||||
{
|
||||
await using var database = await MariaDbDatabase.CreateAsync();
|
||||
await Seed(database);
|
||||
await using var ownerReader = database.Context(Owner);
|
||||
await using var otherReader = database.Context(Other);
|
||||
Assert.Equal(30, (await RulesEngine.GetSettings(ownerReader, default)).AppliedFollowUpDays);
|
||||
Assert.Equal(45, (await RulesEngine.GetSettings(otherReader, default)).AppliedFollowUpDays);
|
||||
|
||||
await using var lockOwner = database.Context(Owner);
|
||||
await using var transaction = await lockOwner.Database.BeginTransactionAsync();
|
||||
var locked = await lockOwner.UserRuleSettings.SingleAsync();
|
||||
locked.AppliedFollowUpDays = 31;
|
||||
await lockOwner.SaveChangesAsync();
|
||||
|
||||
await using var failedWriter = database.Context(Owner);
|
||||
await failedWriter.Database.OpenConnectionAsync();
|
||||
await failedWriter.Database.ExecuteSqlRawAsync("SET SESSION innodb_lock_wait_timeout = 1");
|
||||
var started = Stopwatch.GetTimestamp();
|
||||
var error = await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => new RulesController(failedWriter).Update(new RuleSettings { AppliedFollowUpDays = 1 }, default));
|
||||
var update = Assert.IsType<DbUpdateException>(error.InnerException);
|
||||
Assert.Equal(1205, Assert.IsType<MySqlException>(update.InnerException).Number);
|
||||
var timeout = Stopwatch.GetElapsedTime(started);
|
||||
|
||||
Assert.Equal(1, failedWriter.UserRuleSettings.Local.Single().AppliedFollowUpDays);
|
||||
Assert.Equal(30, (await RulesEngine.GetSettings(failedWriter, default)).AppliedFollowUpDays);
|
||||
Assert.Equal(30, (await RulesEngine.GetSettings(ownerReader, default)).AppliedFollowUpDays);
|
||||
Assert.Equal(45, (await RulesEngine.GetSettings(otherReader, default)).AppliedFollowUpDays);
|
||||
await transaction.RollbackAsync();
|
||||
|
||||
await using var retry = database.Context(Owner);
|
||||
started = Stopwatch.GetTimestamp();
|
||||
Assert.IsType<NoContentResult>(
|
||||
await new RulesController(retry).Update(new RuleSettings { AppliedFollowUpDays = 1 }, default));
|
||||
var retryDuration = Stopwatch.GetElapsedTime(started);
|
||||
Assert.Equal(1, (await RulesEngine.GetSettings(ownerReader, default)).AppliedFollowUpDays);
|
||||
Assert.Equal(45, (await RulesEngine.GetSettings(otherReader, default)).AppliedFollowUpDays);
|
||||
output.WriteLine($"MariaDB {database.ActualVersion} lock timeout {timeout.TotalMilliseconds:F1} ms; retry {retryDuration.TotalMilliseconds:F1} ms.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Committed_owner_and_fallback_reads_measure_queries_and_latency_with_same_workload()
|
||||
{
|
||||
await using var database = await MariaDbDatabase.CreateAsync();
|
||||
await Seed(database);
|
||||
var ownerQueries = new QueryCounter();
|
||||
var fallbackQueries = new QueryCounter();
|
||||
await using var owner = database.Context(Owner, ownerQueries);
|
||||
await using var fallback = database.Context(Fallback, fallbackQueries);
|
||||
|
||||
Assert.Equal(30, (await RulesEngine.GetSettings(owner, default)).AppliedFollowUpDays);
|
||||
Assert.Equal(60, (await RulesEngine.GetSettings(fallback, default)).AppliedFollowUpDays);
|
||||
ownerQueries.Count = fallbackQueries.Count = 0;
|
||||
double[] ownerTimes = new double[Repetitions];
|
||||
double[] fallbackTimes = new double[Repetitions];
|
||||
|
||||
for (var index = 0; index < Repetitions; index++)
|
||||
{
|
||||
ownerTimes[index] = await MeasureRead(owner, 30);
|
||||
fallbackTimes[index] = await MeasureRead(fallback, 60);
|
||||
}
|
||||
|
||||
Assert.Equal(Repetitions, ownerQueries.Count);
|
||||
Assert.Equal(Repetitions * 2, fallbackQueries.Count);
|
||||
Array.Sort(ownerTimes);
|
||||
Array.Sort(fallbackTimes);
|
||||
output.WriteLine(FormattableString.Invariant(
|
||||
$"MariaDB {database.ActualVersion}; {Repetitions} reads per path. Owner {ownerQueries.Count} commands, p50/p95 {ownerTimes[Repetitions / 2 - 1]:F3}/{ownerTimes[Repetitions * 95 / 100 - 1]:F3} ms. Fallback {fallbackQueries.Count} commands, p50/p95 {fallbackTimes[Repetitions / 2 - 1]:F3}/{fallbackTimes[Repetitions * 95 / 100 - 1]:F3} ms."));
|
||||
}
|
||||
|
||||
private static async Task<double> MeasureRead(JobTrackerContext db, int expected)
|
||||
{
|
||||
var start = Stopwatch.GetTimestamp();
|
||||
var settings = await RulesEngine.GetSettings(db, default);
|
||||
var elapsed = Stopwatch.GetElapsedTime(start).TotalMilliseconds;
|
||||
Assert.Equal(expected, settings.AppliedFollowUpDays);
|
||||
return elapsed;
|
||||
}
|
||||
|
||||
private static async Task Seed(MariaDbDatabase database)
|
||||
{
|
||||
await using var db = database.Context();
|
||||
db.Users.AddRange(
|
||||
new ApplicationUser { Id = Owner, UserName = Owner },
|
||||
new ApplicationUser { Id = Other, UserName = Other },
|
||||
new ApplicationUser { Id = Fallback, UserName = Fallback });
|
||||
(await db.RuleSettings.SingleAsync()).AppliedFollowUpDays = 60;
|
||||
db.UserRuleSettings.AddRange(
|
||||
new UserRuleSettings { OwnerUserId = Owner, AppliedFollowUpDays = 30 },
|
||||
new UserRuleSettings { OwnerUserId = Other, AppliedFollowUpDays = 45 });
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private sealed class QueryCounter : DbCommandInterceptor
|
||||
{
|
||||
public int Count { get; set; }
|
||||
|
||||
public override ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(
|
||||
DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
Count++;
|
||||
return base.ReaderExecutingAsync(command, eventData, result, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,3 @@ The additional real-SQLite case warms owner A/B application decisions, then inje
|
||||
All nine RuleSettingsFreshnessTests passed with zero failures/skips. Eight existing cases overlap the previous 35-case regression and are not added to that total. The native TRX, compressed/raw hashes and command log are retained under `evidence/rules-failed-save/`. Dependency restore used only the existing local NuGet cache. No application or dependency source changed.
|
||||
|
||||
The injected exception occurs before database save. This verifies committed-read behaviour after that failure and subsequent successful retry. Mid-transaction connection loss, MariaDB, multi-process load, latency, operational restore and release qualification remain separate.
|
||||
|
||||
## MariaDB committed reads after a native lock timeout
|
||||
|
||||
4 December 2026. Published A3 base `ac64d2ee221859c481dfd62e8fe83084af4c6764`. The native lane used disposable MariaDB 12.2.2 on Docker Desktop’s Linux engine with loopback TCP and .NET SDK 9.0.317.
|
||||
|
||||
A second connection held an uncommitted update of owner A’s rule row. The actual Rules controller save received MariaDB error 1205 through EF and Pomelo after 1,007.5 ms with the fixture session’s one-second lock timeout. Owner A’s committed threshold remained 30, including when read through the failed writer with its proposed value still tracked. Owner B remained at 45. After the lock holder rolled back, a fresh explicit save took 5.3 ms and the existing readers observed A at 1 and B still at 45.
|
||||
|
||||
With the same serialized workload and 100 warm reads of each path, the explicit-owner path issued 100 SQL commands and measured p50/p95 of 2.584/3.197 ms. The fallback path issued 200 commands and measured 5.068/6.095 ms. Every read returned its expected setting. These are local service-method measurements for a three-user fixture. Concurrent traffic, HTTP latency, production load and historical P2-O01’s missing server exception remain outside this run.
|
||||
|
||||
The first full run passed 101 of 102 cases. The test expected an unwrapped EF failure while Pomelo wrapped the same native server error. The final test checks both wrappers and error 1205. The second run passed **102 of 102**, zero skipped. Both disposable containers were removed. Run `python scripts/mariadb-integration.py` with the pinned SDK. Local native logs and TRX are in `.artifacts/issue-98-mariadb` and `.artifacts/issue-98-mariadb-final`. Final TRX SHA-256 `efdec2891da9e877273e0c9ab8273bc5b4fd516be326d0ad77bb2dd2496cf8ca`.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import AxeBuilder from "@axe-core/playwright";
|
||||
import { expect, test as base, type APIRequestContext, type Locator, type Page, type TestInfo } from "@playwright/test";
|
||||
import { translations } from "../src/i18n/translations";
|
||||
import { cvStudioSectionPicker, openCvStudioSection } from "./helpers/cvStudioNavigation";
|
||||
|
||||
const apiUrl = "http://localhost:5302/api";
|
||||
const password = "E2ePassword123!";
|
||||
@@ -54,19 +55,24 @@ async function scan(page: Page, info: TestInfo, state: string) {
|
||||
expect(result.violations).toEqual([]);
|
||||
}
|
||||
|
||||
async function enterPreview(page: Page, region: Locator, start = page.getByRole("tab").last()) {
|
||||
async function enterPreview(page: Page, region: Locator, language: "en" | "nb", start = page.getByRole("tab").last()) {
|
||||
// Content is primary in P5-09. Reach the named pane-navigation action through
|
||||
// the real tab order, rather than traversing every collapsed section control.
|
||||
await start.focus();
|
||||
const previewEntry = page.getByRole("button", { name: /^(Go to preview|Gå til forhåndsvisning)$/ });
|
||||
const t = translations[language];
|
||||
const previewEntry = page.getByRole("button", { name: t.cvEditorFocusPreview, exact: true });
|
||||
if (await previewEntry.isVisible()) {
|
||||
await page.keyboard.press("Tab");
|
||||
await expect(page.getByRole("combobox", { name: /^(Go to section|Gå til seksjon)/ })).toBeFocused();
|
||||
const sections = cvStudioSectionPicker(page, t.cvEditorStudioNavigation);
|
||||
await start.or(sections).focus({ timeout: 5000 });
|
||||
const section = page.getByRole("combobox", { name: t.cvEditorGoToSection, exact: true });
|
||||
await expect(section).toBeVisible();
|
||||
for (let i = 0; i < 12 && !(await section.evaluate(node => node === document.activeElement)); i++) await page.keyboard.press("Tab");
|
||||
await expect(section).toBeFocused();
|
||||
await page.keyboard.press("Tab");
|
||||
await expect(previewEntry).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
} else {
|
||||
// Mobile retains its existing Edit/Preview button and native tab entry.
|
||||
await start.focus({ timeout: 5000 });
|
||||
for (let i = 0; i < 80 && !(await region.evaluate(node => node === document.activeElement)); i++) await page.keyboard.press("Tab");
|
||||
}
|
||||
await expect(region).toBeFocused();
|
||||
@@ -101,7 +107,7 @@ for (const [mode, language] of [["light", "en"], ["dark", "nb"], ["light", "nb"]
|
||||
await expect(page.locator("[data-cv-page]")).toHaveCount(1);
|
||||
const region = page.getByRole("region", { name: t.cvEditorLivePreview, exact: true });
|
||||
await expect(region).toBeVisible();
|
||||
await enterPreview(page, region);
|
||||
await enterPreview(page, region, language);
|
||||
await capture(page, info, `one-page-${suffix}`);
|
||||
|
||||
const profileBefore = (await (await page.request.get(`${apiUrl}/career/profile`)).json()).profile;
|
||||
@@ -109,17 +115,15 @@ for (const [mode, language] of [["light", "en"], ["dark", "nb"], ["light", "nb"]
|
||||
await page.goto(`/career/builder/${owner.longId}`);
|
||||
await expect(frame.getByText("Åse Eksempel", { exact: true })).toBeVisible();
|
||||
await expect.poll(() => page.locator("[data-cv-page]").count()).toBeGreaterThan(1);
|
||||
await page.getByRole("tab", { name: t.cvEditorContent, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorContent);
|
||||
const headline = page.getByRole("textbox", { name: t.cvEditorHeadlineOverride, exact: true });
|
||||
await headline.fill("Reviewed CV-only æøå");
|
||||
await expect(page.getByText(t.cvEditorSaved, { exact: true })).toBeVisible();
|
||||
await expect.poll(async () => (await (await page.request.get(`${apiUrl}/cv/variants/${owner.longId}`)).json()).settings.headline).toBe("Reviewed CV-only æøå");
|
||||
await expect(region).toHaveAttribute("aria-busy", "false");
|
||||
await enterPreview(page, region);
|
||||
await enterPreview(page, region, language);
|
||||
const top = await region.evaluate(node => node.scrollTop);
|
||||
const pageDownSettled = region.evaluate(node => new Promise<void>(resolve => node.addEventListener("scrollend", () => resolve(), { once: true })));
|
||||
await page.keyboard.press("PageDown");
|
||||
await pageDownSettled;
|
||||
await expect.poll(() => region.evaluate(node => node.scrollTop)).toBeGreaterThan(top + 100);
|
||||
await page.keyboard.press("Control+End");
|
||||
await expect.poll(() => region.evaluate(node => Math.abs(node.scrollHeight - node.clientHeight - node.scrollTop))).toBeLessThan(3);
|
||||
@@ -145,12 +149,12 @@ for (const [mode, language] of [["light", "en"], ["dark", "nb"], ["light", "nb"]
|
||||
|
||||
for (const width of [390, 768, 899, 900, 1024, 1440]) {
|
||||
await page.setViewportSize({ width, height: width < 900 ? 844 : 900 });
|
||||
if (width < 900) {
|
||||
if (width < 768) {
|
||||
const previewButton = page.getByRole("button", { name: t.cvEditorPreview, exact: true });
|
||||
await previewButton.focus();
|
||||
await previewButton.press("Enter");
|
||||
await expect(region).toBeVisible();
|
||||
await enterPreview(page, region, previewButton);
|
||||
await enterPreview(page, region, language, previewButton);
|
||||
await page.keyboard.press("PageDown");
|
||||
await expect.poll(() => region.evaluate(node => node.scrollTop)).toBeGreaterThan(0);
|
||||
await capture(page, info, `preview-${width}-${suffix}`);
|
||||
@@ -158,13 +162,13 @@ for (const [mode, language] of [["light", "en"], ["dark", "nb"], ["light", "nb"]
|
||||
await expect(region).not.toBeVisible();
|
||||
} else {
|
||||
await expect(region).toBeVisible();
|
||||
await enterPreview(page, region);
|
||||
await enterPreview(page, region, language);
|
||||
await scan(page, info, `transition-${width}`);
|
||||
}
|
||||
await expect(headline).toHaveValue("Reviewed CV-only æøå");
|
||||
}
|
||||
// Resizing while the preview owns focus must not hide that focused pane.
|
||||
await enterPreview(page, region);
|
||||
await enterPreview(page, region, language);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await expect(region).toBeVisible();
|
||||
await expect(region).toBeFocused();
|
||||
@@ -183,7 +187,7 @@ for (const [mode, language] of [["light", "en"], ["dark", "nb"], ["light", "nb"]
|
||||
await page.getByRole("button", { name: t.cvEditorUndo, exact: true }).click();
|
||||
await expect(headline).toHaveValue("");
|
||||
await expect(page.getByText(t.cvEditorUpdatingPreview, { exact: true })).toBeVisible();
|
||||
await enterPreview(page, region);
|
||||
await enterPreview(page, region, language);
|
||||
await page.getByText(t.cvEditorUpdatingPreview, { exact: true }).evaluate(node => node.scrollIntoView({ block: "center" }));
|
||||
await capture(page, info, `loading-${suffix}`);
|
||||
failPreview();
|
||||
|
||||
@@ -226,7 +226,9 @@ test('cover letter workspace preserves keyboard drafts and localised controls ac
|
||||
const main = document.querySelector('main')!;
|
||||
return { root: document.documentElement.scrollWidth - innerWidth, app: main.scrollWidth - main.clientWidth };
|
||||
});
|
||||
expect(geometry.root).toBeLessThanOrEqual(1); expect(geometry.app).toBeLessThanOrEqual(1);
|
||||
const geometryContext = `${width}px ${mode}/${language} ${JSON.stringify(geometry)}`;
|
||||
expect(geometry.root, geometryContext).toBeLessThanOrEqual(1);
|
||||
expect(geometry.app, geometryContext).toBeLessThanOrEqual(1);
|
||||
const writePane = workspace.locator('[id$="-write-panel"]');
|
||||
const previewPane = workspace.locator('[id$="-preview-panel"]');
|
||||
const audit = async (state: string) => {
|
||||
@@ -238,7 +240,7 @@ test('cover letter workspace preserves keyboard drafts and localised controls ac
|
||||
expect(result.violations).toEqual([]);
|
||||
};
|
||||
if (width === 320 || width === 390 || width === 1440) await audit('write');
|
||||
if (width < 1024) {
|
||||
if (width < 768) {
|
||||
const tabs = workspace.getByRole('tablist', { name: t.assetsLetterWorkspace, exact: true });
|
||||
const write = tabs.getByRole('tab', { name: t.assetsLetterWrite, exact: true });
|
||||
const preview = tabs.getByRole('tab', { name: t.assetsLetterPreview, exact: true });
|
||||
@@ -260,6 +262,10 @@ test('cover letter workspace preserves keyboard drafts and localised controls ac
|
||||
} else {
|
||||
await expect(workspace.getByRole('tablist', { name: t.assetsLetterWorkspace, exact: true })).toHaveCount(0);
|
||||
await expect(writePane).toBeVisible(); await expect(previewPane).toBeVisible();
|
||||
const writeBounds = (await writePane.boundingBox())!;
|
||||
const previewBounds = (await previewPane.boundingBox())!;
|
||||
if (width <= 1000) expect(previewBounds.y).toBeGreaterThanOrEqual(writeBounds.y + writeBounds.height);
|
||||
else expect(previewBounds.x).toBeGreaterThanOrEqual(writeBounds.x + writeBounds.width);
|
||||
}
|
||||
for (const name of [t.save, t.letterExportPdf]) {
|
||||
const control = workspace.getByRole('button', { name, exact: true });
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect, test, type APIRequestContext, type Page, type TestInfo } from '@playwright/test';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { cvStudioSectionPicker, openCvStudioSection } from './helpers/cvStudioNavigation';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -58,7 +59,9 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await page.goto(`/career/builder/${cv.id}`);
|
||||
await expect(page.getByLabel(t.cvEditorName, { exact: true })).toHaveValue(cv.name);
|
||||
await expect(page.getByRole('tab', { name: t.cvEditorContent, exact: true })).toHaveAttribute('aria-selected', 'true');
|
||||
const selectedContent = page.getByRole('tab', { name: t.cvEditorContent, exact: true, selected: true });
|
||||
const studioPicker = cvStudioSectionPicker(page, t.cvEditorStudioNavigation);
|
||||
await expect(selectedContent.or(studioPicker.filter({ hasText: t.cvEditorContent }))).toBeVisible();
|
||||
await expect(page.getByRole('tabpanel', { name: t.cvEditorContent, exact: true })).toBeVisible();
|
||||
await expect(page.getByText(t.cvEditorScope, { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('link', { name: t.cvEditorLinkedApplication })).toHaveAttribute('href', `/jobs/${jobId}`);
|
||||
@@ -102,11 +105,11 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
await expect.poll(() => pending).toBe(true);
|
||||
await expect(page.getByText(t.cvEditorSaving, { exact: true })).toBeVisible();
|
||||
await capture(page, info, 'pending-save');
|
||||
await page.getByRole('tab', { name: t.cvEditorCustomize, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize);
|
||||
await expect(page.getByLabel(t.cvEditorPageSize, { exact: true })).toBeVisible();
|
||||
await page.getByRole('tab', { name: t.cvEditorTemplate, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorTemplate);
|
||||
await expect(page.getByRole('button', { name: t.cvEditorAllTemplates, exact: true })).toBeVisible();
|
||||
await page.getByRole('tab', { name: t.cvEditorContent, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorContent);
|
||||
await expect(headline).toHaveValue('Local CV draft — æøå');
|
||||
await expect(sectionSelect).toContainText('Frivillig arbeid og dokumenterte bidrag');
|
||||
for (const width of [899, 900, 1024]) {
|
||||
@@ -144,29 +147,35 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
expect((await pdfResponse).status()).toBe(200); expect((await download).suggestedFilename()).toMatch(/\.pdf$/i);
|
||||
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await page.getByRole('tab', { name: t.cvEditorHistory, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorHistory);
|
||||
const history = page.getByRole('tabpanel', { name: t.cvEditorHistory, exact: true });
|
||||
await expect(history.getByText(t.cvEditorHistoryScope, { exact: true })).toBeVisible();
|
||||
await expect(history.getByText(t.cvEditorVersion.replace('{version}', '1'), { exact: true })).toBeVisible();
|
||||
await capture(page, info, 'history'); await scan(page, info, 'history');
|
||||
await page.getByRole('tab', { name: t.cvEditorAiTools, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorAiTools);
|
||||
await expect(page.getByRole('tabpanel', { name: t.cvEditorAiTools, exact: true })).toBeVisible();
|
||||
await page.getByRole('tab', { name: t.cvEditorContent, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorContent);
|
||||
await expect(sectionSelect).toContainText('Frivillig arbeid og dokumenterte bidrag');
|
||||
await expect(page.getByRole('button', { name: label('cvEditorCollapseSection', 'Frivillig arbeid og dokumenterte bidrag'), exact: true })).toBeVisible();
|
||||
for (const width of [768, 390, 320]) {
|
||||
await headline.focus(); await page.setViewportSize({ width, height: 844 });
|
||||
await expect(editing).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: t.cvEditorEdit, exact: true })).toHaveAttribute('aria-pressed', 'true');
|
||||
const compact = width < 768;
|
||||
const edit = page.getByRole('button', { name: t.cvEditorEdit, exact: true });
|
||||
if (compact) await expect(edit).toHaveAttribute('aria-pressed', 'true');
|
||||
else await expect(edit).toHaveCount(0);
|
||||
await page.getByLabel(t.cvEditorName, { exact: true }).scrollIntoViewIfNeeded();
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1)).toBe(true);
|
||||
await capture(page, info, `edit-${width}`);
|
||||
await page.getByRole('button', { name: t.cvEditorPreview, exact: true }).click();
|
||||
await expect(page.getByRole('button', { name: t.cvEditorPreview, exact: true })).toHaveAttribute('aria-pressed', 'true');
|
||||
const previewEntry = page.getByRole('button', { name: compact ? t.cvEditorPreview : t.cvEditorFocusPreview, exact: true });
|
||||
await expect(previewEntry).toBeVisible();
|
||||
await previewEntry.click();
|
||||
if (compact) await expect(previewEntry).toHaveAttribute('aria-pressed', 'true');
|
||||
const preview = page.getByRole('region', { name: t.cvEditorLivePreview, exact: true });
|
||||
await expect(preview).toBeVisible(); await preview.focus(); await page.keyboard.press('End');
|
||||
await capture(page, info, `preview-${width}`);
|
||||
await page.getByRole('button', { name: t.cvEditorEdit, exact: true }).click();
|
||||
const editorEntry = compact ? edit : page.getByRole('button', { name: t.cvEditorFocusEditor, exact: true });
|
||||
await editorEntry.click();
|
||||
await expect(headline).toHaveValue('Local CV draft — æøå');
|
||||
}
|
||||
await scan(page, info, 'phone-edit');
|
||||
|
||||
@@ -22,7 +22,7 @@ async function capture(scope: Locator, info: TestInfo, state: string) {
|
||||
await info.attach(`${state}-viewport`, { body: JSON.stringify(geometry), contentType: 'application/json' });
|
||||
}
|
||||
async function scan(page: Page, info: TestInfo, state: string, region: string) {
|
||||
const result = await new AxeBuilder({ page }).include(`.MuiPaper-root:has(> [role="region"][aria-label=${JSON.stringify(region)}])`).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
|
||||
const result = await new AxeBuilder({ page }).include(`:has(> [role="region"][aria-label=${JSON.stringify(region)}])`).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
|
||||
await info.attach(`${state}-axe`, { body: JSON.stringify({ violations: result.violations, incomplete: result.incomplete }), contentType: 'application/json' });
|
||||
expect(result.violations).toEqual([]);
|
||||
}
|
||||
@@ -79,7 +79,8 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb']] as const) {
|
||||
expect(native.pages).toBeGreaterThanOrEqual(minimum);
|
||||
await expect(pages).toHaveCount(native.pages);
|
||||
await expect.poll(() => frames.evaluateAll(elements => elements.every(element => (element as HTMLIFrameElement).contentDocument?.documentElement.dataset.cvPreviewReady === 'true'))).toBe(true);
|
||||
await expect(chrome.getByText(t.cvEditorPageCount.replace('{count}', String(native.pages)), { exact: true })).toBeVisible();
|
||||
const pageCountLabel = native.pages === 1 ? t.cvEditorSinglePageCount : t.cvEditorPageCount;
|
||||
await expect(chrome.getByText(pageCountLabel.replace('{count}', String(native.pages)), { exact: true })).toBeVisible();
|
||||
expect(Number.isFinite(native.layoutDurationMs)).toBe(true); expect(native.layoutDurationMs).toBeGreaterThanOrEqual(0);
|
||||
expect(native.width).toBeCloseTo(210 * 96 / 25.4, 0); expect(native.height).toBeCloseTo(297 * 96 / 25.4, 0);
|
||||
const titles = await frames.evaluateAll(elements => elements.map(element => element.getAttribute('title')));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { expect, test, type APIRequestContext } from "@playwright/test";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { translations } from "../src/i18n/translations";
|
||||
import { openCvStudioSection } from "./helpers/cvStudioNavigation";
|
||||
|
||||
const apiUrl = "http://localhost:5302/api";
|
||||
const evidence = path.resolve(process.env.CV_FIDELITY_OUTPUT || "../.artifacts/p5-09-readiness/rendering");
|
||||
@@ -176,7 +178,7 @@ test("[PRES-C06 C10 E08] stale editor retains and downloads its draft; reviewed
|
||||
const headers = await authenticate(page.request);
|
||||
const cv = await (await page.request.post(`${apiUrl}/cv/variants`, { headers, data: { name: "Recovery fixture", settings: { themeId: "minimal" } } })).json();
|
||||
await page.goto(`/career/builder/${cv.id}`);
|
||||
await page.getByRole("tab", { name: "Content", exact: true }).click();
|
||||
await openCvStudioSection(page, translations.en.cvEditorStudioNavigation, translations.en.cvEditorContent);
|
||||
const headline = page.getByLabel("Headline override", { exact: true });
|
||||
await expect(headline).toBeVisible();
|
||||
const remote = await page.request.put(`${apiUrl}/cv/variants/${cv.id}`, { headers, data: { expectedVersion: cv.version, settings: { ...cv.settings, headline: "Remote reviewed edit" } } });
|
||||
@@ -207,6 +209,6 @@ test("[PRES-C06 C10 E08] stale editor retains and downloads its draft; reviewed
|
||||
expect((await reviewedSave).status()).toBe(200);
|
||||
await expect(page.getByText("Saved", { exact: true })).toBeVisible();
|
||||
expect((await (await page.request.get(`${apiUrl}/cv/variants/${cv.id}`)).json()).version).toBe(3);
|
||||
await page.getByRole("tab", { name: "History", exact: true }).click();
|
||||
await openCvStudioSection(page, translations.en.cvEditorStudioNavigation, translations.en.cvEditorHistory);
|
||||
await expect(page.getByText("Version 1", { exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { expect, test, type APIRequestContext, type BrowserContext, type Locator
|
||||
import fs from 'node:fs/promises';
|
||||
import type { CvOutline, CvVariant } from '../src/cvBuilder';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { cvStudioSectionPicker } from './helpers/cvStudioNavigation';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -105,9 +106,10 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
const headline = page.getByLabel(t.cvEditorHeadlineOverride, { exact: true });
|
||||
const saved = async () => { await expect(page.getByText(t.cvEditorSaved, { exact: true })).toBeVisible(); };
|
||||
const enterPreview = async (width: number) => {
|
||||
const entry = page.getByRole('button', { name: width < 900 ? t.cvEditorPreview : t.cvEditorFocusPreview, exact: true });
|
||||
const compact = width < 768;
|
||||
const entry = page.getByRole('button', { name: compact ? t.cvEditorPreview : t.cvEditorFocusPreview, exact: true });
|
||||
await entry.press('Enter');
|
||||
if (width < 900) { await returnEditor.focus(); await page.keyboard.press('Tab'); }
|
||||
if (compact) { await returnEditor.focus(); await page.keyboard.press('Tab'); }
|
||||
await expect(preview).toBeFocused(); await expect(preview).toBeVisible();
|
||||
await expect(preview).toHaveAttribute('aria-busy', 'false');
|
||||
const frames = preview.locator('[data-cv-page] iframe');
|
||||
@@ -146,7 +148,9 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
if (viewport.width === 320) await scan(page, info, 'pending-phone-preview');
|
||||
await page.keyboard.press('Shift+Tab'); await expect(returnEditor).toBeFocused(); await page.keyboard.press('Enter');
|
||||
await expect(editing).toBeFocused(); await expect(headline).toHaveValue(draft);
|
||||
await reachable(page.getByRole('tab', { name: t.cvEditorContent, exact: true }), viewport.width < 600 ? 44 : 0);
|
||||
const contentTab = page.getByRole('tab', { name: t.cvEditorContent, exact: true, selected: true });
|
||||
const contentPicker = cvStudioSectionPicker(page, t.cvEditorStudioNavigation).filter({ hasText: t.cvEditorContent });
|
||||
await reachable(contentTab.or(contentPicker), viewport.width < 600 ? 44 : 0);
|
||||
await reachable(editing.getByRole('button', { name: t.cvEditorUndo, exact: true }), viewport.width < 600 ? 44 : 0);
|
||||
if (viewport.width === 320) { await capture(page, info, 'pending-phone-editor', language); await scan(page, info, 'pending-phone-editor'); }
|
||||
expect((await read()).version).toBe(cv.version);
|
||||
@@ -232,7 +236,7 @@ test.describe('Chromium emulated coarse pointer; not physical touch hardware', (
|
||||
const tap = async (control: Locator) => { await control.scrollIntoViewIfNeeded(); const box = await reachable(control, 44); await page.touchscreen.tap(box.center.x, box.center.y); };
|
||||
for (const viewport of [{ width: 320, height: 844 }, { width: 390, height: 844 }, { width: 844, height: 390 }]) {
|
||||
await page.setViewportSize(viewport);
|
||||
await tap(page.getByRole('button', { name: t.cvEditorPreview, exact: true }));
|
||||
await tap(page.getByRole('button', { name: viewport.width < 768 ? t.cvEditorPreview : t.cvEditorFocusPreview, exact: true }));
|
||||
const preview = page.getByRole('region', { name: t.cvEditorLivePreview, exact: true });
|
||||
await expect(preview).toBeVisible();
|
||||
await preview.evaluate(node => { node.scrollTop = node.scrollHeight; });
|
||||
|
||||
@@ -2,6 +2,7 @@ import { expect, test, type APIRequestContext, type Locator, type Page, type Tes
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import type { CvOutline, CvVariant } from '../src/cvBuilder';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { openCvStudioSection } from './helpers/cvStudioNavigation';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -244,14 +245,14 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
// Existing history stores CV settings; it does not snapshot Career Profile.
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
const final = await read();
|
||||
await page.getByRole('tab', { name: t.cvEditorHistory, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorHistory);
|
||||
const history = page.getByRole('tabpanel', { name: t.cvEditorHistory, exact: true });
|
||||
await expect(history.getByText(t.cvEditorVersion.replace('{version}', '1'), { exact: true })).toBeVisible();
|
||||
await history.getByRole('button', { name: t.cvEditorRestoreTitle.replace('{version}', '1'), exact: true }).click();
|
||||
await page.getByRole('dialog').getByRole('button', { name: t.cvEditorRestoreVersion, exact: true }).click();
|
||||
await expect.poll(async () => (await read()).version).toBe(final.version + 1);
|
||||
expect((await read()).settings).toEqual(cv.settings); await unchanged(changedSource);
|
||||
await page.getByRole('tab', { name: t.cvEditorContent, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorContent);
|
||||
const inherited = entry('Updated source title');
|
||||
await expect(inherited.getByLabel(t.cvEditorEntryTitle, { exact: true })).toHaveValue('Updated source title');
|
||||
await expect(inherited.getByLabel(t.cvEditorEntrySubtitle, { exact: true })).toHaveValue('Updated source employer');
|
||||
|
||||
@@ -3,6 +3,7 @@ import AxeBuilder from '@axe-core/playwright';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { openCvStudioSection } from './helpers/cvStudioNavigation';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -110,7 +111,7 @@ for (const [mode, language, premium] of [['light', 'en', false], ['dark', 'nb',
|
||||
await page.setViewportSize({ width: 1440, height: 900 }); await page.goto(`/career/builder/${cv.id}`);
|
||||
await expect(page.getByLabel(t.cvEditorName, { exact: true })).toHaveValue(cv.name);
|
||||
const before = await measure(page, browser, info, cvUrl, language, `${mode}-${language}-before`);
|
||||
await page.getByRole('tab', { name: t.cvEditorCustomize, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize);
|
||||
const advanced = page.getByRole('button', { name: t.cvEditorAdvancedSettings, exact: true });
|
||||
await expect(advanced).toHaveAttribute('aria-expanded', 'false');
|
||||
await expect(page.getByRole('region', { name: t.cvEditorStyle, exact: true })).toBeVisible();
|
||||
@@ -137,7 +138,7 @@ for (const [mode, language, premium] of [['light', 'en', false], ['dark', 'nb',
|
||||
expect(after.measured.tokens.find(token => token.token === 'R01')!.fontSize).not.toBe(before.measured.tokens.find(token => token.token === 'R01')!.fontSize);
|
||||
await fs.mkdir(output, { recursive: true });
|
||||
await fs.writeFile(path.join(output, `${mode}-${language}-measurements.json`), JSON.stringify({ browserVersion: browser.version(), fixtures: [before, after] }, null, 2));
|
||||
const changed = await read(); await page.reload(); await page.getByRole('tab', { name: t.cvEditorCustomize, exact: true }).click();
|
||||
const changed = await read(); await page.reload(); await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize);
|
||||
await expect(margin).toHaveValue('22');
|
||||
// Reload starts the asynchronous preview layout again. Use its existing settled
|
||||
// state before pointer activation, so layout movement cannot select another field.
|
||||
@@ -155,7 +156,7 @@ for (const [mode, language, premium] of [['light', 'en', false], ['dark', 'nb',
|
||||
await advanced.scrollIntoViewIfNeeded(); await expect(advanced).toBeVisible(); await capture(page, info, `advanced-${width}`);
|
||||
}
|
||||
await scan(page, info, 'phone-advanced');
|
||||
await page.setViewportSize({ width: 1440, height: 900 }); await page.getByRole('tab', { name: t.cvEditorTemplate, exact: true }).click();
|
||||
await page.setViewportSize({ width: 1440, height: 900 }); await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorTemplate);
|
||||
await page.getByRole('button', { name: t.cvEditorAllTemplates, exact: true }).click();
|
||||
const technical = page.getByRole('button', { name: t.cvTemplateTechnicalName, exact: true }); await expect(technical).toHaveAttribute('aria-disabled', premium ? 'false' : 'true');
|
||||
await expect(technical).toHaveAccessibleDescription(new RegExp(premium ? t.cvEditorProUnlocked : t.cvEditorPro));
|
||||
@@ -176,13 +177,13 @@ for (const [mode, language, premium] of [['light', 'en', false], ['dark', 'nb',
|
||||
const selected = await read(); expect(selected.settings.themeId).toBe(premium ? 'technical' : 'code');
|
||||
for (const key of ['accentColor', 'bodyFont', 'baseFontSizePt', 'pageMarginMm', 'entryGapMm', 'sectionGapMm', 'lineHeight']) expect(selected.settings[key]).toBeNull();
|
||||
expect(selected.settings.sections).toEqual(changed.settings.sections); expect(selected.settings.pageSize).toBe('letter');
|
||||
await page.getByRole('tab', { name: t.cvEditorCustomize, exact: true }).click(); await advanced.click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize); await advanced.click();
|
||||
if (premium) { await expect(page.getByRole('spinbutton', { name: t.cvEditorSidebarWidth, exact: true })).toBeVisible(); await page.getByRole('spinbutton', { name: t.cvEditorSidebarWidth, exact: true }).fill('68'); await saved(); await expect.poll(async () => (await read()).settings.sidebarWidthMm).toBe(68); }
|
||||
await capture(page, info, 'selected-template-defaults');
|
||||
expect(await (await page.request.get(`${apiUrl}/career/profile`)).json()).toEqual(source);
|
||||
expect(await (await page.request.get(`${apiUrl}/cv/variants/${sibling.id}`)).json()).toEqual(sibling);
|
||||
const beforeRestore = await read();
|
||||
await page.getByRole('tab', { name: t.cvEditorHistory, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorHistory);
|
||||
await page.getByRole('tabpanel', { name: t.cvEditorHistory, exact: true }).getByRole('button', { name: t.cvEditorRestoreTitle.replace('{version}', '1'), exact: true }).click();
|
||||
await page.getByRole('dialog').getByRole('button', { name: t.cvEditorRestoreVersion, exact: true }).click(); await saved();
|
||||
await expect.poll(async () => (await read()).version).toBe(beforeRestore.version + 1);
|
||||
|
||||
@@ -60,7 +60,9 @@ test('[PRES-S01 S02 E07 E08 E09] Dashboard native data, visibility and responsiv
|
||||
await capture(page, info, 'dashboard-monthly-values-keyboard');
|
||||
for (const point of monthly) {
|
||||
const month = new Intl.DateTimeFormat('en-GB', { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(new Date(`${point.month}-01T12:00:00Z`));
|
||||
await expect(activity.getByRole('row', { name: `${month} ${point.applied} ${point.responses}`, exact: true })).toBeVisible();
|
||||
const row = activity.getByRole('row').filter({ has: page.getByRole('rowheader', { name: month, exact: true }) });
|
||||
await expect(row).toBeVisible();
|
||||
await expect(row.getByRole('cell')).toHaveText([String(point.applied), String(point.responses)]);
|
||||
}
|
||||
await activity.getByText('View monthly values').click();
|
||||
await page.getByText('Recorded status breakdown', { exact: true }).click();
|
||||
@@ -94,7 +96,8 @@ test('[PRES-S01 S02 E07 E08 E09] Dashboard native data, visibility and responsiv
|
||||
await expect(editor.locator('..')).toBeFocused();
|
||||
await editor.locator('summary').click();
|
||||
await expect(editor.getByRole('group', { name: t.dashboardManageWidgets })).toBeVisible();
|
||||
await expect(editor.getByRole('checkbox')).toHaveCount(9);
|
||||
await expect(editor.getByRole('checkbox')).toHaveCount(10);
|
||||
await expect(editor.getByRole('checkbox', { name: t.dashboardYourWeek, exact: true })).toBeVisible();
|
||||
if (language === 'en') {
|
||||
const editorScan = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
|
||||
await info.attach(`dashboard-${mode}-editor-axe`, { body: JSON.stringify({ violations: editorScan.violations, incomplete: editorScan.incomplete }), contentType: 'application/json' });
|
||||
@@ -144,7 +147,7 @@ test('[PRES-S01 S02 E07 E08 E09] Dashboard native data, visibility and responsiv
|
||||
await page.getByRole('button', { name: 'Customize dashboard' }).click();
|
||||
const newAccountEditor = page.getByRole('region', { name: 'Editing dashboard', exact: true });
|
||||
await newAccountEditor.locator('summary').click();
|
||||
await expect(newAccountEditor.getByRole('checkbox')).toHaveCount(9);
|
||||
await expect(newAccountEditor.getByRole('checkbox')).toHaveCount(10);
|
||||
for (const item of await newAccountEditor.getByRole('checkbox').all()) await expect(item).toBeChecked();
|
||||
await page.keyboard.press('Escape');
|
||||
const b = await login(page.request, emailB);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
@@ -141,7 +141,8 @@ for (const identity of ['anonymous', 'normal', 'admin'] as const) {
|
||||
}
|
||||
if (protectedAnonymous) {
|
||||
await publicState(page, census[0]);
|
||||
await expect(page.getByRole('main')).toHaveCount(0);
|
||||
await expect(page.getByRole('main').getByRole('heading', { name: 'Two clear plans', exact: true })).toBeVisible();
|
||||
if (row.heading) await expect(page.getByRole('heading', { level: 1, name: row.heading, exact: true })).toHaveCount(0);
|
||||
} else if (row.public && !(row.pattern === '/' && identity !== 'anonymous')) await publicState(page, row);
|
||||
else {
|
||||
await expect(page.getByRole('heading', { level: 1, name: row.pattern === '/' ? t.dashboard : row.heading!, exact: true })).toBeVisible();
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { expect, type Page } from '@playwright/test';
|
||||
|
||||
export function cvStudioSectionPicker(page: Page, navigation: string) {
|
||||
return page.getByRole('combobox', { name: navigation });
|
||||
}
|
||||
|
||||
export async function openCvStudioSection(page: Page, navigation: string, section: string) {
|
||||
const tab = page.getByRole('tablist', { name: navigation, exact: true }).getByRole('tab', { name: section, exact: true });
|
||||
const picker = cvStudioSectionPicker(page, navigation);
|
||||
await expect(tab.or(picker)).toBeVisible();
|
||||
if (await picker.isVisible()) {
|
||||
await picker.click();
|
||||
await page.getByRole('option', { name: section, exact: true }).click();
|
||||
} else {
|
||||
await tab.click();
|
||||
}
|
||||
await expect(page.getByRole('tabpanel', { name: section, exact: true })).toBeVisible();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import { translations } from '../../src/i18n/translations';
|
||||
|
||||
export async function changeShellLanguage(page: Page, language: 'en' | 'nb') {
|
||||
const current = (await page.locator('html').getAttribute('lang'))?.startsWith('nb') ? 'nb' : 'en';
|
||||
await page.getByRole('button', { name: translations[current].user, exact: true }).press('Enter');
|
||||
await page.getByRole('menuitemradio', {
|
||||
name: translations[current][language === 'nb' ? 'languageNorwegianBokmal' : 'languageEnglish'],
|
||||
exact: true,
|
||||
}).press('Enter');
|
||||
}
|
||||
@@ -58,7 +58,12 @@ test('[PRES-W01 W02 W03 J05 E08 E09] native Job header/Overview retains actions,
|
||||
await page.goto(`/jobs/${id}?section=overview`);
|
||||
await expect(page.getByRole('heading', { name: title, level: 2 })).toBeVisible();
|
||||
await expect(page.locator('html')).toHaveAttribute('data-color-scheme', mode);
|
||||
const summary = page.getByRole('region', { name: t.workspaceApplicationInfo, exact: true });
|
||||
const details = page.getByRole('button', { name: t.workspaceJobDetails, exact: true });
|
||||
await expect(details).toHaveAttribute('aria-expanded', 'false');
|
||||
await details.press('Enter');
|
||||
await expect(details).toHaveAttribute('aria-expanded', 'true');
|
||||
const summary = page.getByRole('region', { name: t.workspaceJobDetails, exact: true });
|
||||
await expect(summary.getByText(t.workspaceApplicationInfo, { exact: true })).toBeVisible();
|
||||
await expect(summary).toContainText(new Date(jobData.dateApplied).toLocaleDateString(language === 'nb' ? 'nb-NO' : 'en'));
|
||||
const progress = page.getByRole('region', { name: `${t.workspaceProgress}: ${t.statusInterview}` });
|
||||
await expect(progress.locator('[aria-current=step]')).toHaveText(t.statusInterview);
|
||||
@@ -94,7 +99,10 @@ test('[PRES-W01 W02 W03 J05 E08 E09] native Job header/Overview retains actions,
|
||||
await capture(page, info, 'job-custom-status-dark-nb');
|
||||
await page.goto(`/jobs/${sparseId}`);
|
||||
await expect(page.getByRole('heading', { name: 'Sparse application' })).toBeVisible();
|
||||
await expect(page.getByRole('region', { name: translations.nb.workspaceApplicationInfo }).getByText('—', { exact: true })).toHaveCount(3);
|
||||
await page.getByRole('button', { name: translations.nb.workspaceJobDetails, exact: true }).press('Enter');
|
||||
const sparseDetails = page.getByRole('region', { name: translations.nb.workspaceJobDetails, exact: true });
|
||||
await expect(sparseDetails.getByText('—', { exact: true })).toHaveCount(7);
|
||||
await expect(sparseDetails.getByText(translations.nb.workspaceNotScheduled, { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('link', { name: translations.nb.workspaceOpenAdvert })).toHaveCount(0);
|
||||
await capture(page, info, 'job-sparse-dark-nb');
|
||||
const foreignEmail = `job-overview-foreign-${Date.now()}@example.test`;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import AxeBuilder from "@axe-core/playwright";
|
||||
import { expect, test as base, type APIRequestContext, type Page, type TestInfo } from "@playwright/test";
|
||||
import { translations } from "../src/i18n/translations";
|
||||
import { openCvStudioSection } from "./helpers/cvStudioNavigation";
|
||||
|
||||
const apiUrl = "http://localhost:5302/api";
|
||||
const password = "E2ePassword123!";
|
||||
@@ -107,7 +108,7 @@ for (const [mode, language, width] of [["light", "en", 1440], ["dark", "nb", 144
|
||||
|
||||
const canonicalBefore = (await (await page.request.get(`${apiUrl}/career/profile`)).json()).profile;
|
||||
await page.goto(`/career/builder/${owner.cvId}`);
|
||||
await page.getByRole("tab", { name: t.cvEditorCustomize, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize);
|
||||
const advanced = page.getByRole("button", { name: t.cvEditorAdvancedSettings, exact: true });
|
||||
await advanced.focus(); await page.keyboard.press("Enter");
|
||||
await expect(advanced).toHaveAttribute("aria-expanded", "true");
|
||||
|
||||
@@ -122,6 +122,7 @@ test('[P7-10 System A03] SMTP submitted acknowledgement preserves newer edits an
|
||||
});
|
||||
|
||||
test('[P7-10 System A03] bilingual diagnostic and settings panels reflow at six finite theme widths',async({page,session},info)=>{
|
||||
test.setTimeout(90_000);
|
||||
const administrator=await login(session.requests,page.request,'e2e@example.test'); await fixtures(page);
|
||||
for(const sample of [{width:320,language:'nb',mode:'dark'},{width:390,language:'en',mode:'light'},{width:768,language:'nb',mode:'light'},{width:1024,language:'en',mode:'dark'},{width:1440,language:'en',mode:'light'},{width:1920,language:'nb',mode:'dark'}] as const){
|
||||
expect((await call(session.requests,page.request,'PUT','/auth/preferences/language',administrator.headers,{language:sample.language==='nb'?'nb-NO':'en'})).status()).toBe(204);
|
||||
|
||||
@@ -130,7 +130,7 @@ test('[P7-10 Users A01] finite bilingual light/dark widths retain long identitie
|
||||
expect((await call(session.requests, page.request, 'PUT', '/auth/preferences/language', administrator.headers, { language: sample.language==='nb' ? 'nb-NO' : 'en' })).status()).toBe(204);
|
||||
await page.addInitScript(value => { localStorage.setItem('uiLanguage', value.language); localStorage.setItem('jobtracker.themeMode', value.mode); }, sample);
|
||||
await start(page, '/admin/users', sample.width);
|
||||
await expect(page.getByRole('heading', { level: 3, name: copy('adminUsersCreateUser', sample.language), exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { level: 2, name: copy('adminUsersCreateUser', sample.language), exact: true })).toBeVisible();
|
||||
if (sample.width>=768) {
|
||||
const grid=page.getByRole('grid');
|
||||
await expect(grid.getByRole('row').nth(1)).toBeVisible();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
@@ -427,7 +428,7 @@ test('[P7-06 forms] live EN/Bokmal retains dirty letter and both answer drafts w
|
||||
test.setTimeout(90_000); const seeded = await fixture(page, session.owner); await enter(page, session.owner, seeded.job, 'letter');
|
||||
await expect(letter(page)).toHaveValue(seeded.originalLetter); await letter(page).fill('Dirty owner text remains the same across UI locale — æøå');
|
||||
let reads = assetReads(session, seeded.job.id).length;
|
||||
const firstLocale = response(page, 'PUT', `${apiUrl}/auth/preferences/language`); await keyboard(page, page.locator('header').first().getByRole('button', { name: translations.en.languageNorwegianBokmal, exact: true }));
|
||||
const firstLocale = response(page, 'PUT', `${apiUrl}/auth/preferences/language`); await changeShellLanguage(page, 'nb');
|
||||
const firstLocaleResponse = await firstLocale;
|
||||
await info.attach('application-locale-first-http', { body: JSON.stringify({ status: firstLocaleResponse.status(), body: await firstLocaleResponse.text() }), contentType: 'application/json' });
|
||||
expect(firstLocaleResponse.status()).toBe(204);
|
||||
@@ -438,7 +439,7 @@ test('[P7-06 forms] live EN/Bokmal retains dirty letter and both answer drafts w
|
||||
await keyboard(page, page.getByRole('tablist', { name: translations.nb.workspaceApplicationSections, exact: true }).getByRole('tab', { name: translations.nb.workspaceAnswers, exact: true }));
|
||||
const fields = drafts(page, 'nb'); await expect(fields.answer).toHaveValue(seeded.answer);
|
||||
await fields.answer.fill('Ulagret søknadssvar — æøå'); await fields.message.fill('Ulagret melding; ikke sendt — æøå'); reads = assetReads(session, seeded.job.id).length;
|
||||
const secondLocale = response(page, 'PUT', `${apiUrl}/auth/preferences/language`); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'English', exact: true }));
|
||||
const secondLocale = response(page, 'PUT', `${apiUrl}/auth/preferences/language`); await changeShellLanguage(page, 'en');
|
||||
const secondLocaleResponse = await secondLocale;
|
||||
await info.attach('application-locale-second-http', { body: JSON.stringify({ status: secondLocaleResponse.status(), body: await secondLocaleResponse.text() }), contentType: 'application/json' });
|
||||
expect(secondLocaleResponse.status()).toBe(204);
|
||||
@@ -556,7 +557,7 @@ test('[P7-06 forms] controlled language HTTP503 preserves local dirty drafts and
|
||||
const dirtyLetter = 'Controlled-failure draft; retain my exact unsaved letter — æøå';
|
||||
await letter(page).fill(dirtyLetter); let reads = assetReads(session, seeded.job.id).length;
|
||||
const firstResponse = response(page, 'PUT', preferenceUrl);
|
||||
await keyboard(page, page.locator('header').first().getByRole('button', { name: translations.en.languageNorwegianBokmal, exact: true }));
|
||||
await changeShellLanguage(page, 'nb');
|
||||
expect((await firstResponse).status()).toBe(503); await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
await expect(letter(page, 'nb')).toHaveValue(dirtyLetter);
|
||||
const nbFeedback = page.getByRole('alert').filter({ hasText: translations.nb.settingsLanguageSaveFailed }); await expect(nbFeedback).toBeVisible();
|
||||
@@ -573,7 +574,7 @@ test('[P7-06 forms] controlled language HTTP503 preserves local dirty drafts and
|
||||
const dirtyAnswer = 'Ulagret søknadssvar under kontrollert språkfeil — æøå'; const dirtyMessage = 'Ulagret melding; ikke sendt under språkfeilen — æøå';
|
||||
await drafts(page, 'nb').answer.fill(dirtyAnswer); await drafts(page, 'nb').message.fill(dirtyMessage); reads = assetReads(session, seeded.job.id).length;
|
||||
const secondResponse = response(page, 'PUT', preferenceUrl);
|
||||
await keyboard(page, page.locator('header').first().getByRole('button', { name: 'English', exact: true }));
|
||||
await changeShellLanguage(page, 'en');
|
||||
expect((await secondResponse).status()).toBe(503); await expect(page.locator('html')).toHaveAttribute('lang', 'en');
|
||||
await expect(drafts(page).answer).toHaveValue(dirtyAnswer); await expect(drafts(page).message).toHaveValue(dirtyMessage);
|
||||
const enFeedback = page.getByRole('alert').filter({ hasText: translations.en.settingsLanguageSaveFailed }); await expect(enFeedback).toBeVisible();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Page, type TestInfo } from '@playwright/test';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import type { StructuredCvProfile } from '../src/profileCv';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
@@ -183,7 +184,7 @@ test('[P7-03 PRES-C01 C02 E08] structured and raw drafts survive English to Bokm
|
||||
await expect(page.getByLabel(translations.en.profileCvContactPhone, { exact: true })).toHaveValue(draftPhone);
|
||||
const readsBeforeLocale = profileReads;
|
||||
const preferenceSaved = page.waitForResponse(response => response.url() === `${apiUrl}/auth/preferences/language` && response.request().method() === 'PUT');
|
||||
await page.locator('header').getByRole('button', { name: 'Norsk', exact: true }).click();
|
||||
await changeShellLanguage(page, 'nb');
|
||||
expect((await preferenceSaved).status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
await expect(page.getByLabel(translations.nb.profileCvContactPhone, { exact: true })).toBeVisible();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
@@ -456,7 +457,7 @@ test('[P7-05 Companies] live locale changes translate failures and relationship
|
||||
await enter(page, session.owner); await expect(edit(page, company)).toBeVisible();
|
||||
const reads = count(session.requests, 'GET', '/api/companies');
|
||||
const preference = response(page, 'PUT', `${apiUrl}/auth/preferences/language`);
|
||||
await keyboardActivate(page, page.locator('header').getByRole('button', { name: 'Norsk', exact: true }));
|
||||
await changeShellLanguage(page, 'nb');
|
||||
expect((await preference).status()).toBe(204); await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
await expect(edit(page, company, 'nb')).toBeVisible(); expect(count(session.requests, 'GET', '/api/companies')).toBe(reads);
|
||||
await keyboardActivate(page, relationshipAction(page, company, 'nb'));
|
||||
@@ -482,7 +483,7 @@ test('[P7-05 Companies] live locale changes translate failures and relationship
|
||||
await keyboardActivate(page, translated.getByRole('button', { name: en.cancel, exact: true })); await expect(translated).toHaveCount(0);
|
||||
await expect(edit(page, company)).toBeFocused(); expect(await nativeCompany(page, company)).toEqual(company);
|
||||
} finally { await otherTab.close(); }
|
||||
await info.attach('companies-locale-boundary', { body: JSON.stringify({ initialHeaderChange: 'Actual named Norsk header control and native language-preference204.',
|
||||
await info.attach('companies-locale-boundary', { body: JSON.stringify({ initialHeaderChange: 'Actual named Bokmal language option in the account menu and native language-preference204.',
|
||||
modalChange: 'Actual same-origin second browser tab changes localStorage, producing a storage event while the primary modal stays mounted.',
|
||||
recordedCompaniesReads: reads, qualification: 'The primary page request log proves no Companies refetch or duplicate PUT during its locale transition. The second tab has its own independent initial read; no hidden modal-background control was forced.' }), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type Route, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -195,9 +196,9 @@ test('[P7-06 compose] labelled uncertain pending sending sent and generic409 fix
|
||||
|
||||
test('[P7-06 compose] strict actual language204 preserves all dirty fields and saved identity without draft or setup rereads', async ({ page, session }, info) => {
|
||||
test.setTimeout(120_000); const parent = await job(page.request, session.owner); const original = await stored(page.request, session.owner, parent); await capableProjection(page); await enter(page, session.owner); await resume(page, original); const edited = { to: 'edited-local@example.test', subject: 'Unsaved bilingual subject — æøå', bodyText: 'Unsaved bilingual body\nÆ Ø Å' }; await fill(page, edited); const readCount = reads(session).length;
|
||||
const changed = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'Norsk', exact: true })); const actual = await changed; await info.attach('compose-first-language-http', { body: JSON.stringify({ status: actual.status(), body: await actual.text(), qualification: 'Ordinary strict204 assertion; existing RD11 remains a failure if the real backend returns500.' }), contentType: 'application/json' }); expect(actual.status()).toBe(204);
|
||||
const changed = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await changeShellLanguage(page, 'nb'); const actual = await changed; await info.attach('compose-first-language-http', { body: JSON.stringify({ status: actual.status(), body: await actual.text(), qualification: 'Ordinary strict204 assertion; existing RD11 remains a failure if the real backend returns500.' }), contentType: 'application/json' }); expect(actual.status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO'); await expect(fields(page, 'nb').to).toHaveValue(edited.to); await expect(fields(page, 'nb').subject).toHaveValue(edited.subject); await expect(fields(page, 'nb').body).toHaveValue(edited.bodyText); expect(reads(session)).toHaveLength(readCount); expect(await getDraft(page.request, original)).toEqual(original); await capture(page, info, { ...desktop, language: 'nb' }, 'strict-language-dirty-draft');
|
||||
const restored = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'English', exact: true })); const actualRestored = await restored; await info.attach('compose-second-language-http', { body: JSON.stringify({ status: actualRestored.status(), body: await actualRestored.text() }), contentType: 'application/json' }); expect(actualRestored.status()).toBe(204); await expect(fields(page).body).toHaveValue(edited.bodyText); expect(reads(session)).toHaveLength(readCount); expect(session.requests.filter(value => value.method !== 'GET' && value.path.startsWith('/api/email/'))).toEqual([]);
|
||||
const restored = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await changeShellLanguage(page, 'en'); const actualRestored = await restored; await info.attach('compose-second-language-http', { body: JSON.stringify({ status: actualRestored.status(), body: await actualRestored.text() }), contentType: 'application/json' }); expect(actualRestored.status()).toBe(204); await expect(fields(page).body).toHaveValue(edited.bodyText); expect(reads(session)).toHaveLength(readCount); expect(session.requests.filter(value => value.method !== 'GET' && value.path.startsWith('/api/email/'))).toEqual([]);
|
||||
});
|
||||
|
||||
test('[P7-06 compose] eight finite bilingual theme widths retain long drafts and keyboard setup review Cancel with complete axe vectors', async ({ page, session }, info) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import type { CorrespondenceInboxItem } from '../src/views/CorrespondenceInboxPage';
|
||||
import type { GmailReviewQueueResponse, GmailReviewThread, GmailSuggestedJobsResponse } from '../src/types';
|
||||
|
||||
@@ -227,13 +228,13 @@ test('[P7-06 read] strict real UI-language204 preserves inbox context, selected
|
||||
test.setTimeout(120_000); const seeded = await seed(page, session.owner, 3, 'Locale preserved'); const queue = reviewFixture(seeded.job); await controlledReview(page, queue);
|
||||
await enter(page, session.owner); await page.getByRole('textbox', { name: translations.en.correspondenceSearch, exact: true }).fill('Locale preserved'); await expect(inbox(page).getByRole('article')).toHaveCount(3); await show(page, seeded.messages[0]); await expect(detail(page, seeded.messages[0].subject)).toContainText(seeded.messages[0].content);
|
||||
let reads = readRequests(session).length;
|
||||
const locale = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'Norsk', exact: true }));
|
||||
const locale = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await changeShellLanguage(page, 'nb');
|
||||
const real = await locale; await info.attach('inbox-locale-first-http', { body: JSON.stringify({ status: real.status(), body: await real.text() }), contentType: 'application/json' }); expect(real.status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO'); await expect(page.getByRole('textbox', { name: translations.nb.correspondenceSearch, exact: true })).toHaveValue('Locale preserved'); await expect(detail(page, seeded.messages[0].subject, 'nb')).toContainText(seeded.messages[0].content);
|
||||
expect(readRequests(session)).toHaveLength(reads); await capture(page, info, { ...desktop, language: 'nb' }, 'strict-locale-preserved-saved-detail');
|
||||
await keyboard(page, inbox(page, 'nb').getByRole('button', { name: translations.nb.emailInboxReviewSuggestions, exact: true })); await expect(review(page, 'nb').getByRole('article')).toHaveCount(2);
|
||||
const subject = queue.threads[0].subject; await row(page, subject).getByRole('textbox', { name: translations.nb.gmailReviewNotes, exact: true }).fill('Ulagret kontrollnotat — æøå'); reads = readRequests(session).length;
|
||||
const second = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'English', exact: true }));
|
||||
const second = waitResponse(page, 'PUT', '/api/auth/preferences/language'); await changeShellLanguage(page, 'en');
|
||||
const secondReal = await second; await info.attach('inbox-locale-second-http', { body: JSON.stringify({ status: secondReal.status(), body: await secondReal.text() }), contentType: 'application/json' }); expect(secondReal.status()).toBe(204);
|
||||
await expect(row(page, subject).getByRole('textbox', { name: translations.en.gmailReviewNotes, exact: true })).toHaveValue('Ulagret kontrollnotat — æøå'); expect(readRequests(session)).toHaveLength(reads);
|
||||
await capture(page, info, desktop, 'strict-locale-dirty-review-notes'); noDelivery(session);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Page, type Response, type TestInfo } from '@playwright/test';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import type { CvTheme, CvVariant, CvVariantSummary, CvVariantVersionInfo } from '../src/cvBuilder';
|
||||
import { emptyStructuredCv } from '../src/profileCv';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
@@ -214,7 +215,7 @@ test('[P7-04 PRES-C05 C08 E08] locale-retained create draft locks during held fa
|
||||
await dialog.getByRole('button', { name: translations.en.cancel, exact: true }).click();
|
||||
const readsBeforeLocale = { listReads, themeReads };
|
||||
const saved = page.waitForResponse(response => response.url() === `${apiUrl}/auth/preferences/language` && response.request().method() === 'PUT');
|
||||
await page.locator('header').getByRole('button', { name: 'Norsk', exact: true }).click();
|
||||
await changeShellLanguage(page, 'nb');
|
||||
expect((await saved).status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
dialog = await openCreate(page, 'nb');
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
@@ -701,7 +702,7 @@ test('[P7-05 Discovery] header locale change retains drafts, selected saved sour
|
||||
await page.getByLabel(en.jobDiscoverySavedName, { exact: true }).fill('Unsubmitted saved-name draft');
|
||||
const before = [...session.requests];
|
||||
const savedPreference = response(page, 'PUT', `${apiUrl}/auth/preferences/language`);
|
||||
await keyboardActivate(page, page.locator('header').getByRole('button', { name: en.languageNorwegianBokmal, exact: true }));
|
||||
await changeShellLanguage(page, 'nb');
|
||||
expect((await savedPreference).status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
await expect(page.getByLabel(nb.jobDiscoveryRoleCompany, { exact: true })).toHaveValue('unsubmitted role Æ Ø Å');
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type TestInfo } from '@playwright/test';
|
||||
import fs from 'node:fs/promises';
|
||||
@@ -137,10 +138,10 @@ test('[P7-09 J10] controlled503 after an actual second job commit reports only a
|
||||
] as const;
|
||||
for (const sample of samples) {
|
||||
await page.setViewportSize({ width: sample.width, height: sample.width < 768 ? 844 : 900 });
|
||||
const languageButton = page.locator('header').getByRole('button', { name: sample.language === 'nb' ? 'Norsk' : 'English', exact: true });
|
||||
if (await languageButton.getAttribute('aria-pressed') !== 'true') {
|
||||
const expectedLanguage = sample.language === 'nb' ? 'nb-NO' : 'en';
|
||||
if (await page.locator('html').getAttribute('lang') !== expectedLanguage) {
|
||||
const savedLanguage = page.waitForResponse(value => new URL(value.url()).pathname === '/api/auth/preferences/language' && value.request().method() === 'PUT');
|
||||
await keyboard(languageButton); expect((await savedLanguage).status()).toBe(204);
|
||||
await changeShellLanguage(page, sample.language); expect((await savedLanguage).status()).toBe(204);
|
||||
}
|
||||
const current = page.getByRole('group', { name: copy('importExportTitle', sample.language), exact: true });
|
||||
await expect(current.getByRole('alert')).toContainText(copy('jobImportStopped', sample.language, { row: 2, count: 1, total: 3 }));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type BrowserContext, type Locator, type Page, type Response } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
|
||||
@@ -89,7 +90,7 @@ test('[P7-09 OAuth sender] actual unconfigured Microsoft failure and anonymous40
|
||||
test.setTimeout(150_000); await childRoutes(context); await enter(page, '/settings/connected-accounts'); const actualFailure = response(page, 'GET', '/microsoft-graph/connect-url'); await keyboard(page, connectRow(page, 'microsoft-graph').getByRole('button', { name: copy('emailConnectionsConnect'), exact: true })); const unconfigured = await actualFailure; expect(unconfigured.status()).toBe(500); expect((await proof(page)).opens).toEqual([]); await expect(page.getByRole('alert').filter({ hasText: 'An error occurred while' })).toBeVisible();
|
||||
const gate = hold(); try {
|
||||
await projectConnect(page, session.owner, 'gmail', gate); await page.evaluate(() => { (window as InstrumentedWindow).__clientGuardProof.blockNext = true; }); const connectRequest = page.waitForRequest(request => new URL(request.url()).pathname === '/api/gmail/connect-url'); await keyboard(page, connectRow(page, 'gmail').getByRole('button', { name: copy('emailConnectionsConnect'), exact: true })); await connectRequest;
|
||||
const languageSave = response(page, 'PUT', '/auth/preferences/language'); await keyboard(page, page.locator('header').getByRole('button', { name: 'Norsk', exact: true })); expect((await languageSave).status()).toBe(204); gate.release(); await expect(page.getByRole('alert').filter({ hasText: copy('emailConnectionsPopupBlocked', 'nb') })).toBeVisible(); const blocked = (await proof(page)).opens.at(-1)!; expect(blocked).toMatchObject({ blocked: true, closed: null, name: 'jobtracker-gmail-connect' }); await disconnected(page.request);
|
||||
const languageSave = response(page, 'PUT', '/auth/preferences/language'); await changeShellLanguage(page, 'nb'); expect((await languageSave).status()).toBe(204); gate.release(); await expect(page.getByRole('alert').filter({ hasText: copy('emailConnectionsPopupBlocked', 'nb') })).toBeVisible(); const blocked = (await proof(page)).opens.at(-1)!; expect(blocked).toMatchObject({ blocked: true, closed: null, name: 'jobtracker-gmail-connect' }); await disconnected(page.request);
|
||||
} finally { gate.release(); }
|
||||
const anonymous = await playwright.request.newContext(); try { for (const provider of ['gmail', 'microsoft-graph']) expect((await anonymous.get(`${apiUrl}/${provider}/connect-url`)).status()).toBe(401); } finally { await anonymous.dispose(); }
|
||||
await info.attach('oauth-client-guard-startup-and-counted-block', { body: JSON.stringify({ boundary, actualMicrosoftConnectStatus: unconfigured.status(), configurationQualification: 'MicrosoftGraphOAuthService reads Microsoft:ClientId only; checked-in isolated development config lacks it and default exception handling returns500. No503/Gmail-unconfigured assumption.', actualAnonymousConnectStatuses: [401, 401], popupProofBeforeSessionDisposal: await proof(page), qualification: 'Popup blocking is a controlled null-return fixture. Current-language fallback is an actual UI language PUT204 during held authenticated controlled connect GET. Anonymous401 is real separate API evidence, not a fabricated browser response.' }), contentType: 'application/json' });
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
@@ -108,7 +109,7 @@ async function enter(page: Page, owner: Owner, sample: Sample = desktop) {
|
||||
await expect(page.locator('html')).toHaveAttribute('data-color-scheme', sample.theme);
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveCount(1);
|
||||
await expect(page.getByRole('heading', { level: 1, name: translations[sample.language].offerComparisonTitle, exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { level: 2, name: translations[sample.language].offerComparisonTitle, exact: true })).toBeVisible();
|
||||
await expect(results(page, sample.language)).toBeVisible();
|
||||
}
|
||||
|
||||
async function capture(page: Page, info: TestInfo, sample: Sample, state: string) {
|
||||
@@ -162,7 +163,7 @@ test('[P7-05 Offers] actual 25-of-27 ordered sample excludes other/deleted/forei
|
||||
await expect(results(page).getByText(sampleLabel('en', 25, 27), { exact: true })).toBeVisible();
|
||||
await expect(results(page).getByText(translations.en.offerComparisonSampleHelp, { exact: true })).toBeVisible();
|
||||
await expect(results(page).getByRole('article')).toHaveCount(25);
|
||||
expect(await results(page).getByRole('heading', { level: 3 }).allTextContents()).toEqual(offers.slice(0, 25).map(item => item.jobTitle));
|
||||
expect(await results(page).getByRole('article').getByRole('heading', { level: 2 }).allTextContents()).toEqual(offers.slice(0, 25).map(item => item.jobTitle));
|
||||
for (const excluded of [other, deleted, foreignJob, offers[25], offers[26]]) await expect(card(page, excluded.jobTitle)).toHaveCount(0);
|
||||
expect(offerRequests(session.requests)[0].query).toEqual(params);
|
||||
const fullList = page.waitForResponse(response => {
|
||||
@@ -251,7 +252,7 @@ test('[P7-05 Offers] held actual reads and controlled failure recover through ex
|
||||
await expect(results(page).getByRole('alert')).toContainText(translations.en.offerComparisonLoadFailed);
|
||||
await capture(page, info, desktop, 'controlled-load-failure');
|
||||
const preference = page.waitForResponse(response => response.url() === `${apiUrl}/auth/preferences/language` && response.request().method() === 'PUT');
|
||||
await keyboard(page, page.locator('header').getByRole('button', { name: 'Norsk', exact: true }));
|
||||
await changeShellLanguage(page, 'nb');
|
||||
expect((await preference).status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
await expect(results(page, 'nb').getByRole('alert')).toContainText(translations.nb.offerComparisonLoadFailed);
|
||||
@@ -268,9 +269,9 @@ test('[P7-05 Offers] held actual reads and controlled failure recover through ex
|
||||
await expect(results(page, 'nb').getByText(sampleLabel('nb', 1, 1), { exact: true })).toBeVisible();
|
||||
expect(attempts).toBe(2); expect(offerRequests(session.requests).map(request => request.query)).toEqual([params, params]);
|
||||
const english = page.waitForResponse(response => response.url() === `${apiUrl}/auth/preferences/language` && response.request().method() === 'PUT');
|
||||
await keyboard(page, page.locator('header').getByRole('button', { name: 'English', exact: true }));
|
||||
await changeShellLanguage(page, 'en');
|
||||
expect((await english).status()).toBe(204);
|
||||
await expect(page.getByRole('heading', { level: 2, name: translations.en.offerComparisonTitle, exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { level: 1, name: translations.en.offerComparisonTitle, exact: true })).toBeVisible();
|
||||
expect(attempts).toBe(2); expect(offerRequests(session.requests)).toHaveLength(2);
|
||||
expect((await json<JobApplication>(await page.request.get(`${jobsUrl}/${offer.id}`))).jobTitle).toBe(offer.jobTitle);
|
||||
});
|
||||
@@ -295,7 +296,7 @@ test('[P7-05 Offers] eight finite bilingual theme widths preserve long recorded
|
||||
const t = translations[sample.language];
|
||||
await enter(page, session.owner, sample);
|
||||
await expect(card(page, offer.jobTitle)).toBeVisible();
|
||||
await expect(card(page, offer.jobTitle).getByRole('heading', { level: 3, name: offer.jobTitle, exact: true })).toBeVisible();
|
||||
await expect(card(page, offer.jobTitle).getByRole('heading', { level: 2, name: offer.jobTitle, exact: true })).toBeVisible();
|
||||
await expect(card(page, offer.jobTitle)).toContainText(source.name);
|
||||
await expect(fact(card(page, offer.jobTitle), t.offerComparisonNotes)).toContainText(offer.notes!);
|
||||
await expect(results(page, sample.language).getByText(sampleLabel(sample.language, 2, 2), { exact: true })).toBeVisible();
|
||||
|
||||
@@ -154,8 +154,9 @@ test('[P7-02 PRES-S02 E09] dismissal survives reload and remains isolated across
|
||||
await region.getByRole('button', { name: translations.en.onboardingDismiss }).focus();
|
||||
await page.keyboard.press('Enter');
|
||||
await expect(region).toHaveCount(0);
|
||||
await expect(page.getByRole('button', { name: translations.en.onboardingResume, exact: true })).toBeFocused();
|
||||
await page.keyboard.press('Tab');
|
||||
await expect(page.getByRole('button', { name: translations.en.dashboardCustomize, exact: true })).toBeFocused();
|
||||
await expect(page.getByRole('button', { name: translations.en.onboardingWalkthrough, exact: true })).toBeFocused();
|
||||
expect(await page.evaluate(id => localStorage.getItem(`onboardingDismissed:${id}`), owner.id)).toBe('true');
|
||||
await assertDismissedAfterSettledNavigation(page, async () => { await page.reload(); });
|
||||
const admin = await playwright.request.newContext();
|
||||
@@ -276,8 +277,7 @@ test('[P7-02 PRES-S02 E08] recovery to four complete setup steps removes guidanc
|
||||
await region.getByRole('button', { name: translations.en.retry, exact: true }).focus();
|
||||
await page.keyboard.press('Enter');
|
||||
await expect(region).toHaveCount(0);
|
||||
await page.keyboard.press('Tab');
|
||||
await expect(page.getByRole('button', { name: translations.en.dashboardCustomize, exact: true })).toBeFocused();
|
||||
await expect(page.getByRole('button', { name: translations.en.onboardingWalkthrough, exact: true })).toBeFocused();
|
||||
expect(writes).toEqual([]);
|
||||
await capture(page, info, sample, 'four-complete-recovery-next-keyboard-action');
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { realpathSync } from 'node:fs';
|
||||
@@ -107,7 +108,7 @@ test('[P7-08 operations] controlled failed read and held old poll cannot revert
|
||||
await expect.poll(() => loads, { timeout: 25_000 }).toBe(3); await started.pending; const cancellation = waitResponse(page, 'POST', `/operations/${id}/cancel`); await keyboard(page, taskCard(page, id).getByRole('button', { name: copy('cancel'), exact: true })); const committed = await json<Operation>(await cancellation); expect(committed).toMatchObject({ id, status: 'cancelled', canRetry: true });
|
||||
const refreshFailure = activity(page).getByRole('alert').filter({ hasText: copy('operationsCommittedRefreshFailed') }); await expect(refreshFailure).toBeVisible(); await expect(taskCard(page, id).getByText(copy('operationsStatusCancelled'), { exact: true })).toBeVisible(); await expect(taskCard(page, id).getByRole('button', { name: copy('retry'), exact: true })).toBeDisabled();
|
||||
gate.release(); await delivered.pending; await page.evaluate(() => new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())))); await expect(taskCard(page, id).getByText(copy('operationsStatusCancelled'), { exact: true })).toBeVisible(); expect(await operation(page.request, id)).toEqual(committed); expect(loads).toBe(4);
|
||||
const languageSave = waitResponse(page, 'PUT', '/auth/preferences/language'); await keyboard(page, page.locator('header').getByRole('button', { name: 'Norsk', exact: true })); expect((await languageSave).status()).toBe(204); await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO'); const localizedFailure = activity(page, 'nb').getByRole('alert').filter({ hasText: copy('operationsCommittedRefreshFailed', 'nb') }); await expect(localizedFailure).toBeVisible(); expect(loads).toBe(4);
|
||||
const languageSave = waitResponse(page, 'PUT', '/auth/preferences/language'); await changeShellLanguage(page, 'nb'); expect((await languageSave).status()).toBe(204); await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO'); const localizedFailure = activity(page, 'nb').getByRole('alert').filter({ hasText: copy('operationsCommittedRefreshFailed', 'nb') }); await expect(localizedFailure).toBeVisible(); expect(loads).toBe(4);
|
||||
await keyboard(page, localizedFailure.getByRole('button', { name: copy('retry', 'nb'), exact: true })); await expect(localizedFailure).toHaveCount(0); await expect(taskCard(page, id, 'nb').getByRole('button', { name: copy('retry', 'nb'), exact: true })).toBeEnabled(); expect(loads).toBe(5); expect(count(session, 'POST', `/operations/${id}/cancel`)).toHaveLength(1); expect(count(session, 'POST', `/operations/${id}/retry`)).toHaveLength(0); expect(await activity(page, 'nb').evaluate(element => element.contains(document.activeElement))).toBe(true); expect(await operation(page.request, id)).toEqual(committed);
|
||||
await capture(page, info, { ...desktop, language: 'nb' }, 'controlled-postcommit-get-only-recovery', 'Initial operations GET503; actual15s poll held with an actual queued snapshot; actual cancel POST200; follow-up operations GET503. Old queued response is released after cancellation. Recovery is GET-only and actual persisted task remains cancelled. No provider, worker, fabricated result or uncertain delivery claim.');
|
||||
await info.attach('operations-controlled-race-receipt', { body: JSON.stringify({ queued, capturedOld, committed, operationLoads: loads, actualTaskAfter: await operation(page.request, id), operationWrites: session.requests.filter(request => request.method !== 'GET' && request.path.startsWith('/api/operations/')) }), contentType: 'application/json' });
|
||||
|
||||
@@ -89,18 +89,22 @@ async function preserved(owner: Owner, documents: Documents) {
|
||||
}
|
||||
|
||||
async function enter(page: Page, slug: string, sample: Sample = desktop) {
|
||||
await page.addInitScript(({ language, theme }) => {
|
||||
if (localStorage.getItem('uiLanguage') === null) localStorage.setItem('uiLanguage', language);
|
||||
if (localStorage.getItem('jobtracker.themeMode') === null) localStorage.setItem('jobtracker.themeMode', theme);
|
||||
}, sample);
|
||||
if (page.url() === 'about:blank') {
|
||||
await page.addInitScript(({ language, theme }) => {
|
||||
if (localStorage.getItem('uiLanguage') === null) localStorage.setItem('uiLanguage', language);
|
||||
if (localStorage.getItem('jobtracker.themeMode') === null) localStorage.setItem('jobtracker.themeMode', theme);
|
||||
}, sample);
|
||||
} else {
|
||||
await page.evaluate(({ language, theme }) => {
|
||||
localStorage.setItem('uiLanguage', language);
|
||||
localStorage.setItem('jobtracker.themeMode', theme);
|
||||
}, sample);
|
||||
// Force a new document even when the next sample uses the same shared URL.
|
||||
await page.goto('about:blank');
|
||||
}
|
||||
await page.setViewportSize({ width: sample.width, height: sample.height });
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' });
|
||||
await page.goto(`/cv/${slug}?source=phase7-public#preserved`);
|
||||
const stored = await page.evaluate(() => ({ language: localStorage.getItem('uiLanguage'), theme: localStorage.getItem('jobtracker.themeMode') }));
|
||||
if (stored.language !== sample.language || stored.theme !== sample.theme) {
|
||||
await page.evaluate(({ language, theme }) => { localStorage.setItem('uiLanguage', language); localStorage.setItem('jobtracker.themeMode', theme); }, sample);
|
||||
await page.reload();
|
||||
}
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', sample.language === 'nb' ? 'nb-NO' : 'en');
|
||||
await expect(page.locator('html')).toHaveAttribute('data-color-scheme', sample.theme);
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveCount(1);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
@@ -309,7 +310,7 @@ test('[P7-05 Reminders] held single PATCH locks every row action and failed expl
|
||||
expect(await history(page.request, row.id)).toEqual([]); await capture(page, info, desktop, 'captured-patch-failure');
|
||||
await page.clock.setFixedTime(new Date('2026-10-13T23:30:00-08:00'));
|
||||
await keyboard(page, region(page).getByRole('button', { name: translations.en.retry, exact: true })); await expect.poll(() => attempts).toBe(2);
|
||||
await expect(region(page)).toBeFocused(); const external = page.locator('header').getByRole('button', { name: 'Norsk bokmål', exact: true });
|
||||
await expect(region(page)).toBeFocused(); const external = page.locator('header').getByRole('button', { name: translations.en.user, exact: true });
|
||||
await external.focus(); await expect(external).toBeFocused(); second.release();
|
||||
await expect(snooze(page, row, 3)).toBeEnabled(); await expect(region(page).getByRole('alert')).toHaveCount(0); await expect(external).toBeFocused();
|
||||
expect(requests(session, 'PATCH', `/api/jobapplications/${row.id}/followup`).map(request => request.body)).toEqual([{ followUpAt: '2026-10-16' }, { followUpAt: '2026-10-16' }]);
|
||||
@@ -348,7 +349,7 @@ test('[P7-05 Reminders] live EN/Bokmal translates status/date controls and gener
|
||||
await expect.poll(() => requests(session, 'GET', '/api/jobapplications/reminders').length).toBeGreaterThanOrEqual(2);
|
||||
const baseline = requests(session, 'GET', '/api/jobapplications/reminders').length;
|
||||
const preference = response(page, 'PUT', `${apiUrl}/auth/preferences/language`);
|
||||
await keyboard(page, page.locator('header').getByRole('button', { name: 'Norsk bokmål', exact: true })); expect((await preference).status()).toBe(204);
|
||||
await changeShellLanguage(page, 'nb'); expect((await preference).status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO'); await expect(region(page, 'nb').getByRole('article')).toHaveCount(4);
|
||||
for (const row of rows) await expect(article(page, row.jobTitle)).toContainText(fixtureReason(row, 'nb'));
|
||||
await expect(article(page, rows[1].jobTitle).getByText(translations.nb.statusInterview, { exact: true })).toBeVisible();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeShellLanguage } from './helpers/shellLanguage';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
@@ -214,7 +215,7 @@ test('[P7-09 S03] a held actual notification acknowledgement preserves newer edi
|
||||
try {
|
||||
const checkbox = notificationCheckbox(page); await expect(checkbox).toBeChecked(); await toggle(checkbox); const saved = response(page, 'PUT', '/notification-settings'); await keyboard(page.getByRole('main').getByRole('button', { name: copy('settingsNotificationsSave'), exact: true })); await page.keyboard.press('Enter'); await expect.poll(() => acknowledged).toBe(true); expect(writes).toBe(1); await expect(page.getByRole('main').getByRole('button', { name: copy('settingsSaving'), exact: true })).toBeDisabled();
|
||||
await toggle(checkbox); await choose(page, copy('settingsTabFollowUps')); await expect(rule).toHaveValue('5'); await choose(page, copy('settingsTabNotifications')); await expect(checkbox).toBeChecked();
|
||||
const language = response(page, 'PUT', '/auth/preferences/language'); await keyboard(page.locator('header').getByRole('button', { name: 'Norsk', exact: true })); expect((await language).status()).toBe(204); await expect(notificationCheckbox(page, 'nb')).toBeChecked(); expect(writes).toBe(1);
|
||||
const language = response(page, 'PUT', '/auth/preferences/language'); await changeShellLanguage(page, 'nb'); expect((await language).status()).toBe(204); await expect(notificationCheckbox(page, 'nb')).toBeChecked(); expect(writes).toBe(1);
|
||||
gate.release(); expect((await saved).status()).toBe(200); await expect(notificationGroup(page, 'nb').getByRole('status')).toContainText(copy('assetsUnsavedChanges', 'nb')); await expect(notificationCheckbox(page, 'nb')).toBeChecked(); expect(await persistedNotifications(session, page.request)).toEqual({ emailFollowUpRemindersEnabled: false }); expect(browserRequests(session, '/rules', 'PUT')).toHaveLength(0);
|
||||
await capture(page, info, 'held-notification-newer-draft-nb-390'); await keyboard(notificationGroup(page, 'nb').getByRole('button', { name: copy('assetsDiscardChanges', 'nb'), exact: true })); await expect(notificationCheckbox(page, 'nb')).not.toBeChecked(); await expect(notificationGroup(page, 'nb').getByRole('status')).toHaveCount(0);
|
||||
await choose(page, copy('settingsTabFollowUps', 'nb'), 'nb'); const translatedRule = page.getByRole('spinbutton', { name: copy('rulesAppliedFollowUpDays', 'nb'), exact: true }); await expect(translatedRule).toHaveValue('5'); await keyboard(page.getByRole('main').getByRole('button', { name: copy('assetsDiscardChanges', 'nb'), exact: true })); await expect(translatedRule).toHaveValue('14'); expect(await json(await call(session.requests, page.request, 'GET', '/rules'))).toEqual(rules); expect(writes).toBe(1);
|
||||
|
||||
@@ -6,7 +6,8 @@ import type { DashboardLayout } from '../src/dashboardLayout';
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const layoutUrl = `${apiUrl}/auth/preferences/dashboard`;
|
||||
const password = 'E2ePassword123!';
|
||||
const ids = ['cards', 'attention', 'funnel', 'activity', 'stageAge', 'sources', 'salary', 'companies', 'skills'];
|
||||
const ids = ['attention', 'agenda', 'funnel', 'cards', 'activity', 'stageAge', 'sources', 'salary', 'companies', 'skills'];
|
||||
const pipelineMovedEarlier = ['attention', 'funnel', 'agenda', 'cards', 'activity', 'stageAge', 'sources', 'salary', 'companies', 'skills'];
|
||||
type Account = { email: string; headers: Record<string, string> };
|
||||
async function login(api: APIRequestContext, email: string) {
|
||||
expect((await api.post(`${apiUrl}/auth/login`, { data: { email, password } })).status()).toBe(200);
|
||||
@@ -32,7 +33,8 @@ async function options(page: Page, id: string) {
|
||||
async function openEditor(page: Page) {
|
||||
await page.getByRole('button', { name: 'Customize dashboard', exact: true }).click();
|
||||
await editor(page).locator('summary').click();
|
||||
await expect(editor(page).getByRole('checkbox')).toHaveCount(9);
|
||||
await expect(editor(page).getByRole('checkbox')).toHaveCount(ids.length);
|
||||
await expect(editor(page).getByRole('checkbox', { name: translations.en.dashboardYourWeek, exact: true })).toBeVisible();
|
||||
}
|
||||
async function save(page: Page) {
|
||||
const response = page.waitForResponse(response => response.url() === layoutUrl && response.request().method() === 'PUT');
|
||||
@@ -90,7 +92,7 @@ test('[P8] Saved order, size and visibility survive HTTP readback, a fresh brows
|
||||
await save(page);
|
||||
const saved = await readLayout(page.request);
|
||||
expect(saved.version).toBe(2); expect(saved.revision).toBe(1);
|
||||
expect(saved.widgets.map(widget => widget.id)).toEqual(['cards', 'funnel', 'attention', 'activity', 'stageAge', 'sources', 'salary', 'companies', 'skills']);
|
||||
expect(saved.widgets.map(widget => widget.id)).toEqual(pipelineMovedEarlier);
|
||||
expect(saved.widgets.find(widget => widget.id === 'funnel')).toMatchObject({ id: 'funnel', visible: true, size: 'full', w: 12 });
|
||||
expect(saved.widgets.find(widget => widget.id === 'activity')?.visible).toBe(false);
|
||||
const assertSaved = async (target: Page) => {
|
||||
@@ -256,7 +258,7 @@ test('[P8] Anonymous requests fail, ordinary accounts stay independent and admin
|
||||
} finally { await anonymous.dispose(); await administrator.dispose(); await other.dispose(); }
|
||||
});
|
||||
|
||||
test('[P8] Five legacy hidden flags migrate only on explicit save; all nine hidden have recovery', async ({ page, account }, info) => {
|
||||
test('[P8] Five legacy hidden flags migrate only on explicit save; hiding every widget has recovery', async ({ page, account }, info) => {
|
||||
void account;
|
||||
expect(await readLayout(page.request)).toEqual({ version: 1, revision: 0, widgets: [] });
|
||||
await page.evaluate(() => {
|
||||
@@ -268,7 +270,7 @@ test('[P8] Five legacy hidden flags migrate only on explicit save; all nine hidd
|
||||
for (const name of ['Summary cards', 'Application activity', 'Current pipeline', 'Top companies by activity', 'Job tags']) await expect(editor(page).getByRole('checkbox', { name, exact: true })).not.toBeChecked();
|
||||
expect(await readLayout(page.request)).toEqual({ version: 1, revision: 0, widgets: [] });
|
||||
await save(page);
|
||||
expect((await readLayout(page.request)).widgets.filter(widget => !widget.visible).map(widget => widget.id)).toEqual(['cards', 'funnel', 'activity', 'companies', 'skills']);
|
||||
expect((await readLayout(page.request)).widgets.filter(widget => !widget.visible).map(widget => widget.id)).toEqual(['funnel', 'cards', 'activity', 'companies', 'skills']);
|
||||
await page.evaluate(() => { for (const key of Object.keys(localStorage)) if (key.startsWith('dashboardPrefs:')) localStorage.removeItem(key); });
|
||||
await page.reload(); await openEditor(page);
|
||||
await expect(editor(page).getByRole('checkbox', { name: 'Summary cards', exact: true })).not.toBeChecked();
|
||||
@@ -277,7 +279,7 @@ test('[P8] Five legacy hidden flags migrate only on explicit save; all nine hidd
|
||||
await expect(page.getByText('Your dashboard sections are hidden.', { exact: true })).toBeVisible();
|
||||
await expect(page.locator('[data-dashboard-widget]')).toHaveCount(0);
|
||||
expect((await readLayout(page.request)).widgets.every(widget => !widget.visible)).toBe(true);
|
||||
await capture(page, info, 'all-nine-hidden');
|
||||
await capture(page, info, 'all-widgets-hidden');
|
||||
await openEditor(page); await editor(page).getByRole('checkbox', { name: 'Current pipeline', exact: true }).check(); await save(page);
|
||||
await expect(page.locator('[data-dashboard-widget="funnel"]')).toBeVisible();
|
||||
await expect(page.getByText('Your dashboard sections are hidden.', { exact: true })).toHaveCount(0);
|
||||
@@ -294,7 +296,8 @@ test('[P8] Editor reflows across EN/NB themes and desktop/tablet/mobile with nat
|
||||
const panel = page.getByRole('region', { name: t.dashboardEditing, exact: true });
|
||||
await panel.locator('summary').click();
|
||||
await expect(panel.getByRole('group', { name: t.dashboardManageWidgets })).toBeVisible();
|
||||
await expect(panel.getByRole('checkbox')).toHaveCount(9);
|
||||
await expect(panel.getByRole('checkbox')).toHaveCount(ids.length);
|
||||
await expect(panel.getByRole('checkbox', { name: t.dashboardYourWeek, exact: true })).toBeVisible();
|
||||
const widgets = page.getByRole('region', { name: t.dashboardPreview, exact: true });
|
||||
await widgets.locator('[data-dashboard-widget="cards"] summary').click();
|
||||
await expect(widgets.getByRole('combobox', { name: t.dashboardSizeFor.replace('{name}', t.dashboardSummaryCards) })).toBeDisabled();
|
||||
@@ -322,8 +325,8 @@ test('[P8] Keyboard move focus/live status, pointer drag and emulated touch butt
|
||||
const earlier = preview(page).getByRole('button', { name: 'Move Current pipeline earlier', exact: true });
|
||||
await earlier.focus(); await page.keyboard.press('Enter');
|
||||
await expect(earlier).toBeFocused();
|
||||
await expect(page.getByRole('status').filter({ hasText: 'Current pipeline moved to position 2 of 9.' })).toBeVisible();
|
||||
await expect.poll(() => preview(page).locator('[data-dashboard-widget]').evaluateAll(nodes => nodes.map(node => node.getAttribute('data-dashboard-widget')))).toEqual(['cards', 'funnel', 'attention', 'activity', 'stageAge', 'sources', 'salary', 'companies', 'skills']);
|
||||
await expect(page.getByRole('status').filter({ hasText: `Current pipeline moved to position 2 of ${ids.length}.` })).toBeVisible();
|
||||
await expect.poll(() => preview(page).locator('[data-dashboard-widget]').evaluateAll(nodes => nodes.map(node => node.getAttribute('data-dashboard-widget')))).toEqual(pipelineMovedEarlier);
|
||||
const widget = page.locator('[data-dashboard-widget="funnel"]');
|
||||
await widget.locator('summary').first().click();
|
||||
const handle = widget.locator('.dashboard-grid-handle');
|
||||
@@ -360,7 +363,7 @@ test('[P8] Keyboard move focus/live status, pointer drag and emulated touch butt
|
||||
expect(await readLayout(touch.request)).toEqual(saved);
|
||||
await options(mobile, 'funnel');
|
||||
await preview(mobile).getByRole('button', { name: 'Move Current pipeline later', exact: true }).tap();
|
||||
await expect(mobile.getByRole('status').filter({ hasText: `Current pipeline moved to position ${movedIndex + 2} of 9.` })).toBeVisible();
|
||||
await expect(mobile.getByRole('status').filter({ hasText: `Current pipeline moved to position ${movedIndex + 2} of ${ids.length}.` })).toBeVisible();
|
||||
await save(mobile);
|
||||
expect((await readLayout(touch.request)).widgets.map(widget => widget.id)).toEqual(expectedOrder);
|
||||
await capture(mobile, info, 'emulated-touch-button-order');
|
||||
|
||||
@@ -2,6 +2,7 @@ import { expect, test, type APIRequestContext, type Page } from '@playwright/tes
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { emptyStructuredCv } from '../src/profileCv';
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { openCvStudioSection } from './helpers/cvStudioNavigation';
|
||||
|
||||
const api = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -81,12 +82,12 @@ test(`[PRE-P10 A] ${language} blank CV survives rename, reload, template apply a
|
||||
await expect(page.getByLabel(t.cvEditorName, { exact: true })).toHaveValue('Saved empty CV');
|
||||
await expect(page.getByRole('checkbox', { name: t.cvEditorIncludeProfileContact, exact: true })).not.toBeChecked();
|
||||
await assertBlank();
|
||||
await page.getByRole('tab', { name: t.cvEditorTemplate, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorTemplate);
|
||||
await page.getByRole('button', { name: t.cvTemplateMinimalName, exact: true }).click();
|
||||
await page.getByRole('button', { name: t.cvEditorApplyTemplate, exact: true }).click();
|
||||
await expect.poll(async () => (await read()).settings.themeId).toBe('minimal');
|
||||
await assertBlank();
|
||||
await page.getByRole('tab', { name: t.cvEditorContent, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorContent);
|
||||
const editorAxe = await new AxeBuilder({ page }).include('#cv-studio-panel-1').withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']).analyze();
|
||||
await info.attach('blank-content-axe', { body: JSON.stringify({ violations: editorAxe.violations, incomplete: editorAxe.incomplete }), contentType: 'application/json' });
|
||||
expect(editorAxe.violations).toEqual([]);
|
||||
|
||||
@@ -5,19 +5,33 @@ import { createHash } from 'node:crypto';
|
||||
import { templateFixtures, templateProfile } from './pre-p10-template-fixtures';
|
||||
|
||||
const api = 'http://localhost:5302/api';
|
||||
const baseline = path.resolve('../.artifacts/pre-phase10-ux/templates-legacy');
|
||||
const baseline = path.resolve('e2e/fixtures/pre-p10-template-legacy');
|
||||
const output = path.resolve(process.env.CV_TEMPLATE_OUTPUT || '../.artifacts/pre-phase10-ux/templates-revised-01');
|
||||
const hash = (text: string) => createHash('sha256').update(text).digest('hex');
|
||||
// The existing avatar endpoint now normalizes image pixels with Skia. Retain font data
|
||||
// verbatim; exclude only embedded image payload bytes when comparing document markup.
|
||||
const normalizeAvatar = (html: string) => html.replace(/data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/=]+/g, 'data:image/normalized-avatar');
|
||||
|
||||
type OriginalFixture = {
|
||||
rawOriginalHash: string;
|
||||
normalizedOriginalHash: string;
|
||||
originalCssHash: string;
|
||||
originalBodyHash: string;
|
||||
originalMarkers: string[] | null;
|
||||
};
|
||||
|
||||
test('[PRE-P10 B] existing design-one markup, CSS and source markers survive design-two additions', async ({ request }, info) => {
|
||||
test.setTimeout(180_000);
|
||||
expect((await request.post(`${api}/auth/login`, { data: { email: 'e2e@example.test', password: 'E2ePassword123!' } })).status()).toBe(200);
|
||||
const me = await (await request.get(`${api}/auth/me`)).json();
|
||||
const headers = { 'X-CSRF-TOKEN': (await request.storageState()).cookies.find(cookie => cookie.name === 'XSRF-TOKEN')!.value, 'X-Session-Context': me.sessionContext as string };
|
||||
const avatar = await fs.readFile(path.join(baseline, 'synthetic-nonhuman-color-sample.png'));
|
||||
const expected = JSON.parse(await fs.readFile(path.join(baseline, 'expected.json'), 'utf8')) as {
|
||||
avatarSha256: string;
|
||||
fixtures: Record<string, OriginalFixture>;
|
||||
};
|
||||
expect(Object.keys(expected.fixtures)).toHaveLength(36);
|
||||
expect(createHash('sha256').update(avatar).digest('hex')).toBe(expected.avatarSha256);
|
||||
expect((await request.post(`${api}/auth/avatar`, { headers, multipart: { file: { name: 'synthetic-nonhuman.png', mimeType: 'image/png', buffer: avatar } } })).status()).toBe(200);
|
||||
const themes = await (await request.get(`${api}/cv/themes`)).json();
|
||||
const results = [];
|
||||
@@ -34,16 +48,16 @@ test('[PRE-P10 B] existing design-one markup, CSS and source markers survive des
|
||||
const response = await request.get(`${api}/cv/variants/${variant.id}/preview`);
|
||||
expect(response.status(), fixture).toBe(200);
|
||||
const current = (await response.json()).html as string;
|
||||
const original = await fs.readFile(path.join(baseline, fixture, 'render.html'), 'utf8');
|
||||
const original = expected.fixtures[fixture];
|
||||
if (!original) throw new Error(`No historical preservation fixture for ${fixture}`);
|
||||
const style = (html: string) => html.match(/<style>([\s\S]*?)<\/style>/)![1];
|
||||
const body = (html: string) => html.match(/<body>([\s\S]*?)<\/body>/)![1];
|
||||
const originalMarkers = body(original).match(/\b[SEBPR]\d{2}\b/g);
|
||||
const currentMarkers = body(current).match(/\b[SEBPR]\d{2}\b/g);
|
||||
const measured = { fixture, rawOriginalHash: hash(original), rawCurrentHash: hash(current),
|
||||
normalizedOriginalHash: hash(normalizeAvatar(original)), normalizedCurrentHash: hash(normalizeAvatar(current)),
|
||||
originalCssHash: hash(style(original)), currentCssHash: hash(style(current)),
|
||||
originalBodyHash: hash(normalizeAvatar(body(original))), currentBodyHash: hash(normalizeAvatar(body(current))),
|
||||
markersEqual: JSON.stringify(currentMarkers) === JSON.stringify(originalMarkers) };
|
||||
const measured = { fixture, rawOriginalHash: original.rawOriginalHash, rawCurrentHash: hash(current),
|
||||
normalizedOriginalHash: original.normalizedOriginalHash, normalizedCurrentHash: hash(normalizeAvatar(current)),
|
||||
originalCssHash: original.originalCssHash, currentCssHash: hash(style(current)),
|
||||
originalBodyHash: original.originalBodyHash, currentBodyHash: hash(normalizeAvatar(body(current))),
|
||||
markersEqual: JSON.stringify(currentMarkers) === JSON.stringify(original.originalMarkers) };
|
||||
results.push(measured);
|
||||
await fs.writeFile(path.join(output, 'legacy-current', `${fixture}.html`), current);
|
||||
await fs.writeFile(path.join(output, 'legacy-preservation.json'), JSON.stringify({
|
||||
@@ -55,5 +69,6 @@ test('[PRE-P10 B] existing design-one markup, CSS and source markers survive des
|
||||
}
|
||||
}
|
||||
expect(results).toHaveLength(36);
|
||||
expect(new Set(results.map(result => result.fixture))).toEqual(new Set(Object.keys(expected.fixtures)));
|
||||
await info.attach('legacy-preservation', { path: path.join(output, 'legacy-preservation.json'), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect, test, type APIRequestContext, type Page } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { emptyStructuredCv } from '../src/profileCv';
|
||||
import { openCvStudioSection } from './helpers/cvStudioNavigation';
|
||||
|
||||
const api = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -63,7 +64,7 @@ for (const language of ['en', 'nb'] as const) {
|
||||
page.on('response', response => { if (/\/cv\/themes\/[^/]+\/preview$/.test(new URL(response.url()).pathname)) requests.push({ path: new URL(response.url()).pathname, status: response.status() }); });
|
||||
page.on('request', request => { if (request.url() === cvUrl && request.method() === 'PUT') writes++; });
|
||||
await page.goto(`/career/builder/${cv.id}`);
|
||||
await page.getByRole('tab', { name: t.cvEditorTemplate, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorTemplate);
|
||||
await page.getByRole('button', { name: t.cvEditorAllTemplates, exact: true }).click();
|
||||
for (const [id, key] of Object.entries(themeNames)) {
|
||||
const card = page.getByRole('button', { name: t[key], exact: true });
|
||||
@@ -179,7 +180,7 @@ for (const language of ['en', 'nb'] as const) {
|
||||
try { fixture = await owner(page, admin, language); } finally { await admin.dispose(); }
|
||||
const cv = await createCv(page, fixture.headers, true);
|
||||
await page.goto(`/career/builder/${cv.id}`);
|
||||
await page.getByRole('tab', { name: t.cvEditorCustomize, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize);
|
||||
await page.getByRole('link', { name: t.cvEditorManagePhoto, exact: true }).click();
|
||||
await expect(page).toHaveURL(/\/career\?section=profile$/);
|
||||
await expect(page.getByRole('button', { name: t.profileChangeImage, exact: true })).toBeEnabled();
|
||||
@@ -216,7 +217,7 @@ for (const language of ['en', 'nb'] as const) {
|
||||
const live = page.frameLocator(`iframe[title="${t.cvEditorPreviewPage.replace('{page}', '1')}"]`);
|
||||
await expect(live.locator('.photo img')).toBeVisible();
|
||||
if (language === 'nb') await page.getByRole('button', { name: t.cvEditorEdit, exact: true }).click();
|
||||
await page.getByRole('tab', { name: t.cvEditorCustomize, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorCustomize);
|
||||
await page.getByRole('switch', { name: t.cvEditorShowPhoto, exact: true }).uncheck();
|
||||
await expect.poll(async () => (await (await page.request.get(`${api}/cv/variants/${cv.id}`)).json()).settings.showPhoto).toBe(false);
|
||||
if (language === 'nb') await page.getByRole('button', { name: t.cvEditorPreview, exact: true }).click();
|
||||
|
||||
Generated
+14
-14
@@ -30,7 +30,7 @@
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-grid-layout": "2.3.0",
|
||||
"react-router-dom": "^7.18.2",
|
||||
"react-router-dom": "^7.18.5",
|
||||
"typescript": "^5.9.3",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
@@ -6285,9 +6285,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.1.2.tgz",
|
||||
"integrity": "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -11055,9 +11055,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-router": {
|
||||
"version": "7.18.2",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.2.tgz",
|
||||
"integrity": "sha512-aUVMjFm3GAPTTZL7oYr5E7ETiqfQCHRLH+B+5afnICvf0r7kkK4eR6SMuwbSTJw/7t+12khT/Kahij49fqOCIg==",
|
||||
"version": "7.18.5",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.5.tgz",
|
||||
"integrity": "sha512-dTgvcXDOrLPrlLHrcZAqWveiK1hMSqN+rGAJzegP8HtmNkfRxOoshGWBNX3ZJ0cZjOHkRdlUJtaIhZMLLyGyPw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cookie": "^1.0.1",
|
||||
@@ -11077,12 +11077,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-router-dom": {
|
||||
"version": "7.18.2",
|
||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.2.tgz",
|
||||
"integrity": "sha512-AIKJ/jgGlFb3EbfCXk5Gzshiwt+l3mqbCrNjmEWMMjqQxNJ3svBa6bgzFyCC2Sw3RA0VWF1kg3uQf2OFhxb8hw==",
|
||||
"version": "7.18.5",
|
||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.5.tgz",
|
||||
"integrity": "sha512-9HcfDMU6JJ/fp6gJZYGwNE6RknVGS4kBjH1HkNw959mCJi70TVwdipQWv2FEol9uGpi+SZTFtVpJPtEQfayeOw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-router": "7.18.2"
|
||||
"react-router": "7.18.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
@@ -12749,9 +12749,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.21.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.1.tgz",
|
||||
"integrity": "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==",
|
||||
"version": "8.23.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.23.1.tgz",
|
||||
"integrity": "sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-grid-layout": "2.3.0",
|
||||
"react-router-dom": "^7.18.2",
|
||||
"react-router-dom": "^7.18.5",
|
||||
"typescript": "^5.9.3",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
|
||||
@@ -850,14 +850,14 @@ function CoverLetterAiAssistant({ jobId, currentText, disabled, onApply, toolbar
|
||||
{t("coverAiUsing", { name: cv?.attachedVariantName ?? "" })}
|
||||
</Alert>
|
||||
)}
|
||||
<Stack direction={{ xs: "column", sm: "row" }} spacing={1.5}>
|
||||
<FormControl size="small" sx={{ minWidth: 180 }}>
|
||||
<Stack direction={{ xs: "column", sm: "row" }} spacing={1.5} useFlexGap flexWrap="wrap">
|
||||
<FormControl size="small" sx={{ minWidth: "min(100%, 180px)" }}>
|
||||
<InputLabel id={`${labelId}-coverAiAction`}>{t("coverAiAction")}</InputLabel>
|
||||
<Select disabled={busy || disabled || loadingCv} labelId={`${labelId}-coverAiAction`} label={t("coverAiAction")} value={action} onChange={(event) => setAction(event.target.value)}>
|
||||
{COVER_LETTER_ACTIONS.map((item) => <MenuItem key={item.key} value={item.key}>{t(item.labelKey)}</MenuItem>)}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<FormControl size="small" sx={{ minWidth: 160 }}>
|
||||
<FormControl size="small" sx={{ minWidth: "min(100%, 160px)" }}>
|
||||
<InputLabel id={`${labelId}-coverAiTone`}>{t("coverAiTone")}</InputLabel>
|
||||
<Select disabled={busy || disabled || loadingCv} labelId={`${labelId}-coverAiTone`} label={t("coverAiTone")} value={mode} onChange={(event) => setMode(event.target.value)}>
|
||||
{[
|
||||
@@ -866,7 +866,7 @@ function CoverLetterAiAssistant({ jobId, currentText, disabled, onApply, toolbar
|
||||
].map(([value, key]) => <MenuItem key={value} value={value}>{t(key as any)}</MenuItem>)}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<FormControl size="small" sx={{ minWidth: 190 }}>
|
||||
<FormControl size="small" sx={{ minWidth: "min(100%, 190px)" }}>
|
||||
<InputLabel id={`${labelId}-coverAiDocumentLanguage`}>{t("coverAiDocumentLanguage")}</InputLabel>
|
||||
<Select disabled={busy || disabled || loadingCv} labelId={`${labelId}-coverAiDocumentLanguage`} label={t("coverAiDocumentLanguage")} value={language} onChange={(event) => { const next = event.target.value as "en" | "nb-NO"; setLanguage(next); onDocumentLanguageChange?.(next); }}>
|
||||
<MenuItem value="en">{t("languageEnglish")}</MenuItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { Alert, Box, Button, IconButton, LinearProgress, Typography } from "@mui/material";
|
||||
@@ -61,6 +61,14 @@ export default function OnboardingChecklist({ hasJobs }: { hasJobs: boolean | nu
|
||||
const [loadError, setLoadError] = useState<{ cause: unknown } | null>(null);
|
||||
const [readAttempt, setReadAttempt] = useState(0);
|
||||
const dismissRef = useRef<HTMLButtonElement>(null);
|
||||
const setDismissButton = useCallback((button: HTMLButtonElement | null) => {
|
||||
if (!button && dismissRef.current === document.activeElement) {
|
||||
requestAnimationFrame(() => {
|
||||
if (document.activeElement === document.body) guideEntry.current?.focus();
|
||||
});
|
||||
}
|
||||
dismissRef.current = button;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (guideStep !== null) guideTitle.current?.focus();
|
||||
@@ -153,7 +161,7 @@ export default function OnboardingChecklist({ hasJobs }: { hasJobs: boolean | nu
|
||||
return (
|
||||
<PageSection surface title={t("onboardingTitle")} description={t("onboardingBody")} actions={
|
||||
<IconButton
|
||||
ref={dismissRef}
|
||||
ref={setDismissButton}
|
||||
size="small"
|
||||
aria-label={t("onboardingDismiss")}
|
||||
onClick={() => {
|
||||
|
||||
@@ -176,7 +176,8 @@ export default function QuickCommandDialog({ open, onClose, onNavigate, onOpenAd
|
||||
<Typography component="h2" variant="caption" color="text.secondary" sx={{ px: 2, fontWeight: 700 }}>{group.label}</Typography>
|
||||
<List dense aria-label={group.label}>
|
||||
{group.items.map((item) => <ListItem key={item.id} disablePadding>
|
||||
<ListItemButton ref={(node) => { resultRefs.current[allItems.indexOf(item)] = node; }} selected={activeIndex === allItems.indexOf(item)} onFocus={() => setActiveIndex(allItems.indexOf(item))} onClick={() => activate(item)} sx={{ borderRadius: 2 }}>
|
||||
<ListItemButton ref={(node) => { resultRefs.current[allItems.indexOf(item)] = node; }} selected={activeIndex === allItems.indexOf(item)} onFocus={() => setActiveIndex(allItems.indexOf(item))} onClick={() => activate(item)}
|
||||
sx={{ borderRadius: 2, "&.Mui-selected .MuiListItemText-secondary": { color: "text.primary" } }}>
|
||||
<ListItemText primary={item.label} secondary={item.hint} />
|
||||
</ListItemButton>
|
||||
</ListItem>)}
|
||||
|
||||
@@ -260,7 +260,7 @@ export default function SettingsView({
|
||||
|
||||
return (
|
||||
<Box sx={{ minWidth: 0 }}>
|
||||
<FormControl fullWidth sx={{ display: { xs: "flex", sm: "none" }, mb: 1 }}>
|
||||
<FormControl fullWidth sx={{ display: { xs: "flex", md: "none" }, mb: 1 }}>
|
||||
<InputLabel id="settings-section-label">{t("settingsNavigation")}</InputLabel>
|
||||
<Select
|
||||
labelId="settings-section-label"
|
||||
@@ -276,7 +276,7 @@ export default function SettingsView({
|
||||
</Select>
|
||||
</FormControl>
|
||||
|
||||
<Tabs aria-label={t("settings")} value={tab} onChange={(_, v) => selectSection(v)} variant="scrollable" scrollButtons="auto" sx={{ display: { xs: "none", sm: "flex" }, mb: 1 }}>
|
||||
<Tabs aria-label={t("settings")} value={tab} onChange={(_, v) => selectSection(v)} variant="scrollable" scrollButtons="auto" sx={{ display: { xs: "none", md: "flex" }, mb: 1 }}>
|
||||
<Tab value={0} id="settings-tab-0" aria-controls="settings-panel-0" label={t("settingsTabGeneral")} />
|
||||
<Tab value={4} id="settings-tab-4" aria-controls="settings-panel-4" label={t("settingsTabAutomation")} />
|
||||
<Tab value={1} id="settings-tab-1" aria-controls="settings-panel-1" label={t("settingsTabFollowUps")} />
|
||||
|
||||
@@ -668,7 +668,9 @@ export default function CvBuilderEditor() {
|
||||
<Box ref={editorRef} tabIndex={-1} role="region" aria-label={t("cvEditorEditingRegion")} onFocusCapture={() => setMobilePane("edit")} sx={{ display: compactEditor && mobilePane !== "edit" ? "none" : "block", top: "var(--cv-pane-top)", minWidth: 0, "@media (min-width:1001px)": { position: "sticky", maxHeight: "calc(100dvh - var(--cv-pane-top) - 12px)", overflowY: "auto" }, scrollbarWidth: "thin" }}>
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center" gap={1} sx={{ py: 0.5, borderBottom: "1px solid", borderColor: "divider" }}>
|
||||
<Typography component="h2" variant="subtitle2" sx={compactStudioNavigation ? visuallyHidden : undefined}>{t("cvEditorEditingRegion")}</Typography>
|
||||
{compactStudioNavigation && <TextField select size="small" variant="standard" label={t("cvEditorStudioNavigation")} value={tab} sx={{ flex: 1, minWidth: 0 }} onChange={(event) => { const value = Number(event.target.value); setTab(value); if (value === 4) loadVersions(); }}>
|
||||
{compactStudioNavigation && <TextField select size="small" variant="standard" label={t("cvEditorStudioNavigation")} value={tab} sx={{ flex: 1, minWidth: 0 }}
|
||||
slotProps={{ select: { SelectDisplayProps: { style: { minHeight: 44, boxSizing: "border-box", display: "flex", alignItems: "center" } } } }}
|
||||
onChange={(event) => { const value = Number(event.target.value); setTab(value); if (value === 4) loadVersions(); }}>
|
||||
{[1, 0, 2, 3, 4].map((value) => <MenuItem key={value} value={value}>{t((["cvEditorTemplate", "cvEditorContent", "cvEditorCustomize", "cvEditorAiTools", "cvEditorHistory"] as const)[value])}</MenuItem>)}
|
||||
</TextField>}
|
||||
<Stack direction="row">
|
||||
|
||||
Reference in New Issue
Block a user