Repository: epam/ai-dial-chat
Pull request #3821: feat(chat-e2e): bookmark agents tests
Author: login: irinakartun
Created: 2025-05-13T14:14:29Z | Merged: 2025-05-16T11:56:42Z

**Description:**

bookmark agents tests

**Checklist:**

- [x] the pull request name complies with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- [x] the pull request name starts with `fix(<scope>):`, `feat(<scope>):`, `feature(<scope>):`, `chore(<scope>):`, `hotfix(<scope>):` or `e2e(<scope>):`. If contains breaking changes then the pull request name must start with `fix(<scope>)!:`, `feat(<scope>)!:`, `feature(<scope>)!:`, `chore(<scope>)!:`, `hotfix(<scope>)!:` or `e2e(<scope>)!:` where `<scope>` is name of affected project: `chat`, `chat-e2e`, `overlay`, `shared`, `sandbox-overlay`, etc.
- [ ] the pull request name ends with `(Issue #<TICKET_ID>)` (comma-separated list of issues)
- [x] I confirm that do not share any confidential information like API keys or any other secrets and private URLs



Diff:
diff --git a/apps/chat-e2e/src/assertions/confirmationDialogAssertion.ts b/apps/chat-e2e/src/assertions/confirmationDialogAssertion.ts
index 6655c7ead5..480f343867 100644
--- a/apps/chat-e2e/src/assertions/confirmationDialogAssertion.ts
+++ b/apps/chat-e2e/src/assertions/confirmationDialogAssertion.ts
@@ -1,7 +1,6 @@
 import { BaseAssertion } from '@/src/assertions/base/baseAssertion';
 import { ExpectedMessages } from '@/src/testData';
 import { ConfirmationDialog } from '@/src/ui/webElements';
-import { expect } from '@playwright/test';
 
 export class ConfirmationDialogAssertion extends BaseAssertion {
   readonly confirmationDialog: ConfirmationDialog;
@@ -12,18 +11,18 @@ export class ConfirmationDialogAssertion extends BaseAssertion {
   }
 
   public async assertConfirmationDialogTitle(expectedTitle: string) {
-    expect
-      .soft(
-        await this.confirmationDialog.entityName.getElementInnerContent(),
-        ExpectedMessages.modalDialogTitleIsValid,
-      )
-      .toBe(expectedTitle);
+    await this.assertElementText(
+      this.confirmationDialog.entityName,
+      expectedTitle,
+      ExpectedMessages.modalDialogTitleIsValid,
+    );
   }
 
   public async assertConfirmationMessage(expectedMessage: string) {
     await this.assertElementText(
       this.confirmationDialog.confirmMessage,
       expectedMessage,
+      ExpectedMessages.confirmationMessageIsValid,
     );
   }
 }
diff --git a/apps/chat-e2e/src/assertions/toastAssertion.ts b/apps/chat-e2e/src/assertions/toastAssertion.ts
index 934c996ca9..b00217b67a 100644
--- a/apps/chat-e2e/src/assertions/toastAssertion.ts
+++ b/apps/chat-e2e/src/assertions/toastAssertion.ts
@@ -1,12 +1,14 @@
+import { BaseAssertion } from '@/src/assertions/base/baseAssertion';
 import { ExpectedMessages } from '@/src/testData';
 // Import other types if needed
 import { Toast } from '@/src/ui/webElements';
 import { expect } from '@playwright/test';
 
-export class ToastAssertion {
+export class ToastAssertion extends BaseAssertion {
   readonly toast: Toast;
 
   constructor(toast: Toast) {
+    super();
     this.toast = toast;
   }
 
@@ -27,9 +29,8 @@ export class ToastAssertion {
 
   public async assertToastMessage(
     expectedMessage: string,
-    messageType: ExpectedMessages,
+    messageType?: ExpectedMessages,
   ) {
-    const errorMessage = await this.toast.getElementContent();
-    expect.soft(errorMessage, messageType).toBe(expectedMessage);
+    await this.assertElementText(this.toast, expectedMessage, messageType);
   }
 }
diff --git a/apps/chat-e2e/src/core/dialFixtures.ts b/apps/chat-e2e/src/core/dialFixtures.ts
index 7dd2e2fb69..0fec809b77 100644
--- a/apps/chat-e2e/src/core/dialFixtures.ts
+++ b/apps/chat-e2e/src/core/dialFixtures.ts
@@ -144,6 +144,7 @@ import { Tooltip } from '@/src/ui/webElements/tooltip';
 import { UploadFromDeviceModal } from '@/src/ui/webElements/uploadFromDeviceModal';
 import { VariableModalDialog } from '@/src/ui/webElements/variableModalDialog';
 import { BucketUtil } from '@/src/utils';
+import { CustomApplicationPublishingUtil } from '@/src/utils/customApplicationPublishingUtil';
 import path from 'path';
 import { APIRequestContext } from 'playwright-core';
 import * as process from 'process';
@@ -335,6 +336,7 @@ const dialTest = test.extend<{
   promptPreviewModalAssertion: PromptPreviewModalAssertion;
   agentDetailsModalAssertion: AgentDetailsModalAssertion;
   attachAllFilesTreeAssertion: EntityTreeAssertion<AttachFilesTree>;
+  adminCustomApplicationPublishingUtil: CustomApplicationPublishingUtil;
 }>({
   beforeTestCleanup: [
     async ({ dataInjector, fileApiHelper }, use) => {
@@ -1265,6 +1267,24 @@ const dialTest = test.extend<{
       );
     await use(attachAllFilesTreeAssertion);
   },
+  adminCustomApplicationPublishingUtil: async (
+    {
+      customApplicationBuilder,
+      publishRequestBuilder,
+      adminApplicationApiHelper,
+      adminPublicationApiHelper,
+    },
+    use,
+  ) => {
+    const adminCustomApplicationPublishingUtil =
+      new CustomApplicationPublishingUtil(
+        customApplicationBuilder,
+        adminApplicationApiHelper,
+        publishRequestBuilder,
+        adminPublicationApiHelper,
+      );
+    await use(adminCustomApplicationPublishingUtil);
+  },
 });
 
 export default dialTest;
diff --git a/apps/chat-e2e/src/testData/expectedConstants.ts b/apps/chat-e2e/src/testData/expectedConstants.ts
index f78680dd37..17409cfc09 100644
--- a/apps/chat-e2e/src/testData/expectedConstants.ts
+++ b/apps/chat-e2e/src/testData/expectedConstants.ts
@@ -228,7 +228,12 @@ export const ExpectedConstants = {
     'No results found in My workspace. Look at suggested results from DIAL Marketplace.',
   noMarketplaceAgentsFoundMessage: `Sorry, we couldn't find any results for your search.`,
   versionPrefix: 'Version: ',
+  addToMyWorkspaceTooltip: 'Add to My workspace',
+  removeFromMyWorkspaceTooltip: 'Remove from My workspace',
   agentAddedToWorkspaceMessage: 'The agent added to my workspace',
+  removeAgentModalTitle: 'Confirm removing agent',
+  removeAgentModalMessage: (name: string) =>
+    `Are you sure you want to remove ${name} from My workspace?`,
   agentNotFoundError: 'Agent by this link not found',
   copiedLinkText: 'Copied!',
   copyLinkText: 'Copy link',
diff --git a/apps/chat-e2e/src/tests/bookmarkAgent.test.ts b/apps/chat-e2e/src/tests/bookmarkAgent.test.ts
new file mode 100644
index 0000000000..172a672aae
--- /dev/null
+++ b/apps/chat-e2e/src/tests/bookmarkAgent.test.ts
@@ -0,0 +1,637 @@
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { CustomAppAttributes } from '@/src/utils/customApplicationPublishingUtil';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    marketplaceAgentsAssertion,
+    adminCustomApplicationPublishingUtil,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let recentNames: string[];
+    let recentVersions: string[];
+    const appName = GeneratorUtil.randomApplicationName();
+    let appFirstVersion: CustomAppAttributes;
+    let appSecondVersion: CustomAppAttributes;
+    let appThirdVersion: CustomAppAttributes;
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        recentVersions = ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        appFirstVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+          );
+        appSecondVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+            ...appFirstVersion.version,
+          );
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          appFirstVersion.version,
+          appSecondVersion.version,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        appThirdVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+            ...appFirstVersion.version,
+            ...appSecondVersion.version,
+          );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        sortedVersions = SortingUtil.sortVersionsArray([
+          appFirstVersion.version,
+          appSecondVersion.version,
+          appThirdVersion.version,
+        ]);
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        marketplaceAgentsAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        marketplaceAgentsAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    marketplaceAgentsAssertion,
+    adminCustomApplicationPublishingUtil,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+        const appFirstVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+          );
+        const appSecondVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+            ...appFirstVersion.version,
+          );
+        sortedVersions = SortingUtil.sortVersionsArray([
+          appFirstVersion.version,
+          appSecondVersion.version,
+        ]);
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+    adminCustomApplicationPublishingUtil,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+        const appFirstVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+          );
+        const appSecondVersion =
+          await adminCustomApplicationPublishingUtil.publishApplicationWithVersion(
+            appName,
+            ...recentNames,
+            ...recentVersions,
+            ...appFirstVersion.version,
+          );
+        sortedVersions = SortingUtil.sortVersionsArray([
+          appFirstVersion.version,
+          appSecondVersion.version,
+        ]);
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const removeBookmarkIconElement = agentDetailsModal.removeBookmarkIcon;
+        await removeBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify confirmation modal is shown',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify agent is displayed in the suggested list',
+      async () => {
+        await agentDetailsModal.removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        const agentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          { isWorkspaceAgent: false },
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentElement),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(agentElement),
+          'hidden',
+        );
+      },
+    );
+  },
+);
diff --git a/apps/chat-e2e/src/tests/marketplaceSearch.test.ts b/apps/chat-e2e/src/tests/marketplaceSearch.test.ts
index 9efff48773..1f39ee4a22 100644
--- a/apps/chat-e2e/src/tests/marketplaceSearch.test.ts
+++ b/apps/chat-e2e/src/tests/marketplaceSearch.test.ts
@@ -11,7 +11,7 @@ import {
 } from '@/src/testData';
 import { Attributes, ThemeColorAttributes } from '@/src/ui/domData';
 import { keys } from '@/src/ui/keyboard';
-import { MarketplaceAgentProperties } from '@/src/ui/webElements';
+import { BaseElement, MarketplaceAgentProperties } from '@/src/ui/webElements';
 import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
 import { ThemesUtil } from '@/src/utils/themesUtil';
 import { PublishActions } from '@epam/ai-dial-shared';
@@ -505,7 +505,9 @@ dialTest(
 );
 
 dialTest(
-  'Search in DIAL Marketplace: Search word and other filters work together type and topics',
+  'Search in DIAL Marketplace: Search word and other filters work together type and topics.\n' +
+    '[Card view] Not published my custom application does not have bookmark icon.\n' +
+    '[Detailed card view] Not published my custom application does not have bookmark icon',
   async ({
     customApplicationBuilder,
     applicationApiHelper,
@@ -513,14 +515,18 @@ dialTest(
     marketplaceFilter,
     marketplaceHeader,
     marketplaceAgentsSection,
+    marketplaceAgents,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
     setTestIds,
     baseAssertion,
   }) => {
-    setTestIds('EPMRTC-4425');
+    setTestIds('EPMRTC-4425', 'EPMRTC-4610', 'EPMRTC-4609');
     const firstAppName = GeneratorUtil.randomApplicationName();
     const secondAppName = GeneratorUtil.randomApplicationName();
     const thirdAppName = GeneratorUtil.randomApplicationName();
     const appTopic = GeneratorUtil.randomString(5);
+    let actualAgent: BaseElement;
 
     await dialTest.step(
       'Prepare three custom applications, two of them have a common topic',
@@ -609,6 +615,37 @@ dialTest(
         );
       },
     );
+
+    await dialTest.step(
+      'Verify custom app does not have bookmark icon',
+      async () => {
+        actualAgent =
+          await marketplaceAgentsSection.findAgentElement(firstAppName);
+        await baseAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(actualAgent),
+          'hidden',
+        );
+        await baseAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(actualAgent),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open app card and verify it does not have bookmark icon',
+      async () => {
+        await actualAgent.click();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'hidden',
+        );
+      },
+    );
   },
 );
 
diff --git a/apps/chat-e2e/src/ui/webElements/marketplace/agentDetailsModal.ts b/apps/chat-e2e/src/ui/webElements/marketplace/agentDetailsModal.ts
index 421b675f81..3c36a3ae48 100644
--- a/apps/chat-e2e/src/ui/webElements/marketplace/agentDetailsModal.ts
+++ b/apps/chat-e2e/src/ui/webElements/marketplace/agentDetailsModal.ts
@@ -1,5 +1,6 @@
 import { isApiStorageType } from '@/src/hooks/global-setup';
 import { API } from '@/src/testData';
+import { Tags } from '@/src/ui/domData';
 import { IconSelectors, MarketplaceAgentSelectors } from '@/src/ui/selectors';
 import { MarketplaceDetailsModal } from '@/src/ui/selectors/marketplaceSelectors';
 import { BaseElement } from '@/src/ui/webElements';
@@ -43,10 +44,10 @@ export class AgentDetailsModal extends BaseElement {
   );
   public addBookmarkIcon = this.getChildElementBySelector(
     MarketplaceAgentSelectors.addBookmarkIcon,
-  );
+  ).getChildElementBySelector(Tags.svg);
   public removeBookmarkIcon = this.getChildElementBySelector(
     MarketplaceAgentSelectors.removeBookmarkIcon,
-  );
+  ).getChildElementBySelector(Tags.svg);
   public copyLink = this.getChildElementBySelector(
     MarketplaceAgentSelectors.copyLink,
   );
@@ -90,6 +91,7 @@ export class AgentDetailsModal extends BaseElement {
     } else {
       await this.useButton.click();
     }
+    await this.waitForState({ state: 'hidden' });
   }
 
   public async addAgentToWorkspace() {
diff --git a/apps/chat-e2e/src/ui/webElements/marketplace/marketplaceAgents.ts b/apps/chat-e2e/src/ui/webElements/marketplace/marketplaceAgents.ts
index 816cdd4cb0..1564f5fe16 100644
--- a/apps/chat-e2e/src/ui/webElements/marketplace/marketplaceAgents.ts
+++ b/apps/chat-e2e/src/ui/webElements/marketplace/marketplaceAgents.ts
@@ -133,15 +133,15 @@ export class MarketplaceAgents extends BaseElement {
   }
 
   public getAgentElementAddBookmarkIcon(agentElement: BaseElement) {
-    return agentElement.getChildElementBySelector(
-      MarketplaceAgentSelectors.addBookmarkIcon,
-    );
+    return agentElement
+      .getChildElementBySelector(MarketplaceAgentSelectors.addBookmarkIcon)
+      .getChildElementBySelector(Tags.svg);
   }
 
   public getAgentElementRemoveBookmarkIcon(agentElement: BaseElement) {
-    return agentElement.getChildElementBySelector(
-      MarketplaceAgentSelectors.removeBookmarkIcon,
-    );
+    return agentElement
+      .getChildElementBySelector(MarketplaceAgentSelectors.removeBookmarkIcon)
+      .getChildElementBySelector(Tags.svg);
   }
 
   public async agentWithVersionToSet(entity: DialAIEntityModel) {
diff --git a/apps/chat-e2e/src/utils/customApplicationPublishingUtil.ts b/apps/chat-e2e/src/utils/customApplicationPublishingUtil.ts
new file mode 100644
index 0000000000..2fe37130df
--- /dev/null
+++ b/apps/chat-e2e/src/utils/customApplicationPublishingUtil.ts
@@ -0,0 +1,54 @@
+import {
+  CustomApplicationBuilder,
+  PublishRequestBuilder,
+} from '@/src/testData';
+import { ApplicationApiHelper, PublicationApiHelper } from '@/src/testData/api';
+import { GeneratorUtil } from '@/src/utils/generatorUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+export interface CustomAppAttributes {
+  name: string;
+  version: string;
+}
+
+export class CustomApplicationPublishingUtil {
+  private customApplicationBuilder: CustomApplicationBuilder;
+  private applicationApiHelper: ApplicationApiHelper;
+  private publishRequestBuilder: PublishRequestBuilder;
+  private publicationApiHelper: PublicationApiHelper;
+
+  constructor(
+    customApplicationBuilder: CustomApplicationBuilder,
+    applicationApiHelper: ApplicationApiHelper,
+    publishRequestBuilder: PublishRequestBuilder,
+    publicationApiHelper: PublicationApiHelper,
+  ) {
+    this.customApplicationBuilder = customApplicationBuilder;
+    this.applicationApiHelper = applicationApiHelper;
+    this.publishRequestBuilder = publishRequestBuilder;
+    this.publicationApiHelper = publicationApiHelper;
+  }
+
+  public async publishApplicationWithVersion(
+    appName?: string,
+    ...namesToExclude: string[]
+  ): Promise<CustomAppAttributes> {
+    appName = appName ?? GeneratorUtil.randomApplicationName();
+    const appVersion = GeneratorUtil.randomApplicationVersion(namesToExclude);
+    const applicationWithVersionModel = this.customApplicationBuilder
+      .withDisplayName(appName)
+      .withDisplayVersion(appVersion)
+      .build();
+    const app = await this.applicationApiHelper.createApplication(
+      applicationWithVersionModel,
+    );
+    const publishRequest = this.publishRequestBuilder
+      .withName(GeneratorUtil.randomPublicationRequestName())
+      .withApplicationResource(app, PublishActions.ADD)
+      .build();
+    const appPublication =
+      await this.publicationApiHelper.createPublishRequest(publishRequest);
+    await this.publicationApiHelper.approveRequest(appPublication);
+    return { name: appName, version: appVersion };
+  }
+}


Reviews:
user: login: nartovm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-15T16:53:04Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T08:28:20Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T08:30:21Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T08:40:23Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T08:41:18Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T08:49:22Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T08:50:06Z
user: login: irinakartun
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T10:43:26Z
user: login: nartovm
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-16T10:56:11Z

Review comments:
diff_hunk: @@ -27,9 +29,8 @@ export class ToastAssertion {
 
   public async assertToastMessage(
     expectedMessage: string,
-    messageType: ExpectedMessages,
+    messageType?: ExpectedMessages,
   ) {
-    const errorMessage = await this.toast.getElementContent();
-    expect.soft(errorMessage, messageType).toBe(expectedMessage);
+    await super.assertElementText(this.toast, expectedMessage, messageType);
path: apps/chat-e2e/src/assertions/toastAssertion.ts
user: login: nartovm
body: better use `this.assertElementText` I assume. For the sake of consistency :)
created_at: 2025-05-15T15:07:19Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: nartovm
body: It is a duplicate of 69 lines. Look for the line 499-567. Can you do smth with it?
created_at: 2025-05-15T15:09:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: nartovm
body: Are you sure that this issue will be fixed? Probably, I have missed the discussion...
created_at: 2025-05-15T16:12:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: nartovm
body: I think you can replace these baseAssertions with a new specific one that checks the presence of the agent in the suggested list 
created_at: 2025-05-15T16:17:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: nartovm
body: Probably you need to add the check for the presence of app versions in the dropdown menu itself, not by selecting them?
created_at: 2025-05-15T16:38:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const removeBookmarkIconElement = agentDetailsModal.removeBookmarkIcon;
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: nartovm
body: why do we need this const? 
created_at: 2025-05-15T16:51:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const removeBookmarkIconElement = agentDetailsModal.removeBookmarkIcon;
+        await removeBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify confirmation modal is shown',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: nartovm
body: Isn't that a duplicate of the code that strats with the line 248?
created_at: 2025-05-15T16:52:21Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: irinakartun
body: @VolhaBazhkova confirmed it need to be fixed, see TC EPMRTC-5937.


created_at: 2025-05-16T08:28:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: irinakartun
body: done
created_at: 2025-05-16T08:30:21Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: irinakartun
body: this verification is implicitly done in the following lines:

```
await agentDetailsModalAssertion.assertApplicationVersion(
          sortedVersions[0],
        );
await agentDetailsModalAssertion.assertApplicationVersion(
          sortedVersions[1],
        );
```
created_at: 2025-05-16T08:40:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const removeBookmarkIconElement = agentDetailsModal.removeBookmarkIcon;
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: irinakartun
body: to avoid duplicates
created_at: 2025-05-16T08:41:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let addedAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Click on "Use application" btn, return to the "My workspace" and verify bookmarked app is displayed in the list',
+      async () => {
+        await agentDetailsModal.clickUseButton({
+          isInstalledDeploymentsUpdated: true,
+        });
+        await dialHomePage.waitForPageLoaded({ skipSidebars: true });
+        await dialHomePage.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        addedAgentElement = await marketplaceAgentsSection.findAgentElement(
+          appName,
+          {
+            isWorkspaceAgent: true,
+          },
+        );
+
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent card and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await addedAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using bookmark.\n' +
+    '[Detailed card view] Bookmark icon highlight and tooltips (add and remove).\n' +
+    '[Detailed card view] Remove an agent from My workspace using bookmark',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    tooltipAssertion,
+    toast,
+    toastAssertion,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    confirmationDialog,
+    marketplaceAgentsAssertion,
+    confirmationDialogAssertion,
+    baseAssertion,
+  }) => {
+    setTestIds('EPMRTC-4603', 'EPMRTC-5930', 'EPMRTC-4606');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent and open the card',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await agentToAddElement.click();
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const addBookmarkIconElement = agentDetailsModal.addBookmarkIcon;
+        await addBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.addAgentToWorkspace();
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.addBookmarkIcon,
+          'hidden',
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          sortedVersions[0],
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify all versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[1],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over bookmark icon and verify tooltip is shown, icon is highlighted, cursor is changed',
+      async () => {
+        const removeBookmarkIconElement = agentDetailsModal.removeBookmarkIcon;
+        await removeBookmarkIconElement.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIconElement,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIconElement,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Change the version, click on bookmark icon and verify confirmation modal is shown',
+      async () => {
+        await agentDetailsModal.versionMenuTrigger.click();
+        await agentDetailsModal
+          .getVersionDropdownMenu()
+          .selectMenuOption(sortedVersions[1]);
+        await agentDetailsModal.removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: irinakartun
body: no, in the current test the bookmark is placed within the `agentDetailsModal` element. 
In the line 248  the bookmark is clicked while being in the list of marketplace agnents
created_at: 2025-05-16T08:49:22Z
author_association: CONTRIBUTOR
diff_hunk: @@ -27,9 +29,8 @@ export class ToastAssertion {
 
   public async assertToastMessage(
     expectedMessage: string,
-    messageType: ExpectedMessages,
+    messageType?: ExpectedMessages,
   ) {
-    const errorMessage = await this.toast.getElementContent();
-    expect.soft(errorMessage, messageType).toBe(expectedMessage);
+    await super.assertElementText(this.toast, expectedMessage, messageType);
path: apps/chat-e2e/src/assertions/toastAssertion.ts
user: login: irinakartun
body: done
created_at: 2025-05-16T08:50:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,745 @@
+import { Publication } from '@/chat/types/publication';
+import dialTest from '@/src/core/dialFixtures';
+import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
+import { Cursors, ThemeColorAttributes } from '@/src/ui/domData';
+import { BaseElement } from '@/src/ui/webElements';
+import { GeneratorUtil, ModelsUtil, SortingUtil } from '@/src/utils';
+import { ThemesUtil } from '@/src/utils/themesUtil';
+import { PublishActions } from '@epam/ai-dial-shared';
+
+const publicationsToUnpublish: Publication[] = [];
+
+dialTest(
+  '[Card view] Add an agent with several versions to My workspace using bookmark icon.\n' +
+    '[Card view] New version of published app becomes automatically bookmarked if the app is in My workspace.\n' +
+    '[Card view] Remove an agent with several versions from My workspace using bookmark icon.\n' +
+    '[Card view] Bookmark icon highlight and tooltips (add and remove)',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    navigationPanel,
+    agentDetailsModal,
+    confirmationDialog,
+    agentDetailsModalAssertion,
+    confirmationDialogAssertion,
+    localStorageManager,
+    setTestIds,
+    baseAssertion,
+    customApplicationBuilder,
+    toast,
+    tooltipAssertion,
+    toastAssertion,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4602', 'EPMRTC-5937', 'EPMRTC-4605', 'EPMRTC-5929');
+    let firstAppVersion: string;
+    let secondAppVersion: string;
+    let thirdAppVersion: string;
+    const appName = GeneratorUtil.randomApplicationName();
+    let sortedVersions: string[];
+    let agentToAddElement: BaseElement;
+    let workspaceAgentElement: BaseElement;
+    let marketplaceAgentElement: BaseElement;
+    let removeBookmarkIcon: BaseElement;
+
+    await dialTest.step(
+      'Prepare an application with two versions available in the "Marketplace"',
+      async () => {
+        const recentModelIds = await localStorageManager.getRecentModelsIds();
+        const recentNames = ModelsUtil.getRecentAgentsNames(recentModelIds);
+        const recentVersions =
+          ModelsUtil.getRecentAgentsVersions(recentModelIds);
+
+        firstAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+        ]);
+        secondAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+        ]);
+        thirdAppVersion = GeneratorUtil.randomApplicationVersion([
+          ...recentNames,
+          ...recentVersions,
+          firstAppVersion,
+          secondAppVersion,
+        ]);
+        sortedVersions = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+          thirdAppVersion,
+        ]);
+
+        const applicationFirstVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(firstAppVersion)
+          .build();
+        const applicationSecondVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(secondAppVersion)
+          .build();
+
+        for (const appModel of [
+          applicationFirstVersionModel,
+          applicationSecondVersionModel,
+        ]) {
+          const app =
+            await adminApplicationApiHelper.createApplication(appModel);
+          const publishRequest = publishRequestBuilder
+            .withName(GeneratorUtil.randomPublicationRequestName())
+            .withApplicationResource(app, PublishActions.ADD)
+            .build();
+          const appPublication =
+            await adminPublicationApiHelper.createPublishRequest(
+              publishRequest,
+            );
+          publicationsToUnpublish.push(appPublication);
+          await adminPublicationApiHelper.approveRequest(appPublication);
+        }
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, hover over bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await marketplacePage.openMarketplacePage();
+        await marketplacePage.waitForPageLoaded();
+        await marketplaceHeader.searchInput.fillInInput(appName);
+        agentToAddElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const addBookmarkIcon =
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement);
+        await addBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.addToMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          addBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          addBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Click on bookmark icon and verify toast message is shown, bookmark icon is changed',
+      async () => {
+        await marketplaceAgents.addAgentToWorkspace(agentToAddElement);
+        await toastAssertion.assertToastMessage(
+          ExpectedConstants.agentAddedToWorkspaceMessage,
+        );
+        await toast.closeToast();
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            agentToAddElement,
+          ),
+          'visible',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(agentToAddElement),
+          'hidden',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go to the "My Workspace" tab and verify agent card with the latest version is displayed',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        workspaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        const latestVersion = SortingUtil.sortVersionsArray([
+          firstAppVersion,
+          secondAppVersion,
+        ])[0];
+        await marketplaceAgentsAssertion.assertElementText(
+          marketplaceAgents.getAgentVersion(workspaceAgentElement),
+          latestVersion,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Publish one more version of custom application',
+      async () => {
+        const applicationThirdVersionModel = customApplicationBuilder
+          .withDisplayName(appName)
+          .withDisplayVersion(thirdAppVersion)
+          .build();
+        const app = await adminApplicationApiHelper.createApplication(
+          applicationThirdVersionModel,
+        );
+        const publishRequest = publishRequestBuilder
+          .withName(GeneratorUtil.randomPublicationRequestName())
+          .withApplicationResource(app, PublishActions.ADD)
+          .build();
+        const appPublication =
+          await adminPublicationApiHelper.createPublishRequest(publishRequest);
+        publicationsToUnpublish.push(appPublication);
+        await adminPublicationApiHelper.approveRequest(appPublication);
+      },
+    );
+
+    await dialTest.step(
+      'Open the agent and verify three versions are available in the dropdown menu, bookmark icon is shown on version switching',
+      async () => {
+        //TODO: remove page refresh after the issue fixed https://github.com/epam/ai-dial-chat/issues/3693
+        await marketplacePage.reloadPage();
+        await marketplacePage.waitForPageLoaded();
+        await workspaceAgentElement.click();
+        await agentDetailsModalAssertion.assertApplicationVersion(
+          sortedVersions[0],
+        );
+        await agentDetailsModalAssertion.assertElementState(
+          agentDetailsModal.removeBookmarkIcon,
+          'visible',
+        );
+        for (const version of [sortedVersions[1], sortedVersions[2]]) {
+          await agentDetailsModal.versionMenuTrigger.click();
+          await agentDetailsModal
+            .getVersionDropdownMenu()
+            .selectMenuOption(version);
+          await agentDetailsModalAssertion.assertApplicationVersion(version);
+          await agentDetailsModalAssertion.assertElementState(
+            agentDetailsModal.removeBookmarkIcon,
+            'visible',
+          );
+        }
+        await agentDetailsModal.closeButton.click();
+      },
+    );
+
+    await dialTest.step(
+      'On the "Marketplace" tab search created agent, click on bookmark icon and verify confirmation popup is shown',
+      async () => {
+        await navigationPanel.goToMarketplaceHome();
+        await marketplacePage.waitForPageLoaded();
+        marketplaceAgentElement =
+          await marketplaceAgentsSection.findAgentElement(appName);
+        removeBookmarkIcon =
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          );
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialogAssertion.assertConfirmationDialogTitle(
+          ExpectedConstants.removeAgentModalTitle,
+        );
+        await confirmationDialogAssertion.assertConfirmationMessage(
+          ExpectedConstants.removeAgentModalMessage(appName),
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Cancel removing and verify confirmation popup is closed, remove bookmark icon is displayed',
+      async () => {
+        await confirmationDialog.cancelDialog();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementRemoveBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Hover over remove bookmark icon and verify tooltip is shown, icon is highlighted',
+      async () => {
+        await removeBookmarkIcon.hoverOver();
+        await tooltipAssertion.assertTooltipContent(
+          ExpectedConstants.removeFromMyWorkspaceTooltip,
+        );
+        await marketplaceAgentsAssertion.assertElementBorderColors(
+          removeBookmarkIcon,
+          ThemesUtil.getRgbColorByKey(ThemeColorAttributes.textAccentPrimary),
+        );
+        await marketplaceAgentsAssertion.assertElementCursor(
+          removeBookmarkIcon,
+          Cursors.pointer,
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Confirm agent removing and verify add bookmark icon is displayed',
+      async () => {
+        await removeBookmarkIcon.click();
+        await confirmationDialogAssertion.assertElementState(
+          confirmationDialog,
+          'visible',
+        );
+        await confirmationDialog.confirm({ triggeredHttpMethod: 'PUT' });
+        await marketplaceAgentsAssertion.assertElementState(
+          removeBookmarkIcon,
+          'hidden',
+        );
+        await marketplaceAgentsAssertion.assertElementState(
+          marketplaceAgents.getAgentElementAddBookmarkIcon(
+            marketplaceAgentElement,
+          ),
+          'visible',
+        );
+      },
+    );
+
+    await dialTest.step(
+      'Go on the "Marketplace" tab and verify agent is displayed in the suggested list',
+      async () => {
+        await navigationPanel.goToMyWorkspace();
+        await marketplacePage.waitForPageLoaded();
+        const allAgents = await marketplaceAgentsSection.getAllAgents();
+        baseAssertion.assertValue(
+          allAgents.filter((agent) => agent.isWorkspaceAgent).length,
+          0,
+          ExpectedMessages.elementsCountIsValid,
+        );
+        baseAssertion.assertValue(
+          allAgents.filter(
+            (agent) => agent.isSuggested && agent.name === appName,
+          ).length,
+          1,
+          ExpectedMessages.elementsCountIsValid,
+        );
+      },
+    );
+  },
+);
+
+dialTest(
+  '[Detailed card view] Add an agent to My workspace using "Use ..." button',
+  async ({
+    marketplacePage,
+    marketplaceHeader,
+    marketplaceAgentsSection,
+    marketplaceAgents,
+    dialHomePage,
+    agentDetailsModal,
+    agentDetailsModalAssertion,
+    localStorageManager,
+    setTestIds,
+    customApplicationBuilder,
+    adminApplicationApiHelper,
+    adminPublicationApiHelper,
+    publishRequestBuilder,
+    marketplaceAgentsAssertion,
+  }) => {
+    setTestIds('EPMRTC-4465');
+    let firstAppVersion: string;
path: apps/chat-e2e/src/tests/bookmarkAgent.test.ts
user: login: irinakartun
body: fixed
created_at: 2025-05-16T10:43:26Z
author_association: CONTRIBUTOR

PR comments:
user: login: irinakartun
created_at: 2025-05-13T14:45:54Z
body: /deploy-review
>Environment: [review-environment](https://chat-ai-dial-chat-pr-3821.nightly-test.deltixhub.io) | [pipeline](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/pipelines/609401)
>Overlay E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1846939)
>Chat E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1846938)
author_association: CONTRIBUTOR
user: login: irinakartun
created_at: 2025-05-14T09:14:54Z
body: /deploy-review
>Environment: [review-environment](https://chat-ai-dial-chat-pr-3821.nightly-test.deltixhub.io) | [pipeline](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/pipelines/609763)
>Overlay E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1849040)
>Chat E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1849039)
author_association: CONTRIBUTOR
user: login: irinakartun
created_at: 2025-05-14T09:40:33Z
body: /deploy-review
>Environment: [review-environment](https://chat-ai-dial-chat-pr-3821.nightly-test.deltixhub.io) | [pipeline](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/pipelines/609797)
>Overlay E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1849237)
>Chat E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1849236)
author_association: CONTRIBUTOR
user: login: irinakartun
created_at: 2025-05-16T07:04:05Z
body: /deploy-review
>Environment: [review-environment](https://chat-ai-dial-chat-pr-3821.nightly-test.deltixhub.io) | [pipeline](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/pipelines/611193)
>Overlay E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1855792)
>Chat E2E tests status: [failed](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1855791)
author_association: CONTRIBUTOR
user: login: irinakartun
created_at: 2025-05-16T10:54:59Z
body: /deploy-review
>Environment: [review-environment](https://chat-ai-dial-chat-pr-3821.nightly-test.deltixhub.io) | [pipeline](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/pipelines/611431)
>Chat E2E tests status: [canceled](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1856998)
>Overlay E2E tests status: [failed](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1856999)
author_association: CONTRIBUTOR
user: login: irinakartun
created_at: 2025-05-16T11:11:26Z
body: /deploy-review
>Environment: [review-environment](https://chat-ai-dial-chat-pr-3821.nightly-test.deltixhub.io) | [pipeline](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/pipelines/611451)
>Overlay E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1857127)
>Chat E2E tests status: [success](https://gitlab.deltixhub.com/Clients/deltix/nightly-test/dial/review/-/jobs/1857126)
author_association: CONTRIBUTOR