|
1 | | -diff --git a/tests/playwright/tools/GameJourneyTool.spec.mjs b/tests/playwright/tools/GameJourneyTool.spec.mjs |
2 | | -index e9005f08b..586e7521f 100644 |
3 | | ---- a/tests/playwright/tools/GameJourneyTool.spec.mjs |
4 | | -+++ b/tests/playwright/tools/GameJourneyTool.spec.mjs |
5 | | -@@ -69,7 +69,6 @@ async function openRepoPage(page, pathName, options = {}) { |
6 | | - page.on("requestfailed", (request) => { |
7 | | - failedRequests.push(`FAILED ${request.url()}`); |
8 | | - }); |
9 | | -- |
10 | | - if (collectCoverage) { |
11 | | - await workspaceV2CoverageReporter.start(page); |
12 | | - } |
13 | | -@@ -258,6 +257,7 @@ test("Game Journey progress dashboard summarizes completion metrics", async ({ p |
14 | | - const failedRequests = []; |
15 | | - const pageErrors = []; |
16 | | - const consoleErrors = []; |
17 | | -+ const recommendedTargetRequests = []; |
18 | | - |
19 | | - page.on("pageerror", (error) => { |
20 | | - pageErrors.push(error.message); |
21 | | -@@ -275,6 +275,12 @@ test("Game Journey progress dashboard summarizes completion metrics", async ({ p |
22 | | - page.on("requestfailed", (request) => { |
23 | | - failedRequests.push(`FAILED ${request.url()}`); |
24 | | - }); |
25 | | -+ page.on("request", (request) => { |
26 | | -+ const requestUrl = request.url(); |
27 | | -+ if (requestUrl.includes("/api/toolbox/game-journey/repositories/") && requestUrl.includes("/methods/updateRecommendedTarget")) { |
28 | | -+ recommendedTargetRequests.push(request.postDataJSON()); |
29 | | -+ } |
30 | | -+ }); |
31 | | - |
32 | | - try { |
33 | | - await workspaceV2CoverageReporter.start(page); |
34 | | -@@ -332,12 +338,23 @@ test("Game Journey progress dashboard summarizes completion metrics", async ({ p |
35 | | - "Next action: mark one finished section item complete so overall progress can rise above 0%.", |
36 | | - ]); |
37 | | - await expect(page.locator("[data-journey-recommended-target]")).toHaveCount(5); |
38 | | -+ const recommendedTargetOrder = await page.locator("[data-journey-recommended-target]").evaluateAll((rows) => ( |
39 | | -+ rows.map((row) => row.dataset.journeyRecommendedTarget) |
40 | | -+ )); |
41 | | -+ expect(recommendedTargetOrder).toEqual([ |
42 | | -+ "hero", |
43 | | -+ "enemy", |
44 | | -+ "boss", |
45 | | -+ "background", |
46 | | -+ "music", |
47 | | -+ ]); |
48 | | -+ await expect(page.locator("[data-journey-recommended-targets] th")).toHaveText(["Target", "Section", "Count"]); |
49 | | - await expect(page.locator("[data-journey-recommended-target] td:first-child")).toHaveText([ |
50 | | -- "Hero", |
51 | | -- "Enemy", |
52 | | -- "Boss", |
53 | | -- "Background", |
54 | | -- "Music", |
55 | | -+ "Hero [1]", |
56 | | -+ "Enemy [4]", |
57 | | -+ "Boss [1]", |
58 | | -+ "Background [3]", |
59 | | -+ "Music [5]", |
60 | | - ]); |
61 | | - await expect(page.locator("[data-journey-recommended-target='hero'] td").nth(1)).toHaveText("Objects"); |
62 | | - await expect(page.locator("[data-journey-recommended-target='enemy'] td").nth(1)).toHaveText("Objects"); |
63 | | -@@ -349,11 +366,19 @@ test("Game Journey progress dashboard summarizes completion metrics", async ({ p |
64 | | - await expect(page.locator("[data-journey-target-input='boss']")).toHaveValue("1"); |
65 | | - await expect(page.locator("[data-journey-target-input='background']")).toHaveValue("3"); |
66 | | - await expect(page.locator("[data-journey-target-input='music']")).toHaveValue("5"); |
67 | | -+ await expect(page.locator("[data-journey-recommended-target] input[type='checkbox']")).toHaveCount(0); |
68 | | -+ await expect(page.locator("[data-journey-target-input='hero']")).toHaveAttribute("type", "number"); |
69 | | -+ await expect(page.locator("[data-journey-target-input='hero']")).toHaveAttribute("inputmode", "numeric"); |
70 | | -+ await expect(page.locator("[data-journey-target-input='hero']")).toHaveAttribute("aria-label", "Hero count"); |
71 | | - await page.locator("[data-journey-target-input='hero']").fill("2"); |
72 | | - await expect(page.locator("[data-journey-target-status]")).toHaveText("Saved Hero target at 2."); |
73 | | - await expect(page.locator("[data-journey-target-input='hero']")).toHaveValue("2"); |
74 | | -+ await expect(page.locator("[data-journey-target-count-preview='hero']")).toHaveText(" [2]"); |
75 | | -+ expect(recommendedTargetRequests).toHaveLength(1); |
76 | | -+ expect(recommendedTargetRequests[0].args).toEqual(["hero", 2]); |
77 | | - await page.reload({ waitUntil: "networkidle" }); |
78 | | - await expect(page.locator("[data-journey-target-input='hero']")).toHaveValue("2"); |
79 | | -+ await expect(page.locator("[data-journey-target-count-preview='hero']")).toHaveText(" [2]"); |
80 | | - const repositoryData = await fetchApiData(server, "/api/toolbox/game-journey/repositories", { |
81 | | - body: JSON.stringify({ options: {} }), |
82 | | - method: "POST", |
83 | | -diff --git a/toolbox/game-journey/game-journey.js b/toolbox/game-journey/game-journey.js |
84 | | -index c2b2f876c..332274910 100644 |
85 | | ---- a/toolbox/game-journey/game-journey.js |
86 | | -+++ b/toolbox/game-journey/game-journey.js |
87 | | -@@ -1161,7 +1161,7 @@ function renderRecommendedTargets() { |
88 | | - table.setAttribute("aria-label", "Game Journey recommended planning targets"); |
89 | | - const head = createElement("thead"); |
90 | | - const headRow = createElement("tr"); |
91 | | -- ["Target", "Section", "Suggested"].forEach((heading) => { |
92 | | -+ ["Target", "Section", "Count"].forEach((heading) => { |
93 | | - const cell = createElement("th", { text: heading }); |
94 | | - cell.scope = "col"; |
95 | | - headRow.append(cell); |
96 | | -@@ -1169,16 +1169,22 @@ function renderRecommendedTargets() { |
97 | | - head.append(headRow); |
98 | | - const body = createElement("tbody"); |
99 | | - targets.forEach((target) => { |
100 | | -+ const targetCount = recommendedTargetValues.get(target.key) ?? target.suggestedCount; |
101 | | - const row = createElement("tr"); |
102 | | - row.dataset.journeyRecommendedTarget = target.key; |
103 | | -- const labelCell = createElement("td", { text: target.label }); |
104 | | -+ const labelCell = createElement("td"); |
105 | | -+ const label = createElement("span", { text: target.label }); |
106 | | -+ const countPreview = createElement("span", { text: ` [${targetCount}]` }); |
107 | | -+ countPreview.dataset.journeyTargetCountPreview = target.key; |
108 | | -+ labelCell.append(label, countPreview); |
109 | | - const sectionCell = createElement("td", { text: target.sectionName }); |
110 | | - const input = document.createElement("input"); |
111 | | - input.type = "number"; |
112 | | -+ input.inputMode = "numeric"; |
113 | | - input.min = "0"; |
114 | | - input.step = "1"; |
115 | | -- input.value = String(recommendedTargetValues.get(target.key) ?? target.suggestedCount); |
116 | | -- input.setAttribute("aria-label", `${target.label} suggested target`); |
117 | | -+ input.value = String(targetCount); |
118 | | -+ input.setAttribute("aria-label", `${target.label} count`); |
119 | | - input.dataset.journeyTargetInput = target.key; |
120 | | - const inputCell = createElement("td"); |
121 | | - inputCell.append(input); |
122 | | -@@ -1773,6 +1779,10 @@ recommendedTargets?.addEventListener("input", (event) => { |
123 | | - const savedValue = normalizeTargetCount(updated.suggestedCount); |
124 | | - recommendedTargetValues.set(target.key, savedValue); |
125 | | - input.value = String(savedValue); |
126 | | -+ const preview = recommendedTargets.querySelector(`[data-journey-target-count-preview='${target.key}']`); |
127 | | -+ if (preview) { |
128 | | -+ preview.textContent = ` [${savedValue}]`; |
129 | | -+ } |
130 | | - if (recommendedTargetStatus) { |
131 | | - recommendedTargetStatus.textContent = `Saved ${target.label} target at ${savedValue}.`; |
132 | | - } |
| 1 | +No executable code changes in PR_26174_ALFA_008; final validation and reporting only. |
0 commit comments