diff --git a/features/preference.feature b/features/preference.feature index d722a382..c75efaa5 100644 --- a/features/preference.feature +++ b/features/preference.feature @@ -8,7 +8,7 @@ Feature: TidGi Preference And I wait for the page to load completely And I should see a "page body" element with selector "body" - @setup + @ai-setting Scenario: Configure AI provider and default model # Step 1: Configure AI settings first - Open preferences window, wait a second so its URL settle down. When I click on a "settings button" element with selector "#open-preferences-button" diff --git a/features/stepDefinitions/agent.ts b/features/stepDefinitions/agent.ts index 04a92c83..01228cfb 100644 --- a/features/stepDefinitions/agent.ts +++ b/features/stepDefinitions/agent.ts @@ -1,6 +1,6 @@ import { After, DataTable, Given, Then } from '@cucumber/cucumber'; -import { backOff } from 'exponential-backoff'; import { AIGlobalSettings, AIProviderConfig } from '@services/externalAPI/interface'; +import { backOff } from 'exponential-backoff'; import fs from 'fs-extra'; import { isEqual, omit } from 'lodash'; import path from 'path'; @@ -14,7 +14,6 @@ const BACKOFF_OPTIONS = { numOfAttempts: 10, startingDelay: 200, timeMultiple: 1.5, - maxDelay: 3000, }; /** @@ -140,13 +139,7 @@ Then('I should see {int} messages in chat history', async function(this: Applica throw new Error(`Expected ${expectedCount} messages but found ${currentCount}`); } }, - { - ...BACKOFF_OPTIONS, - retry: (error: Error) => { - // Retry if we don't have enough messages yet, but not if we have too many - return !error.message.includes('(too many)'); - }, - }, + BACKOFF_OPTIONS, ).catch(async (error: unknown) => { // Get final count for error message try { diff --git a/features/stepDefinitions/application.ts b/features/stepDefinitions/application.ts index ae80e5ee..987b45bf 100644 --- a/features/stepDefinitions/application.ts +++ b/features/stepDefinitions/application.ts @@ -15,10 +15,9 @@ import { clearSubWikiRoutingTestData } from './wiki'; // Backoff configuration for retries const BACKOFF_OPTIONS = { - numOfAttempts: 5, + numOfAttempts: 8, startingDelay: 100, timeMultiple: 2, - maxDelay: 2000, }; // Helper function to check if window type is valid and return the corresponding WindowNames @@ -74,10 +73,7 @@ export class ApplicationWorld { throw new Error('Condition not met'); } }, - { - ...BACKOFF_OPTIONS, - retry: () => true, - }, + BACKOFF_OPTIONS, ); return true; } catch { @@ -183,13 +179,7 @@ export class ApplicationWorld { } return window; }, - { - ...BACKOFF_OPTIONS, - retry: (error: Error) => { - // Don't retry if it's an invalid window type error - return !error.message.includes('is not a valid WindowNames'); - }, - }, + BACKOFF_OPTIONS, ); } catch (error) { // If it's an invalid window type error, re-throw it @@ -216,10 +206,10 @@ Before(function(this: ApplicationWorld, { pickle }) { fs.mkdirSync(screenshotsDirectory, { recursive: true }); } - if (pickle.tags.some((tag) => tag.name === '@setup')) { + if (pickle.tags.some((tag) => tag.name === '@ai-setting')) { clearAISettings(); } - if (pickle.tags.some((tag) => tag.name === '@tidgiminiwindow')) { + if (pickle.tags.some((tag) => tag.name === '@tidgi-mini-window')) { clearTidgiMiniWindowSettings(); } }); @@ -246,13 +236,13 @@ After(async function(this: ApplicationWorld, { pickle }) { this.mainWindow = undefined; this.currentWindow = undefined; } - if (pickle.tags.some((tag) => tag.name === '@tidgiminiwindow')) { + if (pickle.tags.some((tag) => tag.name === '@tidgi-mini-window')) { clearTidgiMiniWindowSettings(); } - if (pickle.tags.some((tag) => tag.name === '@setup')) { + if (pickle.tags.some((tag) => tag.name === '@ai-setting')) { clearAISettings(); } - if (pickle.tags.some((tag) => tag.name === '@subwiki-routing')) { + if (pickle.tags.some((tag) => tag.name === '@subwiki')) { clearSubWikiRoutingTestData(); } }); diff --git a/features/stepDefinitions/browserView.ts b/features/stepDefinitions/browserView.ts index 58f43b94..6a557c75 100644 --- a/features/stepDefinitions/browserView.ts +++ b/features/stepDefinitions/browserView.ts @@ -5,10 +5,9 @@ import type { ApplicationWorld } from './application'; // Backoff configuration for retries const BACKOFF_OPTIONS = { - numOfAttempts: 5, + numOfAttempts: 8, startingDelay: 100, timeMultiple: 2, - maxDelay: 2000, }; Then('I should see {string} in the browser view content', async function(this: ApplicationWorld, expectedText: string) { @@ -27,10 +26,7 @@ Then('I should see {string} in the browser view content', async function(this: A throw new Error(`Expected text "${expectedText}" not found`); } }, - { - ...BACKOFF_OPTIONS, - retry: () => true, - }, + BACKOFF_OPTIONS, ).catch(async () => { const finalContent = await getTextContent(this.app!); throw new Error( @@ -55,10 +51,7 @@ Then('I should see {string} in the browser view DOM', async function(this: Appli throw new Error(`Expected text "${expectedText}" not found in DOM`); } }, - { - ...BACKOFF_OPTIONS, - retry: () => true, - }, + BACKOFF_OPTIONS, ).catch(async () => { const finalDomContent = await getDOMContent(this.app!); throw new Error( @@ -83,10 +76,7 @@ Then('the browser view should be loaded and visible', async function(this: Appli throw new Error('Browser view not loaded'); } }, - { - ...BACKOFF_OPTIONS, - retry: () => true, - }, + BACKOFF_OPTIONS, ).catch(() => { throw new Error('Browser view is not loaded or visible after multiple attempts'); }); @@ -174,10 +164,7 @@ Then('I should not see a(n) {string} element in browser view with selector {stri throw new Error('Element still exists'); } }, - { - ...BACKOFF_OPTIONS, - retry: () => true, - }, + BACKOFF_OPTIONS, ).catch(() => { throw new Error(`Element "${elementComment}" with selector "${selector}" was found in browser view after multiple attempts, but should not be visible`); }); diff --git a/features/stepDefinitions/cleanup.ts b/features/stepDefinitions/cleanup.ts new file mode 100644 index 00000000..e69de29b diff --git a/features/tidgiMiniWindow.feature b/features/tidgiMiniWindow.feature index 272fc762..35ce3132 100644 --- a/features/tidgiMiniWindow.feature +++ b/features/tidgiMiniWindow.feature @@ -1,4 +1,4 @@ -@tidgiminiwindow +@tidgi-mini-window Feature: TidGi Mini Window As a user I want to enable and use the TidGi mini window diff --git a/features/tidgiMiniWindowWorkspace.feature b/features/tidgiMiniWindowWorkspace.feature index 10bb2fbd..c52b9bfd 100644 --- a/features/tidgiMiniWindowWorkspace.feature +++ b/features/tidgiMiniWindowWorkspace.feature @@ -1,4 +1,4 @@ -@tidgiminiwindow +@tidgi-mini-window Feature: TidGi Mini Window Workspace Switching As a user with tidgi mini window already enabled I want to test tidgi mini window behavior with different workspace configurations