Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 86d2305e64 |
@@ -1,47 +0,0 @@
|
||||
using JobTrackerApi.Controllers;
|
||||
using JobTrackerApi.Models;
|
||||
using JobTrackerApi.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Xunit;
|
||||
|
||||
namespace JobTrackerApi.MariaDb.Tests;
|
||||
|
||||
public sealed class RulesPauseMigrationTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Existing_thresholds_survive_pause_migration_and_numeric_writes_preserve_pause()
|
||||
{
|
||||
const string owner = "existing-rules-owner";
|
||||
const string previous = "20261028090000_AddUserOperationEvents";
|
||||
await using var database = await MariaDbDatabase.CreateAsync();
|
||||
await using var db = database.Context(owner);
|
||||
var migrator = db.GetService<IMigrator>();
|
||||
await migrator.MigrateAsync(previous);
|
||||
await db.Database.ExecuteSqlInterpolatedAsync($"""
|
||||
INSERT INTO UserRuleSettings
|
||||
(OwnerUserId, AppliedFollowUpDays, AppliedGhostDays, OfferFollowUpDays, OfferGhostDays, FeedbackFollowUpDays, FeedbackGhostDays)
|
||||
VALUES ({owner}, 9, 31, 7, 14, 7, 14)
|
||||
""");
|
||||
await migrator.MigrateAsync();
|
||||
var initial = await RulesEngine.GetSettings(db, default);
|
||||
Assert.Equal(31, initial.AppliedGhostDays);
|
||||
Assert.Equal(false, initial.AutomaticGhostingPaused);
|
||||
|
||||
var controller = new RulesController(db);
|
||||
Assert.IsType<NoContentResult>(await controller.Update(
|
||||
new RuleSettings { AppliedGhostDays = 31, AutomaticGhostingPaused = true }, default));
|
||||
Assert.IsType<NoContentResult>(await controller.Update(new RuleSettings { AppliedGhostDays = 32 }, default));
|
||||
var committed = await RulesEngine.GetSettings(db, default);
|
||||
Assert.Equal(true, committed.AutomaticGhostingPaused);
|
||||
Assert.Equal(32, committed.AppliedGhostDays);
|
||||
|
||||
await migrator.MigrateAsync(previous);
|
||||
var threshold = await db.Database.SqlQuery<int>($"""
|
||||
SELECT AppliedGhostDays AS Value FROM UserRuleSettings WHERE OwnerUserId = {owner}
|
||||
""").ToListAsync();
|
||||
Assert.Equal(32, Assert.Single(threshold));
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public sealed class StartupAndLockTests(ITestOutputHelper output)
|
||||
db.Add(job);
|
||||
await db.SaveChangesAsync();
|
||||
var migrations = (await db.Database.GetAppliedMigrationsAsync()).ToArray();
|
||||
Assert.Equal(db.Database.GetMigrations(), migrations);
|
||||
Assert.Equal("20261028090000_AddUserOperationEvents", migrations[^1]);
|
||||
// Only this test's newly-created schema is downgraded; no existing database is selected.
|
||||
const string beforeRd21 = "20261021090000_AddDashboardLayoutPreference";
|
||||
await db.GetService<IMigrator>().MigrateAsync(beforeRd21);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text.Json;
|
||||
using JobTrackerApi.Controllers;
|
||||
using JobTrackerApi.Data;
|
||||
using JobTrackerApi.Models;
|
||||
using JobTrackerApi.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@@ -81,39 +79,6 @@ public sealed class BackgroundWorkerTenantTests
|
||||
Assert.Equal("Applied", jobs[1].Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Paused_owner_keeps_applied_jobs_while_other_owner_runs_and_resume_takes_effect_next_run()
|
||||
{
|
||||
await using var fixture = await Fixture.CreateAsync(new Dictionary<string, string?> { ["Workers:RulesEnabled"] = "true" });
|
||||
await fixture.SeedJobsAsync();
|
||||
var worker = new RulesHostedService(fixture.Runner, fixture.Configuration, NullLogger<RulesHostedService>.Instance,
|
||||
Mock.Of<IStartupReadiness>(), new MutableTimeProvider(FixedNow));
|
||||
|
||||
await SaveOwnerRules("user-1", true);
|
||||
await SaveOwnerRules("user-2", null);
|
||||
await SaveOwnerRules("user-1", null);
|
||||
Assert.Equal(new BackgroundWorkerRunResult(true, 2, 2, 0), await worker.RunOnceAsync(default));
|
||||
await using var verification = fixture.Provider.CreateAsyncScope();
|
||||
var db = verification.ServiceProvider.GetRequiredService<JobTrackerContext>();
|
||||
Assert.Equal(new[] { "Applied", "Ghosted" }, await ReadStatuses());
|
||||
|
||||
await SaveOwnerRules("user-1", false);
|
||||
Assert.Equal(new BackgroundWorkerRunResult(true, 2, 2, 0), await worker.RunOnceAsync(default));
|
||||
Assert.Equal(new[] { "Ghosted", "Ghosted" }, await ReadStatuses());
|
||||
|
||||
async Task SaveOwnerRules(string owner, bool? paused)
|
||||
{
|
||||
await using var scope = fixture.Provider.CreateAsyncScope();
|
||||
using var user = scope.ServiceProvider.GetRequiredService<CurrentUserService>().UseBackgroundUser(owner);
|
||||
var controller = new RulesController(scope.ServiceProvider.GetRequiredService<JobTrackerContext>());
|
||||
Assert.IsType<NoContentResult>(await controller.Update(
|
||||
new RuleSettings { AppliedGhostDays = 5, AutomaticGhostingPaused = paused }, default));
|
||||
}
|
||||
|
||||
Task<string[]> ReadStatuses() => db.JobApplications.IgnoreQueryFilters().AsNoTracking()
|
||||
.OrderBy(job => job.OwnerUserId).Select(job => job.Status).ToArrayAsync();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Affected_workers_are_disabled_by_default()
|
||||
{
|
||||
|
||||
@@ -15,28 +15,6 @@ public sealed class MigrationChainTests
|
||||
{
|
||||
private const string SnapshotMigration = "20260711181039_SyncModelSnapshot";
|
||||
|
||||
[Fact]
|
||||
public async Task Automatic_ghosting_pause_upgrade_and_rollback_preserve_existing_thresholds()
|
||||
{
|
||||
await using var connection = new SqliteConnection("Data Source=:memory:");
|
||||
await connection.OpenAsync();
|
||||
await using var db = Context(connection);
|
||||
var migrator = db.GetService<IMigrator>();
|
||||
const string previous = "20261028090000_AddUserOperationEvents";
|
||||
await migrator.MigrateAsync(previous);
|
||||
await ExecuteAsync(connection, """
|
||||
INSERT INTO UserRuleSettings
|
||||
(OwnerUserId, AppliedFollowUpDays, AppliedGhostDays, OfferFollowUpDays, OfferGhostDays, FeedbackFollowUpDays, FeedbackGhostDays)
|
||||
VALUES ('existing-owner', 9, 31, 7, 14, 7, 14);
|
||||
""");
|
||||
await migrator.MigrateAsync();
|
||||
Assert.Equal(0L, await ScalarAsync<long>(connection, "SELECT AutomaticGhostingPaused FROM UserRuleSettings;"));
|
||||
await ExecuteAsync(connection, "UPDATE UserRuleSettings SET AutomaticGhostingPaused=1;");
|
||||
await migrator.MigrateAsync(previous);
|
||||
Assert.Equal(31L, await ScalarAsync<long>(connection, "SELECT AppliedGhostDays FROM UserRuleSettings;"));
|
||||
Assert.Equal(0L, await ScalarAsync<long>(connection, "SELECT COUNT(*) FROM pragma_table_info('UserRuleSettings') WHERE name='AutomaticGhostingPaused';"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Letter_document_upgrade_adds_nullable_fields_without_rewriting_old_letters_or_frozen_bytes()
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace JobTrackerApi.Controllers
|
||||
return Ok(new RuleSettings
|
||||
{
|
||||
Id = 1,
|
||||
AutomaticGhostingPaused = u.AutomaticGhostingPaused,
|
||||
AppliedFollowUpDays = u.AppliedFollowUpDays,
|
||||
AppliedGhostDays = u.AppliedGhostDays,
|
||||
OfferFollowUpDays = u.OfferFollowUpDays,
|
||||
@@ -61,8 +60,6 @@ namespace JobTrackerApi.Controllers
|
||||
{
|
||||
var s = await GetOrCreateUserSettingsAsync(_db.CurrentUserId, cancellationToken);
|
||||
|
||||
if (incoming.AutomaticGhostingPaused is bool paused)
|
||||
s.AutomaticGhostingPaused = paused;
|
||||
s.AppliedFollowUpDays = Clamp(incoming.AppliedFollowUpDays, 1, 365);
|
||||
s.AppliedGhostDays = Clamp(incoming.AppliedGhostDays, 1, 365);
|
||||
s.OfferFollowUpDays = Clamp(incoming.OfferFollowUpDays, 1, 365);
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using JobTrackerApi.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace JobTrackerApi.Migrations;
|
||||
|
||||
[DbContext(typeof(JobTrackerContext))]
|
||||
[Migration("20261204180000_AddUserAutomaticGhostingPause")]
|
||||
public sealed class AddUserAutomaticGhostingPause : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AutomaticGhostingPaused",
|
||||
table: "UserRuleSettings",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (ActiveProvider?.Contains("Sqlite", StringComparison.OrdinalIgnoreCase) == true)
|
||||
migrationBuilder.Sql("ALTER TABLE \"UserRuleSettings\" DROP COLUMN \"AutomaticGhostingPaused\";");
|
||||
else
|
||||
migrationBuilder.DropColumn("AutomaticGhostingPaused", "UserRuleSettings");
|
||||
}
|
||||
}
|
||||
@@ -2458,9 +2458,6 @@ namespace JobTrackerApi.Migrations
|
||||
b.Property<string>("OwnerUserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("AutomaticGhostingPaused")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AppliedFollowUpDays")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace JobTrackerApi.Models
|
||||
{
|
||||
// Single-row table to store workflow automation thresholds.
|
||||
@@ -8,11 +5,6 @@ namespace JobTrackerApi.Models
|
||||
{
|
||||
public int Id { get; set; } = 1;
|
||||
|
||||
// The API accepts this only as a per-user override. Older clients can omit it.
|
||||
[NotMapped]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public bool? AutomaticGhostingPaused { get; set; }
|
||||
|
||||
// Applied / no response yet
|
||||
public int AppliedFollowUpDays { get; set; } = 14;
|
||||
public int AppliedGhostDays { get; set; } = 30;
|
||||
|
||||
@@ -3,7 +3,6 @@ namespace JobTrackerApi.Models;
|
||||
public sealed class UserRuleSettings
|
||||
{
|
||||
public string OwnerUserId { get; set; } = "";
|
||||
public bool AutomaticGhostingPaused { get; set; }
|
||||
|
||||
// Applied / no response yet
|
||||
public int AppliedFollowUpDays { get; set; } = 14;
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace JobTrackerApi.Services
|
||||
return new RuleSettings
|
||||
{
|
||||
Id = 1,
|
||||
AutomaticGhostingPaused = u.AutomaticGhostingPaused,
|
||||
AppliedFollowUpDays = u.AppliedFollowUpDays,
|
||||
AppliedGhostDays = u.AppliedGhostDays,
|
||||
OfferFollowUpDays = u.OfferFollowUpDays,
|
||||
|
||||
@@ -40,9 +40,6 @@ public sealed class RulesHostedService(
|
||||
{
|
||||
var db = services.GetRequiredService<JobTrackerContext>();
|
||||
var settings = await RulesEngine.GetSettings(db, cancellationToken);
|
||||
if (settings.AutomaticGhostingPaused == true)
|
||||
return;
|
||||
|
||||
var now = timeProvider.GetLocalNow().DateTime;
|
||||
var lastMessages = await db.Correspondences
|
||||
.GroupBy(message => message.JobApplicationId)
|
||||
|
||||
@@ -32,21 +32,3 @@ The library now compares the name shown in the dialog with the name returned by
|
||||
**Evidence scope.** The tests render the real library and prompt with mocked transport. A native two-tab/browser run, real database writes, PDF rendering and full integrated acceptance were outside this execution. The earlier 85-case verification above is historical. The changed library source blob is `4b5018c6e549a4c5711dcc84a00082629af0ef80` and test blob is `448f46e977f4c733b3d99265e500fed8ee7779bf`.
|
||||
|
||||
The AST-only Graphify refresh completed with 20,198 nodes and 50,033 edges. SQL extraction was unavailable and 146 source files yielded no symbols.
|
||||
|
||||
## Native two-tab rename and SQLite readback · 20 November 2026
|
||||
|
||||
Application source `89128e1c33378bf2c65f2f28b048a63957772eb7`. Two Chromium tabs shared a signed-in synthetic owner and the same CV. Tab one opened Rename on revision 1. Tab two renamed the CV through its library and committed revision 2. Tab one submitted its still-open draft, saw the conflict and the persisted name, and issued **zero PUTs**. After the owner reopened Rename and reviewed that name, tab one issued exactly one PUT with expected revision 2. A reload in tab two displayed the reviewed name. The variant and history APIs returned revisions 1, 2, 3. A separate read-only SQLite query against the disposable database verified exactly those three rows and identical stored settings at each revision.
|
||||
|
||||
**Passed.** Two native cases ran with one worker, zero retries, zero skips and zero flaky results. The new pre-read conflict case took 7.7 s. The existing post-read race took 4.7 s and received the real server 409 before an explicit retry. Both used a freshly built .NET 9.0.317 Release API, a unique local SQLite data root and a fresh static export. The .NET build had zero warnings or errors. The exact-lock Next 16.4.6 build completed compilation, TypeScript and static generation. The three component suites passed all 77 cases on the same dependencies; these overlap the 77 earlier cases. Scoped ESLint, whitespace and the AST refresh passed (20,199 nodes and 50,038 edges).
|
||||
|
||||
**Build recovery.** The initial webpack attempt used a cross-drive dependency junction which resolved Next 16.4.1 and failed module resolution. An independent offline `npm ci` installed 806 packages from the lockfile. The successful runs used Next 16.4.6, Jest 30.4.2 and Playwright 1.62.1. The npm log retained dependency deprecation notices and a pending install script for the resolver. No dependency versions changed. The local API emitted its existing SQLite migration and development key-storage warnings. This run did not qualify production migrations, backup/restore or key storage.
|
||||
|
||||
| Evidence | Identity |
|
||||
| --- | --- |
|
||||
| New browser test, Git blob | `a57a77d87a377ae26ac0869469ab04732d93249b` |
|
||||
| Dependency lock, Git blob | `4c277d454e1164b1e24f21f463b5251052e53eaa` |
|
||||
| Playwright JSON, SHA-256 | `861352d6c00beb09d6e7fee5f0e596992d4eb2658fe07a65c0599f81e344ad10` |
|
||||
| Pinned Jest JSON, SHA-256 | `b6b5fd043f750e5a979f5ba70f81c86e314303eaaf707339b3fbc490a06d980b` |
|
||||
| Static export index / Release API DLL, SHA-256 | `78a5db16a0e85d8f3ead4cb6431d7fd021148b6d02d38007a4701769fb9f7e39` / `769e32f5c4f8bac61743dce67748dd5198cbbc472c8c6c1630ccefe81a1c91d2` |
|
||||
|
||||
Raw receipts are under `E:/Storage/Projects/Active/temp docs/jobjakt-local-build/cv-library-rename-verification/`. Reproduce with the existing isolated static-export Playwright configuration and `phase7-cv-library.spec.ts --grep 'two library tabs|concurrent rename receives ordinary409' --workers=1 --retries=0`. Both loopback servers stopped at completion. Browser coverage was desktop Chromium in English, on synthetic local SQLite records. MariaDB, human/device checks, PDF rendering, full A3, integrated security and release acceptance remain open.
|
||||
|
||||
@@ -10,8 +10,6 @@ python -m http.server 4327 --bind 127.0.0.1 --directory docs/ui-modernisation/re
|
||||
|
||||
## Compare the experiences
|
||||
|
||||
Browser Back and Forward retrace screens and selected opportunities within a concept. For example, open a filtered job, enter its CV workspace and go back twice to return to the filtered results. The ten desktop/phone selected-job journeys exercised this round trip and its forward path on 20 November. Drafts and filters are held in memory for the review session.
|
||||
|
||||
| Direction | First interaction | Desktop and phone | Implementation implication |
|
||||
| --- | --- | --- | --- |
|
||||
| A · Clear Desk | Scan the activity list and agenda | Compact top navigation, high density, horizontally scrollable on a phone | Existing tracker and agenda owners fit. Check legibility as text size increases. |
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const $ = (s) => document.querySelector(s);
|
||||
const $ = (s) => document.querySelector(s),
|
||||
q = new URLSearchParams(location.search);
|
||||
const screens = [
|
||||
"home",
|
||||
"discover",
|
||||
@@ -13,20 +14,14 @@ const screens = [
|
||||
"admin",
|
||||
"onboarding",
|
||||
];
|
||||
function routeFromLocation() {
|
||||
const query = new URLSearchParams(location.search);
|
||||
const selected = (key, allowed, fallback) =>
|
||||
allowed.includes(query.get(key)) ? query.get(key) : fallback;
|
||||
return {
|
||||
concept: selected("concept", "ABCDE".split(""), ""),
|
||||
screen: selected("screen", screens, "home"),
|
||||
lang: selected("lang", ["en", "nb"], "en"),
|
||||
theme: selected("theme", ["light", "dark"], "light"),
|
||||
phone: query.get("mobile") === "1",
|
||||
};
|
||||
}
|
||||
const selected = (key, allowed, fallback) =>
|
||||
allowed.includes(q.get(key)) ? q.get(key) : fallback;
|
||||
const state = {
|
||||
...routeFromLocation(),
|
||||
concept: selected("concept", "ABCDE".split(""), ""),
|
||||
screen: selected("screen", screens, "home"),
|
||||
lang: selected("lang", ["en", "nb"], "en"),
|
||||
theme: selected("theme", ["light", "dark"], "light"),
|
||||
phone: q.get("mobile") === "1",
|
||||
calendarView: "agenda",
|
||||
trackerView: "list",
|
||||
query: "",
|
||||
@@ -348,11 +343,7 @@ const records = jobs.map((job, i) => ({
|
||||
function trackedCount() {
|
||||
return records.filter((r) => r.stage === "saved").length;
|
||||
}
|
||||
function jobFromLocation() {
|
||||
const id = new URLSearchParams(location.search).get("job");
|
||||
return records.find((r) => r.id === id) || records[0];
|
||||
}
|
||||
let current = jobFromLocation();
|
||||
let current = records.find((r) => r.id === q.get("job")) || records[0];
|
||||
const detailText = [
|
||||
[
|
||||
"Coordinate community care, support families and work with local healthcare teams.",
|
||||
@@ -559,7 +550,7 @@ function gallery() {
|
||||
"",
|
||||
)}</div><section style="margin-top:45px"><h2>What to compare</h2><p>Try finding a job, saving it, preparing a CV, reviewing a letter and scheduling a follow-up. Switch between desktop and mobile, English and Bokmål, light and dark. These are design prototypes with synthetic data, not provider or production qualification.</p><a href="compare.html">Compare screenshots and tradeoffs</a> · <a href="RESEARCH.md">Research notes</a></section></main>`;
|
||||
}
|
||||
function render(navigating = false) {
|
||||
function render() {
|
||||
if (!state.concept) {
|
||||
$("#app").innerHTML = gallery();
|
||||
return;
|
||||
@@ -616,26 +607,20 @@ function render(navigating = false) {
|
||||
.join(
|
||||
"",
|
||||
)}</select></label><label><select aria-label="Language" id="lang"><option value="en" ${state.lang === "en" ? "selected" : ""}>English</option><option value="nb" ${state.lang === "nb" ? "selected" : ""}>Norsk</option></select></label><button data-action="theme">${state.theme === "dark" ? "☀ Light" : "☾ Dark"}</button><button data-action="mobile">${state.phone ? t("desktop") : t("mobile")}</button></div><div class="shell"><header class="top"><a class="brand" href="#" data-screen="home"><span>${state.concept === "E" ? "↗" : "j"}</span>${c.name}</a><nav class="nav" aria-label="Primary">${nav.map((s) => link(s, t(s), state.screen === s ? "active" : "")).join("")}</nav><div class="actions">${link("mail", "✉ " + t("mail"))}${link("settings", t("settings"))}<span class="avatar">AO</span></div></header><main class="content" id="main">${(screens[state.screen] || home)()}<details style="margin-top:35px"><summary>${t("help")}</summary><div class="actions" style="margin-top:12px">${["cv", "letter", "mail", "settings", "admin", "onboarding"].map((s) => link(s, t(s))).join("")}</div></details></main>${state.concept === "E" ? `<nav class="journey-nav" aria-label="Journey">${["home", "discover", "applications", "profile", "calendar"].map((s) => link(s, t(s), state.screen === s ? "active" : "")).join("")}</nav>` : ""}</div><footer class="footnote">${t("synthetic")}</footer>`;
|
||||
const search = `?concept=${state.concept}&screen=${state.screen}&lang=${state.lang}&theme=${state.theme}&job=${current.id}${state.phone ? "&mobile=1" : ""}`;
|
||||
if (search !== location.search) {
|
||||
if (navigating) history.pushState(null, "", search);
|
||||
else history.replaceState(null, "", search);
|
||||
}
|
||||
history.replaceState(
|
||||
null,
|
||||
"",
|
||||
`?concept=${state.concept}&screen=${state.screen}&lang=${state.lang}&theme=${state.theme}&job=${current.id}${state.phone ? "&mobile=1" : ""}`,
|
||||
);
|
||||
}
|
||||
window.addEventListener("popstate", () => {
|
||||
Object.assign(state, routeFromLocation());
|
||||
current = jobFromLocation();
|
||||
render();
|
||||
});
|
||||
document.addEventListener("click", (event) => {
|
||||
const a = event.target.closest("[data-screen]");
|
||||
if (a) {
|
||||
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
||||
event.preventDefault();
|
||||
if (a.dataset.job)
|
||||
current = records.find((r) => r.id === a.dataset.job) || records[0];
|
||||
state.screen = a.dataset.screen;
|
||||
render(true);
|
||||
render();
|
||||
window.scrollTo(0, 0);
|
||||
return;
|
||||
}
|
||||
@@ -645,7 +630,7 @@ document.addEventListener("click", (event) => {
|
||||
if (screens.includes(action)) {
|
||||
if (state.screen === "home" && action === "detail") current = records[0];
|
||||
state.screen = action;
|
||||
render(true);
|
||||
render();
|
||||
window.scrollTo(0, 0);
|
||||
} else if (action === "theme") {
|
||||
state.theme = state.theme === "light" ? "dark" : "light";
|
||||
@@ -674,7 +659,7 @@ document.addEventListener("click", (event) => {
|
||||
current.followup = true;
|
||||
state.calendarView = "agenda";
|
||||
state.screen = "calendar";
|
||||
render(true);
|
||||
render();
|
||||
toast(
|
||||
state.lang === "nb"
|
||||
? "Oppfølging lagt til i prototypen"
|
||||
@@ -721,7 +706,7 @@ document.addEventListener("change", (e) => {
|
||||
}
|
||||
if (["concept", "screen", "lang"].includes(e.target.id)) {
|
||||
state[e.target.id] = e.target.value;
|
||||
render(e.target.id !== "lang");
|
||||
render();
|
||||
}
|
||||
if (e.target.id === "settingLanguage") {
|
||||
state.lang = e.target.value;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
"width": 1440,
|
||||
"lang": "en",
|
||||
"theme": "light",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -13,7 +12,6 @@
|
||||
"width": 390,
|
||||
"lang": "nb",
|
||||
"theme": "dark",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -21,7 +19,6 @@
|
||||
"width": 1440,
|
||||
"lang": "en",
|
||||
"theme": "light",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -29,7 +26,6 @@
|
||||
"width": 390,
|
||||
"lang": "nb",
|
||||
"theme": "dark",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -37,7 +33,6 @@
|
||||
"width": 1440,
|
||||
"lang": "en",
|
||||
"theme": "light",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -45,7 +40,6 @@
|
||||
"width": 390,
|
||||
"lang": "nb",
|
||||
"theme": "dark",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -53,7 +47,6 @@
|
||||
"width": 1440,
|
||||
"lang": "en",
|
||||
"theme": "light",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -61,7 +54,6 @@
|
||||
"width": 390,
|
||||
"lang": "nb",
|
||||
"theme": "dark",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -69,7 +61,6 @@
|
||||
"width": 1440,
|
||||
"lang": "en",
|
||||
"theme": "light",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
@@ -77,7 +68,6 @@
|
||||
"width": 390,
|
||||
"lang": "nb",
|
||||
"theme": "dark",
|
||||
"historyRoundTrip": true,
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
|
||||
@@ -111,18 +111,8 @@ async function verify() {
|
||||
await page.locator("#summary").inputValue(),
|
||||
"Field electrician CV.",
|
||||
);
|
||||
await page.goBack();
|
||||
assert.equal(new URL(page.url()).searchParams.get("screen"), "detail");
|
||||
assert.equal(await page.locator("main h1").innerText(), "Front-of-house supervisor");
|
||||
await page.goBack();
|
||||
assert.equal(await page.locator("#country").inputValue(), "Denmark");
|
||||
assert.equal(await page.locator("#search").inputValue(), "supervisor");
|
||||
await page.goForward();
|
||||
assert.equal(await page.locator("main h1").innerText(), "Front-of-house supervisor");
|
||||
await page.goForward();
|
||||
assert.match(await page.locator("main .heading").innerText(), /Harbour House/);
|
||||
assert.deepEqual(errors, []);
|
||||
results.push({ concept, width, lang, theme, historyRoundTrip: true, passed: true });
|
||||
results.push({ concept, width, lang, theme, passed: true });
|
||||
await page.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +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 type { CvTheme, CvVariant, CvVariantSummary, CvVariantVersionInfo } from '../src/cvBuilder';
|
||||
import type { CvTheme, CvVariant, CvVariantSummary } from '../src/cvBuilder';
|
||||
import { emptyStructuredCv } from '../src/profileCv';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { createHash } from 'node:crypto';
|
||||
@@ -416,60 +416,6 @@ test('[P7-04 PRES-C05 C07 C10 W07] keyboard rename duplicate and delete persist
|
||||
sourceUnchanged: true, frozenUnchanged: true, qualification: 'Actual HTTP rename/duplicate/delete and frozen DTO readback; held duplicate continues the real request. Frozen DTO equality is not archived PDF-byte or restore qualification.' }), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
test('[P7-04 PRES-C05 C10] two library tabs preserve a concurrent name and allow an explicit retry', async ({ page, context, owner }, info) => {
|
||||
const original = await createVariant(page.request, owner, 'Two-tab source CV');
|
||||
const variantUrl = `${apiUrl}/cv/variants/${original.id}`;
|
||||
const versions = async () => (await json<CvVariantVersionInfo[]>(await page.request.get(`${variantUrl}/versions`)))
|
||||
.map(item => item.version).sort((left, right) => left - right);
|
||||
const originalVersions = await versions();
|
||||
const secondTab = await context.newPage();
|
||||
const label = translations.en.cvDashboardRename;
|
||||
const firstChoice = 'CV for school applications';
|
||||
const secondChoice = 'CV for tutoring applications';
|
||||
const writes: number[] = [];
|
||||
page.on('request', request => {
|
||||
if (request.url() === variantUrl && request.method() === 'PUT') writes.push(request.postDataJSON().expectedVersion);
|
||||
});
|
||||
const submit = (tab: Page) => tab.getByRole('dialog').getByRole('button', { name: label, exact: true }).click();
|
||||
const saved = (tab: Page) => tab.waitForResponse(response => response.url() === variantUrl && response.request().method() === 'PUT');
|
||||
|
||||
await enter(page, owner);
|
||||
await enter(secondTab, owner);
|
||||
await openAction(page, original.name, label);
|
||||
await page.getByRole('dialog').getByRole('textbox').fill(firstChoice);
|
||||
|
||||
await openAction(secondTab, original.name, label);
|
||||
await secondTab.getByRole('dialog').getByRole('textbox').fill(secondChoice);
|
||||
const [otherResponse] = await Promise.all([saved(secondTab), submit(secondTab)]);
|
||||
const other = await json<CvVariant>(otherResponse);
|
||||
expect(other).toMatchObject({ name: secondChoice, settings: original.settings, version: original.version + 1 });
|
||||
await expect(card(secondTab, secondChoice)).toBeVisible();
|
||||
|
||||
await submit(page);
|
||||
await expect(page.getByRole('alert').filter({ hasText: translations.en.cvEditorConflict })).toBeVisible();
|
||||
await expect(card(page, secondChoice)).toBeVisible();
|
||||
expect(writes).toEqual([]);
|
||||
expect(await json<CvVariant>(await page.request.get(variantUrl))).toEqual(other);
|
||||
expect(await versions()).toEqual([...originalVersions, other.version]);
|
||||
|
||||
await openAction(page, secondChoice, label);
|
||||
const retry = page.getByRole('dialog').getByRole('textbox');
|
||||
await expect(retry).toHaveValue(secondChoice);
|
||||
await retry.fill(firstChoice);
|
||||
const [retryResponse] = await Promise.all([saved(page), submit(page)]);
|
||||
const reviewed = await json<CvVariant>(retryResponse);
|
||||
expect(writes).toEqual([other.version]);
|
||||
expect(reviewed).toMatchObject({ name: firstChoice, settings: original.settings, version: other.version + 1 });
|
||||
expect(await json<CvVariant>(await page.request.get(variantUrl))).toEqual(reviewed);
|
||||
expect(await versions()).toEqual([...originalVersions, other.version, reviewed.version]);
|
||||
await secondTab.reload();
|
||||
await expect(card(secondTab, firstChoice)).toBeVisible();
|
||||
await info.attach('two-tab-rename-readback', { body: JSON.stringify({
|
||||
initialVersion: original.version, secondTabVersion: other.version, firstTabPutPreconditions: writes,
|
||||
finalVersion: reviewed.version, history: await versions(),
|
||||
}), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
test('[P7-04 PRES-C05 C10] concurrent rename receives ordinary409 and requires owner review before a new save', async ({ page, owner }, info) => {
|
||||
const sourceBefore = await seedSource(page, owner);
|
||||
const original = await createVariant(page.request, owner, 'Recorded conflict CV');
|
||||
|
||||
@@ -54,54 +54,6 @@ async function reflow(page: Page, info: TestInfo, name: string) {
|
||||
expect(outside).toEqual([]);
|
||||
}
|
||||
|
||||
for (const [language, width, mode] of [["en", 1440, "light"], ["nb", 390, "dark"]] as const) {
|
||||
test(`automatic Ghosted pause keeps its draft and persists after retry in ${language}`, async ({ page, headers }, info) => {
|
||||
const t = translations[language];
|
||||
const rulesUrl = `${apiUrl}/rules`;
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
await page.addInitScript(({ mode, language }) => {
|
||||
localStorage.setItem("jobtracker.themeMode", mode);
|
||||
localStorage.setItem("uiLanguage", language);
|
||||
}, { mode, language });
|
||||
expect((await page.request.put(`${apiUrl}/auth/preferences/language`, {
|
||||
headers, data: { language: language === "nb" ? "nb-NO" : "en" },
|
||||
})).status()).toBe(204);
|
||||
const openRules = async () => {
|
||||
if (width === 390) {
|
||||
await page.getByRole("combobox", { name: t.settingsNavigation }).press("Enter");
|
||||
await page.getByRole("option", { name: t.settingsTabFollowUps, exact: true }).press("Enter");
|
||||
} else {
|
||||
await page.getByRole("tab", { name: t.settingsTabFollowUps, exact: true }).click();
|
||||
}
|
||||
};
|
||||
const readPause = async () => (await (await page.request.get(rulesUrl, { headers })).json()).automaticGhostingPaused;
|
||||
await page.goto("/settings");
|
||||
await openRules();
|
||||
const pause = page.getByRole("switch", { name: t.rulesPauseAutomaticGhosting, exact: true });
|
||||
await expect(pause).not.toBeChecked();
|
||||
await expect(pause).toHaveAccessibleDescription(t.rulesPauseAutomaticGhostingHelp);
|
||||
await pause.press("Space");
|
||||
await expect(pause).toBeChecked();
|
||||
await expect(pause).toBeFocused();
|
||||
await page.route(rulesUrl, route => route.fulfill({ status: 503, json: {} }), { times: 1 });
|
||||
const save = page.getByRole("button", { name: t.rulesSave, exact: true });
|
||||
await save.click();
|
||||
await expect(page.getByRole("tabpanel", { name: t.settingsTabFollowUps }).getByRole("alert")).toHaveText(t.rulesSaveFailed);
|
||||
expect(await readPause()).toBe(false);
|
||||
await expect(pause).toBeChecked();
|
||||
const saved = page.waitForResponse(response => response.url() === rulesUrl && response.request().method() === "PUT");
|
||||
await save.click();
|
||||
expect((await saved).status()).toBe(204);
|
||||
expect(await readPause()).toBe(true);
|
||||
await page.reload();
|
||||
await openRules();
|
||||
await expect(pause).toBeChecked();
|
||||
await scan(page, info, `ghosted-pause-${language}`);
|
||||
await reflow(page, info, `ghosted-pause-${language}`);
|
||||
await capture(page, info, `ghosted-pause-${language}`);
|
||||
});
|
||||
}
|
||||
|
||||
for (const mode of ["light", "dark"] as const) for (const language of ["en", "nb"] as const) {
|
||||
test(`[PRES-E07 E08 E09 S03 S04 S05 J05 J10 M06 W11] ${mode}/${language} Settings headings, reflow and retained actions`, async ({ page, headers }, info) => {
|
||||
test.setTimeout(180_000);
|
||||
@@ -139,7 +91,7 @@ for (const mode of ["light", "dark"] as const) for (const language of ["en", "nb
|
||||
await capture(page, info, `long-heading-${suffix}`);
|
||||
|
||||
const chooseSection = async (name: string) => {
|
||||
if (page.viewportSize()!.width < 1024) {
|
||||
if (page.viewportSize()!.width < 768) {
|
||||
const selector = main.getByRole("combobox", { name: t.settingsNavigation, exact: true });
|
||||
await selector.focus();
|
||||
await selector.press("Enter");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
|
||||
import { Alert, Box, Button, FormControlLabel, FormHelperText, Switch, TextField, Typography } from "@mui/material";
|
||||
import { Alert, Box, Button, TextField, Typography } from "@mui/material";
|
||||
import { PageSection } from "../layout/PageLayout";
|
||||
|
||||
import { useI18n } from "../i18n/I18nProvider";
|
||||
@@ -13,12 +13,11 @@ export type RuleSettings = {
|
||||
offerGhostDays: number;
|
||||
feedbackFollowUpDays: number;
|
||||
feedbackGhostDays: number;
|
||||
automaticGhostingPaused?: boolean;
|
||||
};
|
||||
|
||||
export const RULE_FIELDS = ["appliedFollowUpDays", "appliedGhostDays", "offerFollowUpDays", "offerGhostDays", "feedbackFollowUpDays", "feedbackGhostDays"] as const;
|
||||
export type RuleField = typeof RULE_FIELDS[number];
|
||||
export type RuleDraft = Record<RuleField, string> & Pick<RuleSettings, "automaticGhostingPaused">;
|
||||
export type RuleDraft = Record<RuleField, string>;
|
||||
|
||||
type Props = {
|
||||
draft: RuleDraft | null;
|
||||
@@ -28,15 +27,13 @@ type Props = {
|
||||
saving: boolean;
|
||||
dirty: boolean;
|
||||
onChange: (field: RuleField, value: string) => void;
|
||||
onPauseChange: (paused: boolean) => void;
|
||||
onSave: () => void;
|
||||
onDiscard: () => void;
|
||||
onRetry: () => void;
|
||||
};
|
||||
|
||||
export default function RulesSettingsCard({ draft, loadError, saveError, invalid, saving, dirty, onChange, onPauseChange, onSave, onDiscard, onRetry }: Props) {
|
||||
export default function RulesSettingsCard({ draft, loadError, saveError, invalid, saving, dirty, onChange, onSave, onDiscard, onRetry }: Props) {
|
||||
const { t } = useI18n();
|
||||
const pauseDescription = React.useId();
|
||||
if (!draft) {
|
||||
return (
|
||||
<PageSection title={t("rulesTitle")}>
|
||||
@@ -67,14 +64,6 @@ export default function RulesSettingsCard({ draft, loadError, saveError, invalid
|
||||
<TextField label={t("rulesFeedbackFollowUpDays")} {...num("feedbackFollowUpDays")} />
|
||||
<TextField label={t("rulesFeedbackGhostDays")} {...num("feedbackGhostDays")} />
|
||||
</Box>
|
||||
{typeof draft.automaticGhostingPaused === "boolean" && (
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<FormControlLabel label={t("rulesPauseAutomaticGhosting")}
|
||||
control={<Switch checked={draft.automaticGhostingPaused} onChange={(_, paused) => onPauseChange(paused)}
|
||||
slotProps={{ input: { role: "switch", "aria-describedby": pauseDescription } }} />} />
|
||||
<FormHelperText id={pauseDescription}>{t("rulesPauseAutomaticGhostingHelp")}</FormHelperText>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Box sx={{ display: "flex", justifyContent: "flex-end", flexWrap: "wrap", gap: 1, mt: 2 }}>
|
||||
<Button onClick={onDiscard} disabled={!dirty || saving}>{t("assetsDiscardChanges")}</Button>
|
||||
|
||||
@@ -54,10 +54,7 @@ type NotificationPrefs = {
|
||||
};
|
||||
|
||||
function ruleDraft(settings: RuleSettings): RuleDraft {
|
||||
return {
|
||||
...Object.fromEntries(RULE_FIELDS.map(field => [field, String(settings[field])])),
|
||||
automaticGhostingPaused: settings.automaticGhostingPaused,
|
||||
} as RuleDraft;
|
||||
return Object.fromEntries(RULE_FIELDS.map(field => [field, String(settings[field])])) as RuleDraft;
|
||||
}
|
||||
|
||||
export default function SettingsView({
|
||||
@@ -91,10 +88,7 @@ export default function SettingsView({
|
||||
const aiControls = useRef<HTMLDivElement>(null);
|
||||
const notificationRetryFocus = useRef<HTMLElement | null>(null);
|
||||
const currentTranslation = useRef(t);
|
||||
const rulesDirty = Boolean(rulesDraft && savedRules && (
|
||||
rulesDraft.automaticGhostingPaused !== savedRules.automaticGhostingPaused ||
|
||||
RULE_FIELDS.some(field => rulesDraft[field] !== String(savedRules[field]))
|
||||
));
|
||||
const rulesDirty = Boolean(rulesDraft && savedRules && RULE_FIELDS.some(field => rulesDraft[field] !== String(savedRules[field])));
|
||||
const notificationsDirty = Boolean(notificationPrefs && savedNotificationPrefs && notificationPrefs.emailFollowUpRemindersEnabled !== savedNotificationPrefs.emailFollowUpRemindersEnabled);
|
||||
|
||||
useEffect(() => { currentTranslation.current = t; }, [t]);
|
||||
@@ -145,15 +139,11 @@ export default function SettingsView({
|
||||
setSavingRules(true);
|
||||
setRulesSaveError(false);
|
||||
try {
|
||||
const pauseChanged = submittedDraft.automaticGhostingPaused !== savedRules.automaticGhostingPaused;
|
||||
await api.put("/rules", pauseChanged ? { ...submitted, automaticGhostingPaused: submittedDraft.automaticGhostingPaused } : submitted);
|
||||
await api.put("/rules", submitted);
|
||||
if (!session.mounted) return;
|
||||
const accepted = { ...submitted, automaticGhostingPaused: submittedDraft.automaticGhostingPaused };
|
||||
setSavedRules(accepted);
|
||||
setSavedRules(submitted);
|
||||
// A completed save acknowledges its snapshot, not edits made while it was pending.
|
||||
setRulesDraft(current => current &&
|
||||
current.automaticGhostingPaused === submittedDraft.automaticGhostingPaused &&
|
||||
RULE_FIELDS.every(field => current[field] === submittedDraft[field]) ? ruleDraft(accepted) : current);
|
||||
setRulesDraft(current => current && RULE_FIELDS.every(field => current[field] === submittedDraft[field]) ? ruleDraft(submitted) : current);
|
||||
toast(currentTranslation.current("rulesSaved"), "success");
|
||||
} catch {
|
||||
if (session.mounted) setRulesSaveError(true);
|
||||
@@ -270,7 +260,7 @@ export default function SettingsView({
|
||||
|
||||
return (
|
||||
<Box sx={{ minWidth: 0 }}>
|
||||
<FormControl fullWidth sx={{ display: { xs: "flex", md: "none" }, mb: 1 }}>
|
||||
<FormControl fullWidth sx={{ display: { xs: "flex", sm: "none" }, mb: 1 }}>
|
||||
<InputLabel id="settings-section-label">{t("settingsNavigation")}</InputLabel>
|
||||
<Select
|
||||
labelId="settings-section-label"
|
||||
@@ -286,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", md: "flex" }, mb: 1 }}>
|
||||
<Tabs aria-label={t("settings")} value={tab} onChange={(_, v) => selectSection(v)} variant="scrollable" scrollButtons="auto" sx={{ display: { xs: "none", sm: "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")} />
|
||||
@@ -389,7 +379,6 @@ export default function SettingsView({
|
||||
<TabPanel value={tab} index={1} label={t("settingsTabFollowUps")}>
|
||||
<RulesSettingsCard draft={rulesDraft} loadError={rulesLoadError ? getApiErrorMessage(rulesLoadError.cause, t("rulesLoadFailed")) : null} saveError={rulesSaveError} invalid={invalidRules}
|
||||
saving={savingRules} dirty={rulesDirty} onSave={() => void saveRules()} onRetry={() => void loadRules()} onDiscard={discardRules}
|
||||
onPauseChange={paused => setRulesDraft(current => current ? { ...current, automaticGhostingPaused: paused } : current)}
|
||||
onChange={(field, value) => {
|
||||
setRulesDraft(current => current ? { ...current, [field]: value } : current);
|
||||
setInvalidRules(current => current.filter(key => key !== field));
|
||||
|
||||
@@ -3105,8 +3105,6 @@ export const translations = {
|
||||
jobDetailsNothingHighlighted: "Nothing highlighted yet.",
|
||||
rulesTitle: "Follow-up rules by scenario",
|
||||
rulesBody: "Set how long to wait before a follow-up is due and when a thread should be treated as ghosted.",
|
||||
rulesPauseAutomaticGhosting: "Pause automatic Ghosted updates",
|
||||
rulesPauseAutomaticGhostingHelp: "Applies from the next rules run. Follow-up reminders and manual status changes stay available.",
|
||||
rulesLoading: "Loading your follow-up settings…",
|
||||
rulesLoadFailed: "Could not load your follow-up settings.",
|
||||
rulesAppliedFollowUpDays: "Applied: follow-up days",
|
||||
@@ -6355,8 +6353,6 @@ export const translations = {
|
||||
jobDetailsNothingHighlighted: "Ingenting fremhevet ennå.",
|
||||
rulesTitle: "Oppfølgingsregler per scenario",
|
||||
rulesBody: "Velg hvor lenge du vil vente før oppfølging forfaller, og når en tråd skal regnes som ghostet.",
|
||||
rulesPauseAutomaticGhosting: "Sett automatiske Ghostet-oppdateringer på pause",
|
||||
rulesPauseAutomaticGhostingHelp: "Gjelder fra neste regelkjøring. Oppfølgingspåminnelser og manuelle statusendringer er fortsatt tilgjengelige.",
|
||||
rulesLoading: "Laster inn oppfølgingsinnstillingene dine…",
|
||||
rulesLoadFailed: "Kunne ikke laste oppfølgingsinnstillingene dine.",
|
||||
rulesAppliedFollowUpDays: "Søkt: oppfølgingsdager",
|
||||
|
||||
@@ -4,7 +4,6 @@ import { act, fireEvent, render, screen, waitFor, within } from '@testing-librar
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
import SettingsView from './components/SettingsView';
|
||||
import type { RuleSettings } from './components/RulesSettingsCard';
|
||||
import { I18nProvider } from './i18n/I18nProvider';
|
||||
import { ToastProvider } from './toast';
|
||||
import { api } from './api';
|
||||
@@ -246,31 +245,6 @@ test('[PRES-S03] failed Rules save remains actionable after tab return and expli
|
||||
expect(screen.queryByText('Failed to save rules.')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('the supported Ghosted pause retains its draft after failure and persists only after an explicit retry', async () => {
|
||||
const ordinaryGet = mockedApi.get.getMockImplementation()!;
|
||||
mockedApi.get.mockImplementation(async (url, options) => {
|
||||
const response = await ordinaryGet(url, options);
|
||||
if (url !== '/rules') return response;
|
||||
const { data } = response as { data: RuleSettings };
|
||||
return { data: { ...data, automaticGhostingPaused: false } };
|
||||
});
|
||||
renderView();
|
||||
await openRules();
|
||||
const pause = () => screen.getByRole('switch', { name: translations.en.rulesPauseAutomaticGhosting });
|
||||
expect(pause()).not.toBeChecked();
|
||||
fireEvent.click(pause());
|
||||
mockedApi.put.mockRejectedValueOnce(new Error('offline'));
|
||||
const save = () => screen.getByRole('button', { name: /save rules/i });
|
||||
fireEvent.click(save());
|
||||
expect(await screen.findByRole('alert')).toHaveTextContent(translations.en.rulesSaveFailed);
|
||||
rulesRoundTrip();
|
||||
expect(pause()).toBeChecked();
|
||||
fireEvent.click(save());
|
||||
await waitFor(() => expect(screen.queryByRole('alert')).not.toBeInTheDocument());
|
||||
expect(mockedApi.put).toHaveBeenLastCalledWith('/rules', expect.objectContaining({ automaticGhostingPaused: true }));
|
||||
expect(pause()).toBeChecked();
|
||||
});
|
||||
|
||||
test('[PRES-S03] invalid and empty Rules input and associated validation survive internal navigation', async () => {
|
||||
renderView();
|
||||
fireEvent.change(await openRules(), { target: { value: '' } });
|
||||
|
||||
Reference in New Issue
Block a user