Skip to content

Commit 1c0716f

Browse files
authored
✅ Test(gui): wait for schema sync in plugin detail panel tests (#1449)
Mode is hydrated synchronously, but Verbosity / API version only show the saved values after the async refreshConfigSchema call resolves with the advanced-state choices. Both tests waited for Mode and then asserted the dependent fields synchronously, so on a slow CI runner they could still see the placeholder ("verbosity▼"). Move those assertions into waitFor.
1 parent 98c640c commit 1c0716f

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

‎src/__tests__/renderer/components/plugin-detail-panel.spec.tsx‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,11 @@ describe('PluginDetailPanel — config tab persistence (issue diagnostic)', () =
249249
expect(modeTrigger.textContent).toContain('advanced')
250250
})
251251

252-
// Without the schema sync, verbosity/apiVersion values are saved but
253-
// the basic-state choices don't include them, so they render as
254-
// placeholder (field.name). This documents the current broken state
255-
// and gives us a failing assertion to fix.
256-
const verbosityTrigger = getFieldSelectTrigger('Verbosity')
257-
const apiVersionTrigger = getFieldSelectTrigger('API version')
258-
// After fix: these should contain 'debug' / 'v2'
259-
expect(verbosityTrigger.textContent).toContain('debug')
260-
expect(apiVersionTrigger.textContent).toContain('v2')
252+
// Mode is hydrated synchronously, but verbosity/apiVersion only show the saved values once the async schema sync resolves with advanced-state choices; until then they render the placeholder (field.name), so wait for it instead of asserting right after mode.
253+
await waitFor(() => {
254+
expect(getFieldSelectTrigger('Verbosity').textContent).toContain('debug')
255+
expect(getFieldSelectTrigger('API version').textContent).toContain('v2')
256+
})
261257
})
262258

263259
it('shows saved values end-to-end: user toggles mode, clicks Confirm, form retains new values', async () => {
@@ -326,7 +322,10 @@ describe('PluginDetailPanel — config tab persistence (issue diagnostic)', () =
326322
expect(modeTrigger.textContent).toContain('advanced')
327323
})
328324

329-
expect(getFieldSelectTrigger('Verbosity').textContent).toContain('debug')
330-
expect(getFieldSelectTrigger('API version').textContent).toContain('v2')
325+
// Same as above: dependent fields need the async schema sync to finish after the rerender.
326+
await waitFor(() => {
327+
expect(getFieldSelectTrigger('Verbosity').textContent).toContain('debug')
328+
expect(getFieldSelectTrigger('API version').textContent).toContain('v2')
329+
})
331330
})
332331
})

0 commit comments

Comments
 (0)