Преглед на файлове

chore: Fix integration test edge cases in suggestionsBrowserKey

jamesread преди 7 месеца
родител
ревизия
9b1b72773d
променени са 2 файла, в които са добавени 10 реда и са изтрити 5 реда
  1. 2 2
      frontend/resources/vue/views/ArgumentForm.vue
  2. 8 3
      integration-tests/tests/suggestionsBrowserKey/suggestionsBrowserKey.mjs

+ 2 - 2
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)

+ 8 - 3
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 () {