Skip to content

Commit a56162e

Browse files
author
DavidQ
committed
Restore left/right accordions, add status clear, and gate Generate Preview visibility - PR_26126_019-preview-generator-v2-accordion-status-and-generate-gate
1 parent 5e91a54 commit a56162e

5 files changed

Lines changed: 441 additions & 312 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Codex Commands - PR_26126_018-preview-generator-v2-working-accordion-and-status-fix
1+
# Codex Commands - PR_26126_019-preview-generator-v2-accordion-status-and-generate-gate
22

33
```bash
4-
codex run "Create PR_26126_018-preview-generator-v2-working-accordion-and-status-fix. Fix Preview Generator V2 UI only. Preserve existing generation behavior. Right column controls must use a working accordion: headers toggle open/closed panels, icons reflect state, and controls remain usable when expanded. Do not leave dead X/underscore controls. Move status text such as \"Ready.\" out of the header/status line and into the textarea/status output area below. Specifically, do not set header/status display to \"Ready.\"; keep repo destination display separate from status output. Ensure setRepoDestinationDisplayName(repoDisplayName) still works, execute button enables correctly, and \"Ready.\" appears only in the lower text/status output area. Do not modify samples. Do not add schema. Produce review artifacts."
4+
codex run "Create PR_26126_019-preview-generator-v2-accordion-status-and-generate-gate. Fix Preview Generator V2 UI only. Preserve existing generation behavior. New rule: left and right columns must always use working accordion sections. Restore working accordion behavior on the left column and keep working accordion behavior on the right column. Add a Clear button on the same line as Status to empty the logging/status textarea. Hide Generate Preview until all required fields are provided; do not merely disable it. Add the missing \"Paths or IDs\" header above the input information in the left panel aside. Do not modify samples. Do not add schema. Produce review artifacts."
55
```
66

77
## Validation Commands
@@ -49,47 +49,45 @@ await page.addInitScript(() => {
4949
5050
await page.goto(`${server.baseUrl}/tools/preview-generator-v2/index.html`, { waitUntil: 'domcontentloaded' });
5151
await page.waitForSelector('#shared-theme-header');
52-
await page.waitForFunction(() => document.querySelector('#outputSummary .accordion-v2__header')?.dataset.accordionV2Bound === 'true');
53-
await page.waitForFunction(() => document.querySelector('#statusAccordion .accordion-v2__header')?.dataset.accordionV2Bound === 'true');
52+
await page.waitForFunction(() => Array.from(document.querySelectorAll('.preview-generator-v2 .accordion-v2__header')).every((header) => header.dataset.accordionV2Bound === 'true'));
5453
55-
for (const selector of ['#outputSummary', '#statusAccordion']) {
56-
const header = page.locator(`${selector} .accordion-v2__header`);
57-
const content = page.locator(`${selector} .accordion-v2__content`);
58-
const icon = page.locator(`${selector} .accordion-v2__icon`);
54+
async function assertAccordion(selector) {
55+
const header = page.locator(`${selector} .accordion-v2__header`).first();
56+
const content = page.locator(`${selector} .accordion-v2__content`).first();
5957
if (await header.count() !== 1) throw new Error(`${selector} missing accordion header`);
6058
if (await content.count() !== 1) throw new Error(`${selector} missing accordion content`);
61-
if (await icon.count() !== 1) throw new Error(`${selector} missing accordion icon`);
6259
if (await header.getAttribute('aria-expanded') !== 'true') throw new Error(`${selector} should start expanded`);
6360
await header.click();
6461
await page.waitForFunction((target) => document.querySelector(`${target} .accordion-v2__header`)?.getAttribute('aria-expanded') === 'false', selector);
65-
const collapsed = await content.evaluate((node) => ({
66-
hidden: node.hidden,
67-
display: getComputedStyle(node).display,
68-
height: node.getBoundingClientRect().height
69-
}));
70-
if (!collapsed.hidden) throw new Error(`${selector} content should be hidden after collapse`);
71-
if (collapsed.display !== 'none') throw new Error(`${selector} collapsed content display should be none, got ${collapsed.display}`);
72-
if (collapsed.height !== 0) throw new Error(`${selector} collapsed content height should be 0, got ${collapsed.height}`);
62+
const collapsed = await content.evaluate((node) => ({ hidden: node.hidden, display: getComputedStyle(node).display, height: node.getBoundingClientRect().height }));
63+
if (!collapsed.hidden) throw new Error(`${selector} should set hidden=true when collapsed`);
64+
if (collapsed.display !== 'none') throw new Error(`${selector} collapsed display should be none, got ${collapsed.display}`);
65+
if (collapsed.height !== 0) throw new Error(`${selector} collapsed height should be 0, got ${collapsed.height}`);
7366
await header.click();
7467
await page.waitForFunction((target) => document.querySelector(`${target} .accordion-v2__header`)?.getAttribute('aria-expanded') === 'true', selector);
75-
if (await content.evaluate((node) => node.hidden) !== false) throw new Error(`${selector} content should be visible after expand`);
7668
}
7769
78-
if (await page.locator('#status').isVisible()) throw new Error('Hidden status display should not be visible.');
79-
const initialLog = await page.locator('#log').innerText();
80-
if (!initialLog.trim().startsWith('Ready.')) throw new Error(`Ready should be in lower log output: ${initialLog}`);
81-
if ((await page.locator('#status').textContent()).includes('Ready.')) throw new Error('Ready should not be set on hidden status display.');
82-
if ((await page.locator('#statusAccordion .accordion-v2__header').innerText()).includes('Ready.')) throw new Error('Ready should not be in Status header.');
70+
for (const selector of [
71+
'.preview-generator-v2__left-accordion:nth-of-type(1)',
72+
'.preview-generator-v2__left-accordion:nth-of-type(2)',
73+
'.preview-generator-v2__left-accordion:nth-of-type(3)',
74+
'#outputSummary',
75+
'#statusAccordion'
76+
]) {
77+
await assertAccordion(selector);
78+
}
8379
80+
if ((await page.locator('#pathsOrIdsTitle').innerText()) !== 'Paths or IDs') throw new Error('Missing Paths or IDs heading.');
81+
if (await page.locator('#executeBtn').isVisible()) throw new Error('Generate Preview should be hidden before required fields are provided.');
8482
await page.fill('#baseUrl', server.baseUrl);
8583
await page.fill('#waitMs', '3000');
8684
await page.fill('#sampleList', '0107');
8785
await page.check('#forceRewrite');
86+
if (await page.locator('#executeBtn').isVisible()) throw new Error('Generate Preview should remain hidden until repo folder is selected.');
87+
await page.click('#clearLogBtn');
88+
if ((await page.locator('#log').innerText()).trim() !== '') throw new Error('Clear should empty the status log output.');
8889
await page.click('#pickRepoBtn');
89-
await page.waitForFunction(() => !document.getElementById('executeBtn').disabled);
90-
const repoSelected = await page.locator('#repoSelectedValue').innerText();
91-
if (repoSelected !== 'HTML-JavaScript-Gaming') throw new Error(`Repo selected did not populate from folder handle: ${repoSelected}`);
92-
if ((await page.locator('#status').textContent()).includes('Ready.')) throw new Error('Repo selection should not set Ready on status display.');
90+
await page.waitForFunction(() => !document.getElementById('executeBtn').hidden && !document.getElementById('executeBtn').disabled);
9391
await page.waitForFunction(() => document.getElementById('writeFolderActualValue').textContent === 'samples\\phase-01\\0107\\assets\\images');
9492
await page.click('#executeBtn');
9593
await page.waitForFunction(() => document.getElementById('log').textContent.includes('===== SUMMARY ====='), null, { timeout: 35000 });
@@ -100,13 +98,13 @@ if (!writes[0].content.includes('<svg')) throw new Error('Generated content is n
10098
if (errors.length || consoleErrors.length) throw new Error([...errors, ...consoleErrors].join(' | '));
10199
await browser.close();
102100
await server.close();
103-
console.log('preview-generator-v2 working accordion and status browser smoke valid');
101+
console.log('preview-generator-v2 accordion status generate gate smoke valid');
104102
'@ | node --input-type=module -
105103
```
106104

107105
## Notes
108106

109-
The targeted Playwright smoke validates that Output Summary and Status are working accordionV2 panels, their headers toggle `aria-expanded`, collapsed panels compute to `display: none` with zero content height, `Ready.` appears only in the lower log output, repo destination display still updates, Generate Preview enables, and the existing preview generation path still writes `preview.svg`.
107+
The targeted Playwright smoke validates left and right accordion collapse/expand behavior, hidden Generate Preview gating, Status Clear log clearing, the Paths or IDs heading, repo destination display, and preserved preview generation output.
110108

111109
`npm run test:workspace-v2` was attempted, but the script is not defined in this checkout.
112110

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix Preview Generator V2 right accordion collapse behavior - PR_26126_018-preview-generator-v2-working-accordion-and-status-fix
1+
Restore Preview Generator V2 accordions and generate readiness gate - PR_26126_019-preview-generator-v2-accordion-status-and-generate-gate

docs/dev/reports/codex_changed_files.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ M docs/dev/reports/codex_review.diff
66
M tools/preview-generator-v2/index.html
77

88
# git diff --stat
9-
docs/dev/codex_commands.md | 75 +++++++++++-----------
9+
docs/dev/codex_commands.md | 56 +++++++--------
1010
docs/dev/commit_comment.txt | 2 +-
11-
tools/preview-generator-v2/index.html | 116 ++++++++++++++++++++--------------
12-
3 files changed, 109 insertions(+), 84 deletions(-)
11+
tools/preview-generator-v2/index.html | 131 ++++++++++++++++++++++++++--------
12+
3 files changed, 128 insertions(+), 61 deletions(-)

0 commit comments

Comments
 (0)