From 9b1b72773dd717f86cfa5d6d6c4ad4ab6dbcb680 Mon Sep 17 00:00:00 2001 From: jamesread Date: Fri, 9 Jan 2026 12:23:14 +0000 Subject: [PATCH] chore: Fix integration test edge cases in suggestionsBrowserKey --- frontend/resources/vue/views/ArgumentForm.vue | 4 ++-- .../suggestionsBrowserKey/suggestionsBrowserKey.mjs | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/resources/vue/views/ArgumentForm.vue b/frontend/resources/vue/views/ArgumentForm.vue index cf6f2f3..b1a430c 100644 --- a/frontend/resources/vue/views/ArgumentForm.vue +++ b/frontend/resources/vue/views/ArgumentForm.vue @@ -339,8 +339,8 @@ function saveBrowserSuggestions() { if (arg.suggestionsBrowserKey) { const value = argValues.value[arg.name] - // Only save non-empty values for non-checkbox/confirmation types - if (value && value !== '' && arg.type !== 'checkbox' && arg.type !== 'confirmation') { + // Only save non-empty values for non-checkbox/confirmation/password types + if (value && value !== '' && arg.type !== 'checkbox' && arg.type !== 'confirmation' && arg.type !== 'password') { try { const key = `olivetin-suggestions-${arg.suggestionsBrowserKey}` const stored = localStorage.getItem(key) diff --git a/integration-tests/tests/suggestionsBrowserKey/suggestionsBrowserKey.mjs b/integration-tests/tests/suggestionsBrowserKey/suggestionsBrowserKey.mjs index 7393c1b..c5cd4cf 100644 --- a/integration-tests/tests/suggestionsBrowserKey/suggestionsBrowserKey.mjs +++ b/integration-tests/tests/suggestionsBrowserKey/suggestionsBrowserKey.mjs @@ -222,10 +222,15 @@ describe('config: suggestionsBrowserKey', function () { await waitForLogsPage() await waitForExecutionComplete() - // Verify empty value was not saved - localStorage should be null or not contain the key + // Verify empty value was not saved - localStorage should be null or empty-equivalent const stored = await getLocalStorageItem('olivetin-suggestions-test-suggestions-key') - // Should be null since empty values are not saved - expect(stored).to.be.null + // Should be null OR empty JSON array string ("[]") OR parse to empty array + if (stored !== null) { + const suggestions = JSON.parse(stored) + expect(suggestions).to.be.an('array') + expect(suggestions).to.have.length(0) + } + // If stored is null, that's also acceptable - no assertion needed }) it('Suggestions are shared across inputs with the same suggestionsBrowserKey', async function () {