diff --git a/tests/e2e/copy-paste.spec.ts b/tests/e2e/copy-paste.spec.ts index 15149c1..57202b0 100644 --- a/tests/e2e/copy-paste.spec.ts +++ b/tests/e2e/copy-paste.spec.ts @@ -68,9 +68,12 @@ test.describe("Copy/Paste Functionality", () => { '[data-testid="copy-button"], button[aria-label*="Copy"], button:has(svg.lucide-copy), button:has(svg.lucide-clipboard)', ) - // Skip test if copy button doesn't exist + // Copy button feature may not exist in all versions - skip if not available const buttonCount = await copyButton.count() - test.skip(buttonCount === 0, "Copy button not available") + if (buttonCount === 0) { + test.skip() + return + } await copyButton.first().click() // Should show copied confirmation (toast or button state change) @@ -98,11 +101,14 @@ test.describe("Copy/Paste Functionality", () => { await xmlToggle.first().click() } - // Skip test if XML input feature doesn't exist + // XML input feature may not exist in all versions - skip if not available const xmlInputCount = await xmlInput.count() const isXmlVisible = xmlInputCount > 0 && (await xmlInput.first().isVisible()) - test.skip(!isXmlVisible, "XML input feature not available") + if (!isXmlVisible) { + test.skip() + return + } const testXml = ` diff --git a/tests/e2e/file-upload.spec.ts b/tests/e2e/file-upload.spec.ts index a73c5f9..213e355 100644 --- a/tests/e2e/file-upload.spec.ts +++ b/tests/e2e/file-upload.spec.ts @@ -73,8 +73,13 @@ test.describe("File Upload", () => { const removeButton = page.locator( '[data-testid="remove-file-button"], button[aria-label*="Remove"], button:has(svg.lucide-x)', ) + + // Remove button feature may not exist in all versions - skip if not available const removeButtonCount = await removeButton.count() - test.skip(removeButtonCount === 0, "Remove file button not available") + if (removeButtonCount === 0) { + test.skip() + return + } await removeButton.first().click() // Verify button is gone or file preview is removed diff --git a/tests/e2e/history-restore.spec.ts b/tests/e2e/history-restore.spec.ts index 3fd92af..05b3646 100644 --- a/tests/e2e/history-restore.spec.ts +++ b/tests/e2e/history-restore.spec.ts @@ -34,15 +34,10 @@ test.describe("History and Session Restore", () => { }) // Find and click new chat button - const newChatButton = page.locator( - '[data-testid="new-chat-button"], button[aria-label*="New"], button:has(svg.lucide-plus), button:has-text("New Chat")', - ) + const newChatButton = page.locator('[data-testid="new-chat-button"]') + await expect(newChatButton).toBeVisible({ timeout: 5000 }) - // Skip test if new chat button doesn't exist - const buttonCount = await newChatButton.count() - test.skip(buttonCount === 0, "New chat button not available") - - await newChatButton.first().click() + await newChatButton.click() // Conversation should be cleared await expect( @@ -61,9 +56,12 @@ test.describe("History and Session Restore", () => { 'button[aria-label*="History"]:not([disabled]), button:has(svg.lucide-history):not([disabled]), button:has(svg.lucide-menu):not([disabled]), button:has(svg.lucide-sidebar):not([disabled]), button:has(svg.lucide-panel-left):not([disabled])', ) - // Skip test if history button doesn't exist + // History feature may not exist in all versions - skip if not available const buttonCount = await historyButton.count() - test.skip(buttonCount === 0, "History button not available") + if (buttonCount === 0) { + test.skip() + return + } await historyButton.first().click() // Wait for sidebar/panel to appear or verify page still works @@ -111,6 +109,11 @@ test.describe("History and Session Restore", () => { await expect( page.locator('textarea[aria-label="Chat input"]'), ).toBeVisible({ timeout: 10000 }) + + // Verify the message persisted after reload + await expect( + page.locator('text="This message should persist."'), + ).toBeVisible({ timeout: 10000 }) }) test("diagram state persists after reload", async ({ page }) => { @@ -243,9 +246,12 @@ test.describe("History and Session Restore", () => { 'button[aria-label*="Model"], [data-testid="model-selector"], button:has-text("Claude")', ) - // Skip test if model selector doesn't exist + // Model selector feature may not exist in all versions - skip if not available const selectorCount = await modelSelector.count() - test.skip(selectorCount === 0, "Model selector not available") + if (selectorCount === 0) { + test.skip() + return + } const initialModel = await modelSelector.first().textContent()