diff --git a/apps/chat-e2e/src/assertions/conversationAssertion.ts b/apps/chat-e2e/src/assertions/conversationAssertion.ts index 0b3c362ceb..ee35eb733f 100644 --- a/apps/chat-e2e/src/assertions/conversationAssertion.ts +++ b/apps/chat-e2e/src/assertions/conversationAssertion.ts @@ -6,15 +6,15 @@ import { TreeEntity, } from '@/src/testData'; import { Colors, Styles } from '@/src/ui/domData'; -import { Conversations } from '@/src/ui/webElements'; +import { ConversationsTree } from '@/src/ui/webElements/entityTree'; import { expect } from '@playwright/test'; -export class ConversationAssertion extends SideBarEntityAssertion { +export class ConversationAssertion extends SideBarEntityAssertion { public async assertReplayIconState( entity: TreeEntity, expectedState: ElementState, ) { - const entityIcon = this.sideBarEntities.getConversationReplayIcon( + const entityIcon = this.sideBarEntitiesTree.getEntityReplayIcon( entity.name, entity.index, ); @@ -31,9 +31,9 @@ export class ConversationAssertion extends SideBarEntityAssertion conversationName: string, expectedCursor: string, ) { - await this.sideBarEntities.getEntityByName(conversationName).hover(); - const style = await this.sideBarEntities - .getConversationName(conversationName) + await this.sideBarEntitiesTree.getEntityByName(conversationName).hover(); + const style = await this.sideBarEntitiesTree + .getEntityName(conversationName) .getComputedStyleProperty(Styles.cursor); expect .soft(style[0], `Conversation cursor is ${expectedCursor}`) @@ -42,7 +42,7 @@ export class ConversationAssertion extends SideBarEntityAssertion public async assertSelectedConversation(conversationName: string) { const conversationBackgroundColor = - await this.sideBarEntities.getEntityBackgroundColor(conversationName); + await this.sideBarEntitiesTree.getEntityBackgroundColor(conversationName); expect .soft(conversationBackgroundColor, 'Conversation is selected') .toBe(Colors.backgroundAccentSecondary); @@ -50,7 +50,9 @@ export class ConversationAssertion extends SideBarEntityAssertion public async assertConversationInToday(conversationName: string) { const todayConversations = - await this.sideBarEntities.getChronologyConversations(Chronology.today); + await this.sideBarEntitiesTree.getChronologyConversations( + Chronology.today, + ); expect(todayConversations, ExpectedMessages.conversationOfToday).toContain( conversationName, ); diff --git a/apps/chat-e2e/src/assertions/folderAssertion.ts b/apps/chat-e2e/src/assertions/folderAssertion.ts index a51c54a1ae..e99463fc7b 100644 --- a/apps/chat-e2e/src/assertions/folderAssertion.ts +++ b/apps/chat-e2e/src/assertions/folderAssertion.ts @@ -1,6 +1,6 @@ import { CheckboxState, ElementState, ExpectedMessages } from '@/src/testData'; import { EntityType, TreeEntity } from '@/src/testData/types'; -import { Folders } from '@/src/ui/webElements'; +import { Folders } from '@/src/ui/webElements/entityTree'; import { ThemesUtil } from '@/src/utils/themesUtil'; import { expect } from '@playwright/test'; diff --git a/apps/chat-e2e/src/assertions/promptAssertion.ts b/apps/chat-e2e/src/assertions/promptAssertion.ts index 4edfcf299b..b31dc7bec0 100644 --- a/apps/chat-e2e/src/assertions/promptAssertion.ts +++ b/apps/chat-e2e/src/assertions/promptAssertion.ts @@ -1,4 +1,4 @@ import { SideBarEntityAssertion } from '@/src/assertions/sideBarEntityAssertion'; -import { Prompts } from '@/src/ui/webElements'; +import { PromptsTree } from '@/src/ui/webElements/entityTree'; -export class PromptAssertion extends SideBarEntityAssertion {} +export class PromptAssertion extends SideBarEntityAssertion {} diff --git a/apps/chat-e2e/src/assertions/sharedWithMePromptsAssertion.ts b/apps/chat-e2e/src/assertions/sharedWithMePromptsAssertion.ts index de2f61db09..eff448211e 100644 --- a/apps/chat-e2e/src/assertions/sharedWithMePromptsAssertion.ts +++ b/apps/chat-e2e/src/assertions/sharedWithMePromptsAssertion.ts @@ -1,15 +1,15 @@ import { SideBarEntityAssertion } from '@/src/assertions/sideBarEntityAssertion'; import { ExpectedMessages, TreeEntity } from '@/src/testData'; -import { SharedWithMePrompts } from '@/src/ui/webElements'; +import { SharedWithMePromptsTree } from '@/src/ui/webElements/entityTree'; import { expect } from '@playwright/test'; -export class SharedWithMePromptsAssertion extends SideBarEntityAssertion { +export class SharedWithMePromptsAssertion extends SideBarEntityAssertion { public async assertSharedEntityBackgroundColor( entity: TreeEntity, expectedColor: string, ) { const entityBackgroundColor = - await this.sideBarEntities.getSharedPromptBackgroundColor( + await this.sideBarEntitiesTree.getEntityBackgroundColor( entity.name, entity.index, ); diff --git a/apps/chat-e2e/src/assertions/sideBarEntityAssertion.ts b/apps/chat-e2e/src/assertions/sideBarEntityAssertion.ts index 4ec03fe08f..d211352ce3 100644 --- a/apps/chat-e2e/src/assertions/sideBarEntityAssertion.ts +++ b/apps/chat-e2e/src/assertions/sideBarEntityAssertion.ts @@ -5,15 +5,15 @@ import { ExpectedMessages, TreeEntity, } from '@/src/testData'; -import { SideBarEntities } from '@/src/ui/webElements/sideBarEntities'; +import { SideBarEntitiesTree } from '@/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree'; import { ThemesUtil } from '@/src/utils/themesUtil'; import { expect } from '@playwright/test'; -export class SideBarEntityAssertion { - readonly sideBarEntities: T; +export class SideBarEntityAssertion { + readonly sideBarEntitiesTree: T; constructor(sideBarEntities: T) { - this.sideBarEntities = sideBarEntities; + this.sideBarEntitiesTree = sideBarEntities; } public async assertEntityAndCheckboxHasSelectedColors( @@ -32,7 +32,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedState: ElementState, ) { - const entityLocator = this.sideBarEntities.getEntityByName( + const entityLocator = this.sideBarEntitiesTree.getEntityByName( entity.name, entity.index, ); @@ -49,7 +49,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedState: ElementState, ) { - const entityCheckboxLocator = this.sideBarEntities.getEntityCheckbox( + const entityCheckboxLocator = this.sideBarEntitiesTree.getEntityCheckbox( entity.name, entity.index, ); @@ -72,7 +72,7 @@ export class SideBarEntityAssertion { : ExpectedMessages.entityIsNotChecked; expect .soft( - await this.sideBarEntities.getEntityCheckboxState( + await this.sideBarEntitiesTree.getEntityCheckboxState( entity.name, entity.index, ), @@ -85,7 +85,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedState: ElementState, ) { - const dotsMenuLocator = this.sideBarEntities.entityDotsMenu( + const dotsMenuLocator = this.sideBarEntitiesTree.entityDotsMenu( entity.name, entity.index, ); @@ -102,7 +102,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedState: ElementState, ) { - await this.sideBarEntities.getEntityByName(entity.name).hover(); + await this.sideBarEntitiesTree.getEntityByName(entity.name).hover(); await this.assertEntityDotsMenuState( { name: entity.name, @@ -115,7 +115,7 @@ export class SideBarEntityAssertion { expectedColor: string, ) { const entityBackgroundColor = - await this.sideBarEntities.getEntityBackgroundColor( + await this.sideBarEntitiesTree.getEntityBackgroundColor( entity.name, entity.index, ); @@ -131,7 +131,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedColor: string, ) { - const checkboxElement = this.sideBarEntities.getEntityCheckboxElement( + const checkboxElement = this.sideBarEntitiesTree.getEntityCheckboxElement( entity.name, entity.index, ); @@ -145,7 +145,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedColor: string, ) { - const checkboxElement = this.sideBarEntities.getEntityCheckboxElement( + const checkboxElement = this.sideBarEntitiesTree.getEntityCheckboxElement( entity.name, entity.index, ); @@ -161,7 +161,7 @@ export class SideBarEntityAssertion { } public async assertEntityIcon(entity: TreeEntity, expectedIcon: string) { - const entityIcon = await this.sideBarEntities.getEntityIcon( + const entityIcon = await this.sideBarEntitiesTree.getEntityIcon( entity.name, entity.index, ); @@ -174,7 +174,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedState: ElementState, ) { - const arrowIcon = this.sideBarEntities.getEntityArrowIcon( + const arrowIcon = this.sideBarEntitiesTree.getEntityArrowIcon( entity.name, entity.index, ); @@ -191,10 +191,11 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedColor: string, ) { - const arrowIconColor = await this.sideBarEntities.getEntityArrowIconColor( - entity.name, - entity.index, - ); + const arrowIconColor = + await this.sideBarEntitiesTree.getEntityArrowIconColor( + entity.name, + entity.index, + ); expect .soft(arrowIconColor[0], ExpectedMessages.sharedIconColorIsValid) .toBe(expectedColor); @@ -204,7 +205,7 @@ export class SideBarEntityAssertion { entity: TreeEntity, expectedCount: number, ) { - const arrowIconsCount = await this.sideBarEntities + const arrowIconsCount = await this.sideBarEntitiesTree .getEntityArrowIcon(entity.name, entity.index) .count(); expect diff --git a/apps/chat-e2e/src/core/dialFixtures.ts b/apps/chat-e2e/src/core/dialFixtures.ts index 485638951f..f48e86df93 100644 --- a/apps/chat-e2e/src/core/dialFixtures.ts +++ b/apps/chat-e2e/src/core/dialFixtures.ts @@ -9,9 +9,7 @@ import { ChatNotFound, ConversationSettings, ConversationToCompare, - Conversations, EntitySelector, - Folders, MoreInfo, PromptBar, SelectFolderModal, @@ -69,12 +67,16 @@ import { ConfirmationDialog } from '@/src/ui/webElements/confirmationDialog'; import { DropdownCheckboxMenu } from '@/src/ui/webElements/dropdownCheckboxMenu'; import { DropdownMenu } from '@/src/ui/webElements/dropdownMenu'; import { EntitySettings } from '@/src/ui/webElements/entitySettings'; +import { + ConversationsTree, + FolderConversations, + FolderPrompts, + Folders, + PromptsTree, +} from '@/src/ui/webElements/entityTree'; import { ErrorPopup } from '@/src/ui/webElements/errorPopup'; import { ErrorToast } from '@/src/ui/webElements/errorToast'; import { Filter } from '@/src/ui/webElements/filter'; -import { FolderConversations } from '@/src/ui/webElements/folderConversations'; -import { FolderFiles } from '@/src/ui/webElements/folderFiles'; -import { FolderPrompts } from '@/src/ui/webElements/folderPrompts'; import { GroupEntity } from '@/src/ui/webElements/groupEntity'; import { Header } from '@/src/ui/webElements/header'; import { ImportExportLoader } from '@/src/ui/webElements/importExportLoader'; @@ -83,7 +85,7 @@ import { ModelSelector } from '@/src/ui/webElements/modelSelector'; import { ModelsDialog } from '@/src/ui/webElements/modelsDialog'; import { PlaybackControl } from '@/src/ui/webElements/playbackControl'; import { PromptModalDialog } from '@/src/ui/webElements/promptModalDialog'; -import { Prompts } from '@/src/ui/webElements/prompts'; +import { PublishingRequestModal } from '@/src/ui/webElements/publishingRequestModal'; import { RecentEntities } from '@/src/ui/webElements/recentEntities'; import { ReplayAsIs } from '@/src/ui/webElements/replayAsIs'; import { Search } from '@/src/ui/webElements/search'; @@ -125,8 +127,8 @@ const dialTest = test.extend< sendMessage: SendMessage; attachmentDropdownMenu: DropdownMenu; sendMessageInputAttachments: InputAttachments; - conversations: Conversations; - prompts: Prompts; + conversations: ConversationsTree; + prompts: PromptsTree; folderConversations: FolderConversations; folderPrompts: FolderPrompts; conversationSettings: ConversationSettings; @@ -190,9 +192,10 @@ const dialTest = test.extend< attachFilesModal: AttachFilesModal; uploadFromDeviceModal: UploadFromDeviceModal; selectFolderModal: SelectFolderModal; - selectUploadFolder: Folders; - attachedAllFiles: FolderFiles; + selectFolders: Folders; + attachedAllFiles: Folders; settingsModal: SettingsModal; + publishingModal: PublishingRequestModal; conversationAssertion: ConversationAssertion; chatBarFolderAssertion: FolderAssertion; errorToastAssertion: ErrorToastAssertion; @@ -325,11 +328,11 @@ const dialTest = test.extend< await use(sendMessageInputAttachments); }, conversations: async ({ chatBar }, use) => { - const conversations = chatBar.getConversations(); + const conversations = chatBar.getConversationsTree(); await use(conversations); }, prompts: async ({ promptBar }, use) => { - const prompts = promptBar.getPrompts(); + const prompts = promptBar.getPromptsTree(); await use(prompts); }, folderConversations: async ({ chatBar }, use) => { @@ -616,18 +619,22 @@ const dialTest = test.extend< const selectFolderModal = new SelectFolderModal(page); await use(selectFolderModal); }, - selectUploadFolder: async ({ selectFolderModal }, use) => { - const selectUploadFolder = selectFolderModal.getUploadFolder(); + selectFolders: async ({ selectFolderModal }, use) => { + const selectUploadFolder = selectFolderModal.getSelectFolders(); await use(selectUploadFolder); }, attachedAllFiles: async ({ attachFilesModal }, use) => { - const attachedAllFiles = attachFilesModal.getFolderFiles(); + const attachedAllFiles = attachFilesModal.getAllFolderFiles(); await use(attachedAllFiles); }, settingsModal: async ({ page }, use) => { const settingsModal = new SettingsModal(page); await use(settingsModal); }, + publishingModal: async ({ page }, use) => { + const publishingModal = new PublishingRequestModal(page); + await use(publishingModal); + }, conversationAssertion: async ({ conversations }, use) => { const conversationAssertion = new ConversationAssertion(conversations); await use(conversationAssertion); diff --git a/apps/chat-e2e/src/core/dialSharedWithMeFixtures.ts b/apps/chat-e2e/src/core/dialSharedWithMeFixtures.ts index e8c69eb06b..2643226df9 100644 --- a/apps/chat-e2e/src/core/dialSharedWithMeFixtures.ts +++ b/apps/chat-e2e/src/core/dialSharedWithMeFixtures.ts @@ -9,18 +9,14 @@ import { ConfirmationDialog, ConversationSettings, ConversationToCompare, - Conversations, DropdownMenu, EntitySelector, EntitySettings, ErrorToast, - FolderPrompts, PromptBar, PromptModalDialog, - Prompts, RecentEntities, SendMessage, - SharedFolderPrompts, SharedPromptPreviewModal, VariableModalDialog, } from '../ui/webElements'; @@ -41,10 +37,16 @@ import dialTest, { stateFilePath } from '@/src/core/dialFixtures'; import { LocalStorageManager } from '@/src/core/localStorageManager'; import { AppContainer } from '@/src/ui/webElements/appContainer'; import { ChatNotFound } from '@/src/ui/webElements/chatNotFound'; +import { + ConversationsTree, + FolderPrompts, + PromptsTree, + SharedFolderPrompts, +} from '@/src/ui/webElements/entityTree'; +import { SharedFolderConversations } from '@/src/ui/webElements/entityTree/sidebar/sharedFolderConversations'; +import { SharedWithMeConversationsTree } from '@/src/ui/webElements/entityTree/sidebar/sharedWithMeConversationsTree'; +import { SharedWithMePromptsTree } from '@/src/ui/webElements/entityTree/sidebar/sharedWithMePromptsTree'; import { PlaybackControl } from '@/src/ui/webElements/playbackControl'; -import { SharedFolderConversations } from '@/src/ui/webElements/sharedFolderConversations'; -import { SharedWithMeConversations } from '@/src/ui/webElements/sharedWithMeConversations'; -import { SharedWithMePrompts } from '@/src/ui/webElements/sharedWithMePrompts'; import { BucketUtil } from '@/src/utils'; import { Page } from '@playwright/test'; @@ -55,9 +57,9 @@ const dialSharedWithMeTest = dialTest.extend<{ additionalShareUserAppContainer: AppContainer; additionalShareUserChatBar: ChatBar; additionalShareUserPromptBar: PromptBar; - additionalShareUserSharedWithMeConversations: SharedWithMeConversations; + additionalShareUserSharedWithMeConversations: SharedWithMeConversationsTree; additionalShareUserSharedFolderConversations: SharedFolderConversations; - additionalShareUserSharedWithMePrompts: SharedWithMePrompts; + additionalShareUserSharedWithMePrompts: SharedWithMePromptsTree; additionalShareUserSharedFolderPrompts: SharedFolderPrompts; additionalShareUserChat: Chat; additionalShareUserConversationSettings: ConversationSettings; @@ -73,8 +75,8 @@ const dialSharedWithMeTest = dialTest.extend<{ additionalShareUserSharedWithMeFolderDropdownMenu: DropdownMenu; additionalShareUserSharedWithMeConversationDropdownMenu: DropdownMenu; additionalShareUserSharedWithMePromptDropdownMenu: DropdownMenu; - additionalShareUserConversations: Conversations; - additionalShareUserPrompts: Prompts; + additionalShareUserConversations: ConversationsTree; + additionalShareUserPrompts: PromptsTree; additionalShareUserCompare: Compare; additionalShareUserCompareConversation: ConversationToCompare; additionalShareUserNotFound: ChatNotFound; @@ -151,7 +153,7 @@ const dialSharedWithMeTest = dialTest.extend<{ use, ) => { const additionalShareUserSharedWithMeConversations = - additionalShareUserChatBar.getSharedWithMeConversations(); + additionalShareUserChatBar.getSharedWithMeConversationsTree(); await use(additionalShareUserSharedWithMeConversations); }, additionalShareUserSharedFolderConversations: async ( @@ -167,7 +169,7 @@ const dialSharedWithMeTest = dialTest.extend<{ use, ) => { const additionalShareUserSharedWithMePrompts = - additionalShareUserPromptBar.getSharedWithMePrompts(); + additionalShareUserPromptBar.getSharedWithMePromptsTree(); await use(additionalShareUserSharedWithMePrompts); }, additionalShareUserSharedFolderPrompts: async ( @@ -187,12 +189,12 @@ const dialSharedWithMeTest = dialTest.extend<{ use, ) => { const additionalShareUserConversations = - additionalShareUserChatBar.getConversations(); + additionalShareUserChatBar.getConversationsTree(); await use(additionalShareUserConversations); }, additionalShareUserPrompts: async ({ additionalShareUserPromptBar }, use) => { const additionalShareUserPrompts = - additionalShareUserPromptBar.getPrompts(); + additionalShareUserPromptBar.getPromptsTree(); await use(additionalShareUserPrompts); }, additionalShareUserCompare: async ({ additionalShareUserChat }, use) => { diff --git a/apps/chat-e2e/src/tests/chatBarConversation.test.ts b/apps/chat-e2e/src/tests/chatBarConversation.test.ts index 981f2d3ae6..7580a04593 100644 --- a/apps/chat-e2e/src/tests/chatBarConversation.test.ts +++ b/apps/chat-e2e/src/tests/chatBarConversation.test.ts @@ -125,7 +125,7 @@ dialTest( await dialHomePage.openHomePage(); await dialHomePage.waitForPageLoaded(); const chatNameOverflow = await conversations - .getConversationName(conversationName) + .getEntityName(conversationName) .getComputedStyleProperty(Styles.text_overflow); expect .soft(chatNameOverflow[0], ExpectedMessages.chatNameIsTruncated) @@ -138,7 +138,7 @@ dialTest( async () => { await conversations.getEntityByName(conversationName).hover(); const chatNameOverflow = await conversations - .getConversationName(conversationName) + .getEntityName(conversationName) .getComputedStyleProperty(Styles.text_overflow); expect .soft(chatNameOverflow[0], ExpectedMessages.chatNameIsTruncated) @@ -152,7 +152,7 @@ dialTest( await conversations.openEntityDropdownMenu(conversationName); await conversationDropdownMenu.selectMenuOption(MenuOptions.rename); const chatNameOverflow = await conversations - .getConversationName(conversationName) + .getEntityName(conversationName) .getComputedStyleProperty(Styles.text_overflow); expect .soft(chatNameOverflow[0], ExpectedMessages.chatNameIsTruncated) @@ -180,7 +180,7 @@ dialTest( await conversations.openEntityDropdownMenu(conversationName); await conversationDropdownMenu.selectMenuOption(MenuOptions.delete); const chatNameOverflow = await conversations - .getConversationName(conversationName) + .getEntityName(conversationName) .getComputedStyleProperty(Styles.text_overflow); expect .soft(chatNameOverflow[0], ExpectedMessages.chatNameIsTruncated) @@ -217,7 +217,7 @@ dialTest( .toBeVisible(); const chatNameOverflow = await conversations - .getConversationName(newName) + .getEntityName(newName) .getComputedStyleProperty(Styles.text_overflow); expect .soft(chatNameOverflow[0], ExpectedMessages.chatNameIsTruncated) @@ -287,7 +287,7 @@ dialTest( ) .toBeHidden(); const actualName = await conversations - .getConversationName(expectedName) + .getEntityName(expectedName) .getElementInnerContent(); expect .soft(actualName, ExpectedMessages.conversationNameUpdated) @@ -1369,7 +1369,7 @@ for (const [request, expectedConversationName] of testRequestMap.entries()) { await sendMessage.send(request); const actualConversationName = await conversations - .getConversationName(expectedConversationName) + .getEntityName(expectedConversationName) .getElementInnerContent(); expect .soft( diff --git a/apps/chat-e2e/src/tests/chatBarFolderConversation.test.ts b/apps/chat-e2e/src/tests/chatBarFolderConversation.test.ts index a3f12f6d15..1b8e834685 100644 --- a/apps/chat-e2e/src/tests/chatBarFolderConversation.test.ts +++ b/apps/chat-e2e/src/tests/chatBarFolderConversation.test.ts @@ -825,7 +825,7 @@ dialTest( .getEntityByName(firstConversation.name) .click({ button: 'right' }); await conversationDropdownMenuAssertion.assertMenuState('visible'); - await conversations.getConversationName(firstConversation.name).click(); + await conversations.getEntityName(firstConversation.name).click(); // Folder context menu await folderConversations diff --git a/apps/chat-e2e/src/tests/conversationWithAttachment.test.ts b/apps/chat-e2e/src/tests/conversationWithAttachment.test.ts index c2899914cc..a782d1a2a3 100644 --- a/apps/chat-e2e/src/tests/conversationWithAttachment.test.ts +++ b/apps/chat-e2e/src/tests/conversationWithAttachment.test.ts @@ -349,7 +349,8 @@ dialTest( async () => { await attachFilesModal.checkAttachedFile(Attachment.longImageName); const attachmentNameOverflow = await attachFilesModal - .attachedFileName(Attachment.longImageName) + .getAllFilesTree() + .getEntityName(Attachment.longImageName) .getComputedStyleProperty(Styles.text_overflow); expect .soft( diff --git a/apps/chat-e2e/src/tests/editConversationWithAttachment.test.ts b/apps/chat-e2e/src/tests/editConversationWithAttachment.test.ts index b2e16c4eb3..1a30ded17d 100644 --- a/apps/chat-e2e/src/tests/editConversationWithAttachment.test.ts +++ b/apps/chat-e2e/src/tests/editConversationWithAttachment.test.ts @@ -148,13 +148,16 @@ dialTest( UploadMenuOptions.attachUploadedFiles, ); for (const file of initAttachedFiles) { - const isFileChecked = attachFilesModal.attachedFileCheckBox(file); + const isFileChecked = attachFilesModal + .getAllFilesTree() + .getEntityCheckbox(file); await expect .soft(isFileChecked, ExpectedMessages.attachmentFileIsChecked) .toBeChecked(); const fileNameColor = await attachFilesModal - .attachedFileName(file) + .getAllFilesTree() + .getEntityName(file) .getComputedStyleProperty(Styles.color); expect .soft(fileNameColor[0], ExpectedMessages.attachmentNameColorIsValid) diff --git a/apps/chat-e2e/src/tests/errorUploadFromDevice.test.ts b/apps/chat-e2e/src/tests/errorUploadFromDevice.test.ts index d3f584c8ae..6561695b06 100644 --- a/apps/chat-e2e/src/tests/errorUploadFromDevice.test.ts +++ b/apps/chat-e2e/src/tests/errorUploadFromDevice.test.ts @@ -147,12 +147,15 @@ dialTest( await uploadFromDeviceModal.uploadButton.click(); await expect .soft( - attachFilesModal.attachedFile(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.sunImageName), ExpectedMessages.fileIsUploaded, ) .toBeVisible(); const attachmentNameColor = await attachFilesModal - .attachedFileName(Attachment.sunImageName) + .getAllFilesTree() + .getEntityName(Attachment.sunImageName) .getComputedStyleProperty(Styles.color); expect .soft( @@ -314,14 +317,16 @@ dialTest( await uploadFromDeviceModal.uploadFiles(); await expect .soft( - attachFilesModal.attachedFile(Attachment.fileWithoutExtension), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.fileWithoutExtension), ExpectedMessages.fileIsAttached, ) .toBeVisible(); - const isFileChecked = attachFilesModal.attachedFileCheckBox( - Attachment.fileWithoutExtension, - ); + const isFileChecked = attachFilesModal + .getAllFilesTree() + .getEntityCheckbox(Attachment.fileWithoutExtension); await expect .soft(isFileChecked, ExpectedMessages.attachmentFileIsChecked) .toBeChecked(); diff --git a/apps/chat-e2e/src/tests/manageAttachment.test.ts b/apps/chat-e2e/src/tests/manageAttachment.test.ts index e8a32cb0e0..0353516220 100644 --- a/apps/chat-e2e/src/tests/manageAttachment.test.ts +++ b/apps/chat-e2e/src/tests/manageAttachment.test.ts @@ -77,7 +77,9 @@ dialTest( await confirmationDialog.cancelDialog(); await expect .soft( - attachFilesModal.attachedFile(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.sunImageName), ExpectedMessages.fileIsAttached, ) .toBeVisible(); @@ -94,7 +96,9 @@ dialTest( await confirmationDialog.confirm({ triggeredHttpMethod: 'DELETE' }); await expect .soft( - attachFilesModal.attachedFile(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.sunImageName), ExpectedMessages.fileIsNotAttached, ) .toBeHidden(); @@ -175,7 +179,7 @@ dialTest( for (const file of attachedFiles) { await expect .soft( - attachFilesModal.attachedFile(file), + attachFilesModal.getAllFilesTree().getEntityByName(file), ExpectedMessages.fileIsAttached, ) .toBeVisible(); @@ -191,7 +195,7 @@ dialTest( for (const file of attachedFiles) { await expect .soft( - attachFilesModal.attachedFile(file), + attachFilesModal.getAllFilesTree().getEntityByName(file), ExpectedMessages.fileIsNotAttached, ) .toBeHidden(); @@ -240,17 +244,19 @@ dialTest( async () => { await expect .soft( - attachFilesModal.attachedFileLoadingIndicator( - Attachment.sunImageName, - ), + attachFilesModal + .getAllFilesTree() + .attachedFileLoadingIndicator(Attachment.sunImageName), ExpectedMessages.attachmentLoadingIndicatorIsVisible, ) .toBeAttached(); await attachFilesModal + .getAllFilesTree() .removeAttachedFileIcon(Attachment.sunImageName) .hoverOver(); const removeIconColor = await attachFilesModal + .getAllFilesTree() .removeAttachedFileIcon(Attachment.sunImageName) .getComputedStyleProperty(Styles.color); expect @@ -266,19 +272,22 @@ dialTest( 'Click on cancel button near loading indicator and verify uploading stops, file disappears from the list', async () => { await attachFilesModal + .getAllFilesTree() .removeAttachedFileIcon(Attachment.sunImageName) .click(); await expect .soft( - attachFilesModal.attachedFileLoadingIndicator( - Attachment.sunImageName, - ), + attachFilesModal + .getAllFilesTree() + .attachedFileLoadingIndicator(Attachment.sunImageName), ExpectedMessages.attachmentLoadingIndicatorNotVisible, ) .toBeHidden(); await expect .soft( - attachFilesModal.attachedFile(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.sunImageName), ExpectedMessages.fileIsNotAttached, ) .toBeHidden(); @@ -324,14 +333,17 @@ dialTest( await uploadFromDeviceModal.uploadButton.click(); const filenameColor = await attachFilesModal - .attachedFileName(Attachment.sunImageName) + .getAllFilesTree() + .getEntityName(Attachment.sunImageName) .getComputedStyleProperty(Styles.color); expect .soft(filenameColor[0], ExpectedMessages.attachmentNameColorIsValid) .toBe(Colors.textError); await expect .soft( - attachFilesModal.attachedFileErrorIcon(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .attachedFileErrorIcon(Attachment.sunImageName), ExpectedMessages.attachmentHasErrorIcon, ) .toBeVisible(); @@ -343,11 +355,14 @@ dialTest( async () => { await context.setOffline(false); await attachFilesModal + .getAllFilesTree() .removeAttachedFileIcon(Attachment.sunImageName) .click(); await expect .soft( - attachFilesModal.attachedFile(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.sunImageName), ExpectedMessages.fileIsNotAttached, ) .toBeHidden(); @@ -399,16 +414,20 @@ dialTest( async () => { await context.setOffline(false); await attachFilesModal + .getAllFilesTree() .attachedFileLoadingRetry(Attachment.sunImageName) .click(); await expect .soft( - attachFilesModal.attachedFileLoadingRetry(Attachment.sunImageName), + attachFilesModal + .getAllFilesTree() + .attachedFileLoadingRetry(Attachment.sunImageName), ExpectedMessages.attachmentLoadingIndicatorNotVisible, ) .toBeHidden(); const filenameColor = await attachFilesModal - .attachedFileName(Attachment.sunImageName) + .getAllFilesTree() + .getEntityName(Attachment.sunImageName) .getComputedStyleProperty(Styles.color); expect .soft(filenameColor[0], ExpectedMessages.attachmentNameColorIsValid) @@ -472,7 +491,8 @@ dialTest( .toContain(ExpectedConstants.winAllowedSpecialSymbolsInName); const fileBackgroundColor = await attachFilesModal - .attachedFileName(ExpectedConstants.allowedSpecialSymbolsInName()) + .getAllFilesTree() + .getEntityName(ExpectedConstants.allowedSpecialSymbolsInName()) .getComputedStyleProperty(Styles.backgroundColor); expect .soft(fileBackgroundColor[0], ExpectedMessages.fileIsNotHighlighted) @@ -541,7 +561,9 @@ dialTest( ); for (const file of attachedFiles) { - const isFileChecked = attachFilesModal.attachedFileCheckBox(file); + const isFileChecked = attachFilesModal + .getAllFilesTree() + .getEntityCheckbox(file); await expect .soft(isFileChecked, ExpectedMessages.attachmentFileIsChecked) .toBeChecked(); diff --git a/apps/chat-e2e/src/tests/playBack.test.ts b/apps/chat-e2e/src/tests/playBack.test.ts index 995f832d05..bae3ae2700 100644 --- a/apps/chat-e2e/src/tests/playBack.test.ts +++ b/apps/chat-e2e/src/tests/playBack.test.ts @@ -203,7 +203,7 @@ dialTest( await expect .soft( - conversations.getConversationPlaybackIcon(playbackConversationName), + conversations.getEntityPlaybackIcon(playbackConversationName), ExpectedMessages.chatBarConversationIconIsPlayback, ) .toBeVisible(); @@ -266,7 +266,7 @@ dialTest( await expect .soft( - conversations.getConversationPlaybackIcon(playbackConversationName), + conversations.getEntityPlaybackIcon(playbackConversationName), ExpectedMessages.chatBarConversationIconIsPlayback, ) .toBeVisible(); @@ -327,7 +327,7 @@ dialTest( await expect .soft( - conversations.getConversationPlaybackIcon(playbackConversationName), + conversations.getEntityPlaybackIcon(playbackConversationName), ExpectedMessages.chatBarConversationIconIsPlayback, ) .toBeVisible(); @@ -389,7 +389,7 @@ dialTest( await expect .soft( - conversations.getConversationPlaybackIcon(playbackConversationName), + conversations.getEntityPlaybackIcon(playbackConversationName), ExpectedMessages.chatBarConversationIconIsPlayback, ) .toBeVisible(); diff --git a/apps/chat-e2e/src/tests/promptMaximumNameLength.test.ts b/apps/chat-e2e/src/tests/promptMaximumNameLength.test.ts index 098d06ae1a..63fe464f46 100644 --- a/apps/chat-e2e/src/tests/promptMaximumNameLength.test.ts +++ b/apps/chat-e2e/src/tests/promptMaximumNameLength.test.ts @@ -85,7 +85,7 @@ dialTest( }); await dialTest.step('Check the prompt name in the panel', async () => { - const promptNameElement = prompts.getPromptName(prompt.name); + const promptNameElement = prompts.getEntityName(prompt.name); const promptNameOverflow = await promptNameElement.getComputedStyleProperty(Styles.text_overflow); expect @@ -96,7 +96,7 @@ dialTest( await dialTest.step( 'Hover over the prompt name and check the name in the panel', async () => { - await prompts.getPromptName(prompt.name).hoverOver(); + await prompts.getEntityName(prompt.name).hoverOver(); await promptAssertion.assertEntityDotsMenuState( { name: prompt.name }, 'visible', diff --git a/apps/chat-e2e/src/tests/selectUploadFolder.test.ts b/apps/chat-e2e/src/tests/selectUploadFolder.test.ts index 4990fbee65..fd002c6604 100644 --- a/apps/chat-e2e/src/tests/selectUploadFolder.test.ts +++ b/apps/chat-e2e/src/tests/selectUploadFolder.test.ts @@ -23,7 +23,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, }) => { setTestIds( 'EPMRTC-3253', @@ -57,11 +57,11 @@ dialTest( await selectFolderModal.newFolderButton.click(); await expect .soft( - selectUploadFolder.getEditFolderInput().getElementLocator(), + selectFolders.getEditFolderInput().getElementLocator(), ExpectedMessages.folderEditModeIsActive, ) .toBeVisible(); - const folderBackgroundColor = await selectUploadFolder + const folderBackgroundColor = await selectFolders .getFolderInEditMode(ExpectedConstants.newFolderWithIndexTitle(1)) .getComputedStyleProperty(Styles.backgroundColor); expect @@ -76,16 +76,16 @@ dialTest( await dialTest.step( 'Set new name, hit Enter and verify name is updated, edit mode is closed', async () => { - await selectUploadFolder.editFolderNameWithEnter(updatedFolderName); + await selectFolders.editFolderNameWithEnter(updatedFolderName); await expect .soft( - selectUploadFolder.getEditFolderInput().getElementLocator(), + selectFolders.getEditFolderInput().getElementLocator(), ExpectedMessages.folderEditModeIsClosed, ) .toBeHidden(); await expect .soft( - selectUploadFolder.getFolderByName(updatedFolderName), + selectFolders.getFolderByName(updatedFolderName), ExpectedMessages.folderIsVisible, ) .toBeVisible(); @@ -98,8 +98,9 @@ dialTest( await selectFolderModal.selectFolder(updatedFolderName); await selectFolderModal.selectFolderButton.click(); - const uploadToBordersColor = - await uploadFromDeviceModal.uploadToButton.getAllBorderColors(); + const uploadToBordersColor = await uploadFromDeviceModal + .getChangeUploadToPath() + .getAllBorderColors(); Object.values(uploadToBordersColor).forEach((borders) => { borders.forEach((borderColor) => { expect @@ -109,15 +110,16 @@ dialTest( }); expect .soft( - await uploadFromDeviceModal.uploadToPath.getElementContent(), + await uploadFromDeviceModal + .getChangeUploadToPath() + .path.getElementContent(), ExpectedMessages.uploadToPathIsValid, ) .toBe(`${ExpectedConstants.allFilesRoot}/${updatedFolderName}`); - const uploadPathOverflow = - await uploadFromDeviceModal.uploadToPath.getComputedStyleProperty( - Styles.text_overflow, - ); + const uploadPathOverflow = await uploadFromDeviceModal + .getChangeUploadToPath() + .path.getComputedStyleProperty(Styles.text_overflow); expect .soft(uploadPathOverflow[0], ExpectedMessages.uploadToPathIsTruncated) .toBe(Overflow.ellipsis); @@ -132,7 +134,9 @@ dialTest( await selectFolderModal.selectFolderButton.click(); expect .soft( - await uploadFromDeviceModal.uploadToPath.getElementContent(), + await uploadFromDeviceModal + .getChangeUploadToPath() + .path.getElementContent(), ExpectedMessages.uploadToPathIsValid, ) .toBe(ExpectedConstants.allFilesRoot); @@ -151,7 +155,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, sendMessage, page, }) => { @@ -182,12 +186,12 @@ dialTest( 'Click "Create new folder" icon, type one by one restricted symbols and verify nothing is displayed in the input field', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.editFolderName( + await selectFolders.editFolderName( ExpectedConstants.restrictedNameChars, ); expect .soft( - await selectUploadFolder.getEditFolderInput().getEditInputValue(), + await selectFolders.getEditFolderInput().getEditInputValue(), ExpectedMessages.elementAttributeValueIsValid, ) .toBe(''); @@ -199,10 +203,10 @@ dialTest( async () => { await page.keyboard.press(keys.ctrlPlusA); await page.keyboard.press(keys.ctrlPlusV); - await selectUploadFolder.getEditFolderInputActions().clickTickButton(); + await selectFolders.getEditFolderInputActions().clickTickButton(); await expect .soft( - selectUploadFolder.getFolderByName( + selectFolders.getFolderByName( nameWithRestrictedChars.replace( ExpectedConstants.restrictedNameChars, '', @@ -229,7 +233,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, folderDropdownMenu, }) => { setTestIds( @@ -261,10 +265,10 @@ dialTest( 'Click "Create new folder" icon, set long folder name and verify it is truncated with dots', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.editFolderNameWithTick(longFolderName, { + await selectFolders.editFolderNameWithTick(longFolderName, { isHttpMethodTriggered: false, }); - const folderNameOverflowProp = await selectUploadFolder + const folderNameOverflowProp = await selectFolders .getFolderName(longFolderName) .getComputedStyleProperty(Styles.text_overflow); expect @@ -279,9 +283,9 @@ dialTest( await dialTest.step( 'Select create folder and verify folder name and background colors are blue', async () => { - await selectUploadFolder.getFolderByName(longFolderName).click(); + await selectFolders.getFolderByName(longFolderName).click(); const folderBackgroundColor = - await selectUploadFolder.getFolderBackgroundColor(longFolderName); + await selectFolders.getFolderBackgroundColor(longFolderName); expect .soft( folderBackgroundColor[0], @@ -290,7 +294,7 @@ dialTest( .toBe(Colors.backgroundAccentPrimaryAlpha); const folderTextColor = - await selectUploadFolder.getFolderNameColor(longFolderName); + await selectFolders.getFolderNameColor(longFolderName); expect .soft(folderTextColor[0], ExpectedMessages.folderTextColorIsValid) .toBe(Colors.controlsBackgroundAccent); @@ -300,12 +304,12 @@ dialTest( await dialTest.step( 'Create child folder with the same name and verify folder with same name is created and truncated with dots', async () => { - await selectUploadFolder.openFolderDropdownMenu(longFolderName); + await selectFolders.openFolderDropdownMenu(longFolderName); await folderDropdownMenu.selectMenuOption(MenuOptions.addNewFolder); - await selectUploadFolder.editFolderNameWithTick(longFolderName, { + await selectFolders.editFolderNameWithTick(longFolderName, { isHttpMethodTriggered: false, }); - const childFolderNameOverflowProp = await selectUploadFolder + const childFolderNameOverflowProp = await selectFolders .getFolderName(longFolderName, 2) .getComputedStyleProperty(Styles.text_overflow); expect @@ -324,17 +328,13 @@ dialTest( await uploadFromDeviceModal.changeUploadToLocation(); await expect .soft( - selectUploadFolder.getFolderByName(longFolderName, 1), + selectFolders.getFolderByName(longFolderName, 1), ExpectedMessages.folderIsVisible, ) .toBeVisible(); await expect .soft( - selectUploadFolder.getNestedFolder( - longFolderName, - longFolderName, - 1, - ), + selectFolders.getNestedFolder(longFolderName, longFolderName, 1), ExpectedMessages.folderIsVisible, ) .toBeVisible(); @@ -352,7 +352,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, }) => { setTestIds('EPMRTC-3244'); const updateFoldeNameIndex = 999; @@ -379,11 +379,11 @@ dialTest( await selectFolderModal.newFolderButton.click(); expect .soft( - await selectUploadFolder.getEditFolderInput().getEditInputValue(), + await selectFolders.getEditFolderInput().getEditInputValue(), ExpectedMessages.elementAttributeValueIsValid, ) .toBe(ExpectedConstants.newFolderWithIndexTitle(1)); - await selectUploadFolder.getEditFolderInputActions().clickTickButton(); + await selectFolders.getEditFolderInputActions().clickTickButton(); }, ); @@ -391,7 +391,7 @@ dialTest( 'Click "Create new folder" again and edit name to "New folder 999"', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.editFolderNameWithTick( + await selectFolders.editFolderNameWithTick( ExpectedConstants.newFolderWithIndexTitle(updateFoldeNameIndex), { isHttpMethodTriggered: false }, ); @@ -402,10 +402,10 @@ dialTest( 'Click "Create new folder" again, confirm creation and verify "New folder 1000" folder is created', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.getEditFolderInputActions().clickTickButton(); + await selectFolders.getEditFolderInputActions().clickTickButton(); await expect .soft( - selectUploadFolder.getFolderByName( + selectFolders.getFolderByName( ExpectedConstants.newFolderWithIndexTitle( updateFoldeNameIndex + 1, ), @@ -485,7 +485,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, folderDropdownMenu, }) => { setTestIds('EPMRTC-3256', 'EPMRTC-3258', 'EPMRTC-3257'); @@ -512,24 +512,22 @@ dialTest( 'Click "Create new folder" and confirm default folder name', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.getEditFolderInputActions().clickTickButton(); + await selectFolders.getEditFolderInputActions().clickTickButton(); }, ); await dialTest.step( 'Select "Add new folder" option from parent folder dropdown menu, set new child folder name, click cancel edit icon and verify default child folder name is applied', async () => { - await selectUploadFolder.openFolderDropdownMenu( + await selectFolders.openFolderDropdownMenu( ExpectedConstants.newFolderWithIndexTitle(1), ); await folderDropdownMenu.selectMenuOption(MenuOptions.addNewFolder); - await selectUploadFolder.editFolderName(newChildFolderName); - await selectUploadFolder - .getEditFolderInputActions() - .clickCancelButton(); + await selectFolders.editFolderName(newChildFolderName); + await selectFolders.getEditFolderInputActions().clickCancelButton(); await expect .soft( - selectUploadFolder.getNestedFolder( + selectFolders.getNestedFolder( ExpectedConstants.newFolderWithIndexTitle(1), ExpectedConstants.newFolderWithIndexTitle(1), 1, @@ -543,17 +541,17 @@ dialTest( await dialTest.step( 'Open child folder dropdown menu, select "Rename" option, set new name, confirm and verify new child folder name is applied', async () => { - await selectUploadFolder.openFolderDropdownMenu( + await selectFolders.openFolderDropdownMenu( ExpectedConstants.newFolderWithIndexTitle(1), 2, ); await folderDropdownMenu.selectMenuOption(MenuOptions.rename); - await selectUploadFolder.editFolderNameWithTick(newChildFolderName, { + await selectFolders.editFolderNameWithTick(newChildFolderName, { isHttpMethodTriggered: false, }); await expect .soft( - selectUploadFolder.getNestedFolder( + selectFolders.getNestedFolder( ExpectedConstants.newFolderWithIndexTitle(1), newChildFolderName, ), @@ -566,20 +564,20 @@ dialTest( await dialTest.step( 'Open parent folder dropdown menu, select "Rename" option, set new name, confirm and verify new child folder is visible', async () => { - await selectUploadFolder.openFolderDropdownMenu( + await selectFolders.openFolderDropdownMenu( ExpectedConstants.newFolderWithIndexTitle(1), ); await folderDropdownMenu.selectMenuOption(MenuOptions.rename); - await selectUploadFolder.editFolderNameWithTick(newParentFolderName, { + await selectFolders.editFolderNameWithTick(newParentFolderName, { isHttpMethodTriggered: false, }); //TODO: remove next line when fixed https://github.com/epam/ai-dial-chat/issues/1551 - await selectUploadFolder.expandCollapseFolder(newParentFolderName, { + await selectFolders.expandCollapseFolder(newParentFolderName, { isHttpMethodTriggered: true, }); await expect .soft( - selectUploadFolder.getNestedFolder( + selectFolders.getNestedFolder( newParentFolderName, newChildFolderName, ), @@ -601,7 +599,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, errorToast, }) => { setTestIds('EPMRTC-3017', 'EPMRTC-3246'); @@ -626,7 +624,7 @@ dialTest( 'Click "Create new folder" and confirm default folder name', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.getEditFolderInputActions().clickTickButton(); + await selectFolders.getEditFolderInputActions().clickTickButton(); }, ); @@ -634,7 +632,7 @@ dialTest( 'Click "Create new folder" again, set new folder name with end dot, confirm and verify error toast is shown', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.editFolderNameWithTick( + await selectFolders.editFolderNameWithTick( `${GeneratorUtil.randomString(10)}.`, { isHttpMethodTriggered: false }, ); @@ -650,9 +648,7 @@ dialTest( ExpectedMessages.errorMessageContentIsValid, ) .toBe(ExpectedConstants.nameWithDotErrorMessage); - await selectUploadFolder - .getEditFolderInputActions() - .clickCancelButton(); + await selectFolders.getEditFolderInputActions().clickCancelButton(); }, ); @@ -660,7 +656,7 @@ dialTest( 'Create new folder, set name to already existing one, confirm and verify error message is shown', async () => { await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.editFolderNameWithTick( + await selectFolders.editFolderNameWithTick( ExpectedConstants.newFolderWithIndexTitle(1), { isHttpMethodTriggered: false }, ); @@ -672,7 +668,7 @@ dialTest( .toBe(ExpectedConstants.notAllowedDuplicatedFolderNameErrorMessage); await expect .soft( - selectUploadFolder.getFolderByName( + selectFolders.getFolderByName( ExpectedConstants.newFolderWithIndexTitle(3), ), ExpectedMessages.folderIsVisible, @@ -692,7 +688,7 @@ dialTest( uploadFromDeviceModal, attachFilesModal, selectFolderModal, - selectUploadFolder, + selectFolders, }) => { setTestIds('EPMRTC-3251'); @@ -717,12 +713,12 @@ dialTest( async () => { const nameWithSpaces = GeneratorUtil.randomArrayElement(['', ' ']); await selectFolderModal.newFolderButton.click(); - await selectUploadFolder.editFolderNameWithTick(nameWithSpaces, { + await selectFolders.editFolderNameWithTick(nameWithSpaces, { isHttpMethodTriggered: false, }); await expect .soft( - selectUploadFolder.getFolderByName( + selectFolders.getFolderByName( ExpectedConstants.newFolderWithIndexTitle(1), ), ExpectedMessages.folderIsVisible, diff --git a/apps/chat-e2e/src/tests/shareConversationWithContent.test.ts b/apps/chat-e2e/src/tests/shareConversationWithContent.test.ts index 106a3ba59d..e516db255b 100644 --- a/apps/chat-e2e/src/tests/shareConversationWithContent.test.ts +++ b/apps/chat-e2e/src/tests/shareConversationWithContent.test.ts @@ -696,7 +696,7 @@ dialSharedWithMeTest( await additionalShareUserDialHomePage.waitForPageLoaded(); await expect .soft( - additionalShareUserSharedWithMeConversations.getConversationPlaybackIcon( + additionalShareUserSharedWithMeConversations.getEntityPlaybackIcon( playbackConversation.name, ), ExpectedMessages.chatBarConversationIconIsPlayback, diff --git a/apps/chat-e2e/src/tests/sharedWithMeConversations.test.ts b/apps/chat-e2e/src/tests/sharedWithMeConversations.test.ts index d12941d3cd..1f39fcc522 100644 --- a/apps/chat-e2e/src/tests/sharedWithMeConversations.test.ts +++ b/apps/chat-e2e/src/tests/sharedWithMeConversations.test.ts @@ -1228,7 +1228,7 @@ dialTest( const conversationBackgroundColor = await dialHomePage .getAppContainer() .getChatBar() - .getSharedWithMeConversations() + .getSharedWithMeConversationsTree() .getEntityBackgroundColor(conversation.name); expect .soft( diff --git a/apps/chat-e2e/src/tests/uploadFileToFolder.test.ts b/apps/chat-e2e/src/tests/uploadFileToFolder.test.ts index e924601ff5..272bb78aa5 100644 --- a/apps/chat-e2e/src/tests/uploadFileToFolder.test.ts +++ b/apps/chat-e2e/src/tests/uploadFileToFolder.test.ts @@ -5,7 +5,7 @@ import { ExpectedMessages, MenuOptions, } from '@/src/testData'; -import { Colors, Styles } from '@/src/ui/domData'; +import { Colors } from '@/src/ui/domData'; import { GeneratorUtil } from '@/src/utils'; import { expect } from '@playwright/test'; @@ -90,7 +90,7 @@ dialTest( ) .toBeVisible(); - const isFileChecked = attachedAllFiles.attachedFolderFileCheckBox( + const isFileChecked = attachedAllFiles.getFolderEntityCheckbox( ExpectedConstants.newFolderWithIndexTitle(1), Attachment.sunImageName, 2, @@ -99,15 +99,13 @@ dialTest( .soft(isFileChecked, ExpectedMessages.attachmentFileIsChecked) .toBeChecked(); - const fileNameColor = await attachedAllFiles - .attachedFolderFileName( - ExpectedConstants.newFolderWithIndexTitle(1), - Attachment.sunImageName, - 2, - ) - .getComputedStyleProperty(Styles.color); + const fileNameColor = await attachedAllFiles.getFolderEntityColor( + ExpectedConstants.newFolderWithIndexTitle(1), + Attachment.sunImageName, + 2, + ); expect - .soft(fileNameColor[0], ExpectedMessages.attachmentNameColorIsValid) + .soft(fileNameColor, ExpectedMessages.attachmentNameColorIsValid) .toBe(Colors.controlsBackgroundAccent); }, ); @@ -194,7 +192,7 @@ dialTest( ) .toBeVisible(); - const isFileChecked = attachedAllFiles.attachedFolderFileCheckBox( + const isFileChecked = attachedAllFiles.getFolderEntityCheckbox( folderName, Attachment.cloudImageName, ); @@ -202,11 +200,12 @@ dialTest( .soft(isFileChecked, ExpectedMessages.attachmentFileIsChecked) .toBeChecked(); - const fileNameColor = await attachedAllFiles - .attachedFolderFileName(folderName, Attachment.cloudImageName) - .getComputedStyleProperty(Styles.color); + const fileNameColor = await attachedAllFiles.getFolderEntityColor( + folderName, + Attachment.cloudImageName, + ); expect - .soft(fileNameColor[0], ExpectedMessages.attachmentNameColorIsValid) + .soft(fileNameColor, ExpectedMessages.attachmentNameColorIsValid) .toBe(Colors.controlsBackgroundAccent); }, ); diff --git a/apps/chat-e2e/src/tests/uploadFromDevice.test.ts b/apps/chat-e2e/src/tests/uploadFromDevice.test.ts index b7c102b1b8..31421ce8f9 100644 --- a/apps/chat-e2e/src/tests/uploadFromDevice.test.ts +++ b/apps/chat-e2e/src/tests/uploadFromDevice.test.ts @@ -248,14 +248,15 @@ dialTest( await expect .soft( attachFilesModal - .attachedFileName(attachments[1]) + .getAllFilesTree() + .getEntityName(attachments[1]) .getElementLocator(), ExpectedMessages.fileIsAttached, ) .toBeVisible(); expect .soft( - await attachFilesModal.attachedFiles.getElementsCount(), + await attachFilesModal.getAllFilesTree().getElementsCount(), ExpectedMessages.filesCountIsValid, ) .toBe(1); @@ -416,7 +417,7 @@ dialTest( for (const attachment of attachments) { await expect .soft( - attachFilesModal.attachedFile(attachment), + attachFilesModal.getAllFilesTree().getEntityByName(attachment), ExpectedMessages.fileIsUploaded, ) .toBeVisible(); @@ -502,15 +503,15 @@ dialTest( await uploadFromDeviceModal.uploadFiles(); await expect .soft( - attachFilesModal.attachedFile(expectedName), + attachFilesModal.getAllFilesTree().getEntityByName(expectedName), ExpectedMessages.fileIsUploaded, ) .toBeVisible(); await expect .soft( - attachFilesModal.attachedFile( - Attachment.dotExtensionImageName.toLowerCase(), - ), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.dotExtensionImageName.toLowerCase()), ExpectedMessages.fileIsUploaded, ) .toBeVisible(); @@ -579,7 +580,9 @@ dialTest( await uploadFromDeviceModal.uploadFiles(); await expect .soft( - attachFilesModal.attachedFile(Attachment.cloudImageName), + attachFilesModal + .getAllFilesTree() + .getEntityByName(Attachment.cloudImageName), ExpectedMessages.fileIsAttached, ) .toBeVisible(); diff --git a/apps/chat-e2e/src/ui/pages/dialHomePage.ts b/apps/chat-e2e/src/ui/pages/dialHomePage.ts index 537db6894e..c853e997fa 100644 --- a/apps/chat-e2e/src/ui/pages/dialHomePage.ts +++ b/apps/chat-e2e/src/ui/pages/dialHomePage.ts @@ -31,7 +31,7 @@ export class DialHomePage extends BasePage { await chat.getSendMessage().waitForMessageInputLoaded(); if (options?.isNewConversationVisible) { const newConversation = chatBar - .getConversations() + .getConversationsTree() .getEntityByName(ExpectedConstants.newConversationTitle); await newConversation.waitFor(); await newConversation.waitFor({ state: 'attached' }); diff --git a/apps/chat-e2e/src/ui/selectors/chatSelectors.ts b/apps/chat-e2e/src/ui/selectors/chatSelectors.ts index d5c30171f4..011cfc73d7 100644 --- a/apps/chat-e2e/src/ui/selectors/chatSelectors.ts +++ b/apps/chat-e2e/src/ui/selectors/chatSelectors.ts @@ -99,7 +99,6 @@ export const CompareSelectors = { conversationToCompare: '[data-qa="conversation-to-compare"]', compareMode: '[data-qa="compare-mode"]', conversationRow: '[data-qa="conversation-row"]', - conversationRowName: '[data-qa="conversation-row-name"]', noConversationsAvailable: '[data-qa="no-conversations-available"]', searchCompareConversation: '[data-qa="search-compare-conversation"]', }; @@ -150,6 +149,7 @@ export const ChatSelectors = { maxWidth: '.max-w-none', showMore: '[data-qa="show-more"]', showLess: '[data-qa="show-less"]', + iconSelector: '[data-qa="entity-icon"]', }; export const TableSelectors = { diff --git a/apps/chat-e2e/src/ui/selectors/dialogSelectors.ts b/apps/chat-e2e/src/ui/selectors/dialogSelectors.ts index 94158346ab..748cdb6a15 100644 --- a/apps/chat-e2e/src/ui/selectors/dialogSelectors.ts +++ b/apps/chat-e2e/src/ui/selectors/dialogSelectors.ts @@ -92,16 +92,13 @@ export const UploadFromDeviceModalSelectors = { deleteUploadedFileIcon: `[data-qa="delete-file"] > ${Tags.svg}`, fileExtension: '[data-qa="file-extension"]', uploadedFiles: '[data-qa="uploaded-files"]', - uploadTo: '[data-qa="upload-to"]', - uploadToPath: '[data-qa="upload-to-path"]', - changeUploadTo: '[data-qa="change-upload-to"]', }; export const AttachFilesModalSelectors = { modalContainer: '[data-qa="file-manager-modal"]', - allFilesContainer: '[data-qa="all-files"]', - attachedFile: '[data-qa="attached-file"]', - attachedFileName: '[data-qa="attached-file-name"]', + organizationFilesContainer: '[data-qa="organization-files-container"]', + sharedWithMeFilesContainer: '[data-qa="shared-with-me-files-container"]', + allFilesContainer: '[data-qa="all-files-container"]', attachedFileIcon: '[data-qa="attached-file-icon"]', attachFilesButton: '[data-qa="attach-files"]', uploadFromDeviceButton: '[data-qa="upload-from-device"]', @@ -118,9 +115,9 @@ export const SelectFolderModalSelectors = { modalContainer: '[data-qa="select-folder-modal"]', newFolderButton: '[data-qa="new-folder"]', selectFolderButton: '[data-qa="select-folder"]', - uploadFolders: '[data-qa="upload-folders"]', + selectFolders: '[data-qa="select-folders"]', allFolders: '[data-qa="all-folders"]', - uploadRootFolder: '[data-qa="root-folder"]', + rootFolder: '[data-qa="section-root"]', }; export const AccountSettingsModalSelector = { @@ -129,3 +126,36 @@ export const AccountSettingsModalSelector = { fullWidthChatToggle: '[data-qa="toggle-switch"]', save: '[data-qa="save"]', }; + +export const PublishingModalSelectors = { + modalContainer: '[data-qa="publish-modal"]', + requestName: '[data-qa="request-name"]', + publishTo: '[data-qa="change-path-container"]', + publishToPath: '[data-qa="path"]', + changePublishToPath: '[data-qa="change-button"]', + conversationsToPublishContainer: + '[data-qa="conversations-to-send-request-container"]', + filesToPublishContainer: '[data-qa="files-to-send-request-container"]', + promptsToPublishContainer: '[data-qa="prompts-to-send-request-container"]', + appsToPublishContainer: '[data-qa="applications-to-send-request-container"]', + sendButton: '[data-qa="publish"]', +}; + +export const ChangePathElement = { + changePathContainer: '[data-qa="change-path-container"]', + path: '[data-qa="path"]', + changeButton: '[data-qa="change-button"]', +}; + +export const PublishingApprovalModalSelectors = { + modalContainer: '[data-qa="publish-approval-modal"]', + publishName: '[data-qa="publish-name"]', + publishToPath: '[data-qa="publish-to-path"]', + publishDate: '[data-qa="publish-date"]', + conversationsToApproveContainer: + '[data-qa="conversations-to-approve-container"]', + filesToApproveContainer: '[data-qa="files-to-approve-container"]', + promptsToApproveContainer: '[data-qa="prompts-to-approve-container"]', + applicationsToApproveContainer: + '[data-qa="applications-to-approve-container"]', +}; diff --git a/apps/chat-e2e/src/ui/selectors/fileSelectors.ts b/apps/chat-e2e/src/ui/selectors/fileSelectors.ts index 8ef23b4876..26f2619c05 100644 --- a/apps/chat-e2e/src/ui/selectors/fileSelectors.ts +++ b/apps/chat-e2e/src/ui/selectors/fileSelectors.ts @@ -5,4 +5,5 @@ export const FileSelectors = { loadingRetry: '[data-qa="retry-upload"]', remove: `[data-qa="remove-file"] > ${Tags.svg}`, fileTypeAttribute: '[type="file"]', + downloadIcon: '[data-qa="download"]', }; diff --git a/apps/chat-e2e/src/ui/selectors/sideBarSelectors.ts b/apps/chat-e2e/src/ui/selectors/sideBarSelectors.ts index d29a0528a6..2c640d8aeb 100644 --- a/apps/chat-e2e/src/ui/selectors/sideBarSelectors.ts +++ b/apps/chat-e2e/src/ui/selectors/sideBarSelectors.ts @@ -8,7 +8,7 @@ export const SideBarSelectors = { selectAll: '[data-qa="select-all"]', unselectAll: '[data-qa="unselect-all"]', draggableArea: '[data-qa="draggable-area"]', - chronology: '[data-qa="chronology"]', + chronology: '[data-qa="chronology-container"]', newFolder: '[data-qa="create-folder"]', resizeIcon: '[data-qa="resize-icon"]', bottomPanel: '[data-qa="bottom-panel"]', @@ -17,6 +17,7 @@ export const SideBarSelectors = { folderSeparator: '.h-1', pinnedEntities: '[data-qa^="pinned"]', sharedWithMeContainer: '[data-qa="shared-with-me-container"]', + approveRequiredContainer: '[data-qa="approve-required-container"]', }; export const ChatBarSelectors = { @@ -24,8 +25,6 @@ export const ChatBarSelectors = { compare: '[data-qa="compare"]', attachments: '[data-qa="attachments"]', conversations: '[data-qa="conversations"]', - conversation: '[data-qa="conversation"]', - conversationName: '[data-qa="conversation-name"]', selectedEntity: '[data-qa="selected"]', chatFolders: '[data-qa="chat-folders"]', exportConversations: '[data-qa="export-conversations"]', @@ -34,6 +33,8 @@ export const ChatBarSelectors = { `${ChatBarSelectors.chatFolders} > [data-qa="pinned-chats-container"]`, sharedWithMeChats: () => `${ChatBarSelectors.chatFolders} > ${SideBarSelectors.sharedWithMeContainer}`, + approveRequiredConversations: () => + `${ChatBarSelectors.chatFolders} > ${SideBarSelectors.approveRequiredContainer}`, }; export const PromptBarSelectors = { @@ -42,11 +43,25 @@ export const PromptBarSelectors = { newPromptButton: '[data-qa="new-prompt"]', prompts: '[data-qa="prompts-section-container"] >> [data-qa="prompts"]', prompt: '[data-qa="prompt"]', - promptName: '[data-qa="prompt-name"]', deletePrompts: '[data-qa="delete-prompts"]', pinnedChats: () => `${PromptBarSelectors.promptFolders} > [data-qa="pinned-prompts-container"]`, sharedWithMePrompts: () => `${PromptBarSelectors.promptFolders} > ${SideBarSelectors.sharedWithMeContainer}`, + approveRequiredPrompts: () => + `${PromptBarSelectors.promptFolders} > ${SideBarSelectors.approveRequiredContainer}`, leftResizeIcon: '[data-qa="left-resize-icon"]', }; + +export const EntitySelectors = { + entityName: '[data-qa="entity-name"]', + conversation: '[data-qa="conversation"]', + prompt: '[data-qa="prompt"]', + file: '[data-qa="file"]', + application: '[data-qa="application"]', + version: '[data-qa="version"]', +}; + +export const PublishEntitySelectors = { + version: '[data-qa="version"]', +}; diff --git a/apps/chat-e2e/src/ui/webElements/attachFilesModal.ts b/apps/chat-e2e/src/ui/webElements/attachFilesModal.ts index bc8e3095ab..c3bcd19eab 100644 --- a/apps/chat-e2e/src/ui/webElements/attachFilesModal.ts +++ b/apps/chat-e2e/src/ui/webElements/attachFilesModal.ts @@ -1,17 +1,16 @@ import { BaseElement } from './baseElement'; -import { Tags } from '@/src/ui/domData'; import { AttachFilesModalSelectors, + EntitySelectors, ErrorLabelSelectors, IconSelectors, MenuSelectors, SelectFolderModalSelectors, } from '@/src/ui/selectors'; -import { FileSelectors } from '@/src/ui/selectors/fileSelectors'; import { DropdownMenu } from '@/src/ui/webElements/dropdownMenu'; +import { AttachFilesTree, Folders } from '@/src/ui/webElements/entityTree'; import { FilesModalHeader } from '@/src/ui/webElements/filesModalHeader'; -import { FolderFiles } from '@/src/ui/webElements/folderFiles'; import { Page } from '@playwright/test'; export class AttachFilesModal extends BaseElement { @@ -21,7 +20,9 @@ export class AttachFilesModal extends BaseElement { private fileDropdownMenu!: DropdownMenu; private modalHeader!: FilesModalHeader; - private folderFiles!: FolderFiles; + //'All files' section entities + private allFolderFiles!: Folders; + private allFilesTree!: AttachFilesTree; getFileDropdownMenu(): DropdownMenu { if (!this.fileDropdownMenu) { @@ -37,50 +38,28 @@ export class AttachFilesModal extends BaseElement { return this.modalHeader; } - getFolderFiles(): FolderFiles { - if (!this.folderFiles) { - this.folderFiles = new FolderFiles(this.page, this.rootLocator); + getAllFolderFiles(): Folders { + if (!this.allFolderFiles) { + this.allFolderFiles = new Folders( + this.page, + this.rootLocator, + AttachFilesModalSelectors.allFilesContainer, + EntitySelectors.file, + ); } - return this.folderFiles; + return this.allFolderFiles; } - public attachedFiles = this.getChildElementBySelector( - AttachFilesModalSelectors.attachedFile, - ); - - public attachedFile = (filename: string) => - this.attachedFiles.getElementLocatorByText(filename); - - public attachedFileIcon = (filename: string) => - this.attachedFile(filename).locator( - AttachFilesModalSelectors.attachedFileIcon, - ); - - public attachedFileName = (filename: string) => - this.createElementFromLocator( - this.attachedFile(filename).locator( - AttachFilesModalSelectors.attachedFileName, - ), - ); - - public attachedFileCheckBox = (filename: string) => - this.attachedFileIcon(filename).getByRole('checkbox'); - - public attachedFileLoadingIndicator = (filename: string) => - this.attachedFile(filename).locator(FileSelectors.loadingIndicator); - - public removeAttachedFileIcon = (filename: string) => - this.createElementFromLocator( - this.attachedFile(filename).locator(FileSelectors.remove), - ); - - public attachedFileErrorIcon = (filename: string) => - this.attachedFile(filename).locator( - `${Tags.svg}${ErrorLabelSelectors.fieldError}`, - ); - - public attachedFileLoadingRetry = (filename: string) => - this.attachedFile(filename).locator(FileSelectors.loadingRetry); + getAllFilesTree(): AttachFilesTree { + if (!this.allFilesTree) { + this.allFilesTree = new AttachFilesTree( + this.page, + this.rootLocator, + AttachFilesModalSelectors.allFilesContainer, + ); + } + return this.allFilesTree; + } public attachFilesButton = this.getChildElementBySelector( AttachFilesModalSelectors.attachFilesButton, @@ -105,7 +84,7 @@ export class AttachFilesModal extends BaseElement { public closeButton = this.getChildElementBySelector(IconSelectors.cancelIcon); public async checkAttachedFile(filename: string) { - await this.attachedFileIcon(filename).click(); + await this.getAllFilesTree().attachedFileIcon(filename).click(); } public async attachFiles() { @@ -114,7 +93,7 @@ export class AttachFilesModal extends BaseElement { } public async openFileDropdownMenu(filename: string) { - const file = this.attachedFile(filename); + const file = this.getAllFilesTree().getEntityByName(filename); await file.hover(); await file.locator(MenuSelectors.dotsMenu).click(); await this.getFileDropdownMenu().waitForState(); diff --git a/apps/chat-e2e/src/ui/webElements/baseElement.ts b/apps/chat-e2e/src/ui/webElements/baseElement.ts index 501aeb5b35..56c3cad259 100644 --- a/apps/chat-e2e/src/ui/webElements/baseElement.ts +++ b/apps/chat-e2e/src/ui/webElements/baseElement.ts @@ -1,6 +1,7 @@ import { Styles, Tags } from '../domData'; import { ScrollState } from '@/src/testData'; +import { ChatSelectors } from '@/src/ui/selectors'; import { Locator, Page } from '@playwright/test'; import path from 'path'; @@ -220,19 +221,24 @@ export class BaseElement { } public async getElementIconHtml(elementLocator: Locator): Promise { - const iconLocator = elementLocator.locator(`${Tags.svg}:visible`).first(); + const iconLocator = elementLocator + .locator(ChatSelectors.iconSelector) + .first(); await iconLocator.locator(Tags.desc).waitFor({ state: 'attached' }); - return iconLocator.innerHTML().then((icon) => - icon - .replaceAll('\n', '') - .replaceAll(/.*<\/desc>/g, '') - .replaceAll(/><\/path>/g, Tags.closingTag) - .replaceAll(/><\/rect>/g, Tags.closingTag) - .replaceAll(/><\/polygon>/g, Tags.closingTag) - .replaceAll(/><\/circle>/g, Tags.closingTag) - .replaceAll(/><\/use>/g, Tags.closingTag) - .replaceAll(/><\/stop>/g, Tags.closingTag) - .replaceAll(/><\/image>/g, Tags.closingTag), - ); + return iconLocator + .locator(`${Tags.svg}:visible`) + .innerHTML() + .then((icon) => + icon + .replaceAll('\n', '') + .replaceAll(/.*<\/desc>/g, '') + .replaceAll(/><\/path>/g, Tags.closingTag) + .replaceAll(/><\/rect>/g, Tags.closingTag) + .replaceAll(/><\/polygon>/g, Tags.closingTag) + .replaceAll(/><\/circle>/g, Tags.closingTag) + .replaceAll(/><\/use>/g, Tags.closingTag) + .replaceAll(/><\/stop>/g, Tags.closingTag) + .replaceAll(/><\/image>/g, Tags.closingTag), + ); } } diff --git a/apps/chat-e2e/src/ui/webElements/changePath.ts b/apps/chat-e2e/src/ui/webElements/changePath.ts new file mode 100644 index 0000000000..821a2aeac1 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/changePath.ts @@ -0,0 +1,15 @@ +import { ChangePathElement } from '@/src/ui/selectors'; +import { BaseElement } from '@/src/ui/webElements/baseElement'; +import { Locator, Page } from '@playwright/test'; + +export class ChangePath extends BaseElement { + constructor(page: Page, parentLocator: Locator) { + super(page, ChangePathElement.changePathContainer, parentLocator); + } + + public path = this.getChildElementBySelector(ChangePathElement.path); + + public changeButton = this.getChildElementBySelector( + ChangePathElement.changeButton, + ); +} diff --git a/apps/chat-e2e/src/ui/webElements/chatBar.ts b/apps/chat-e2e/src/ui/webElements/chatBar.ts index 0c417b64ea..0650c4937f 100644 --- a/apps/chat-e2e/src/ui/webElements/chatBar.ts +++ b/apps/chat-e2e/src/ui/webElements/chatBar.ts @@ -3,14 +3,18 @@ import { MenuSelectors, SideBarSelectors, } from '../selectors'; -import { Conversations } from './conversations'; import { isApiStorageType } from '@/src/hooks/global-setup'; import { API, MenuOptions } from '@/src/testData'; import { DropdownMenu } from '@/src/ui/webElements/dropdownMenu'; -import { FolderConversations } from '@/src/ui/webElements/folderConversations'; -import { SharedFolderConversations } from '@/src/ui/webElements/sharedFolderConversations'; -import { SharedWithMeConversations } from '@/src/ui/webElements/sharedWithMeConversations'; +import { + ApproveRequiredConversations, + ApproveRequiredPrompts, + ConversationsTree, + FolderConversations, + SharedFolderConversations, + SharedWithMeConversationsTree, +} from '@/src/ui/webElements/entityTree'; import { SideBar } from '@/src/ui/webElements/sideBar'; import { Page } from '@playwright/test'; @@ -19,10 +23,12 @@ export class ChatBar extends SideBar { super(page, SideBarSelectors.chatBar); } - private conversations!: Conversations; - private sharedWithMeConversations!: SharedWithMeConversations; + private conversationsTree!: ConversationsTree; + private sharedWithMeConversationsTree!: SharedWithMeConversationsTree; private folderConversations!: FolderConversations; private sharedFolderConversations!: SharedFolderConversations; + private approveRequiredConversations!: ApproveRequiredConversations; + private approveRequiredPrompts!: ApproveRequiredPrompts; private bottomDropdownMenu!: DropdownMenu; public compareButton = this.getChildElementBySelector( ChatBarSelectors.compare, @@ -34,18 +40,24 @@ export class ChatBar extends SideBar { MenuSelectors.dotsMenu, ); - getConversations(): Conversations { - if (!this.conversations) { - this.conversations = new Conversations(this.page); + getConversationsTree(): ConversationsTree { + if (!this.conversationsTree) { + this.conversationsTree = new ConversationsTree( + this.page, + this.rootLocator, + ); } - return this.conversations; + return this.conversationsTree; } - getSharedWithMeConversations(): SharedWithMeConversations { - if (!this.sharedWithMeConversations) { - this.sharedWithMeConversations = new SharedWithMeConversations(this.page); + getSharedWithMeConversationsTree(): SharedWithMeConversationsTree { + if (!this.sharedWithMeConversationsTree) { + this.sharedWithMeConversationsTree = new SharedWithMeConversationsTree( + this.page, + this.rootLocator, + ); } - return this.sharedWithMeConversations; + return this.sharedWithMeConversationsTree; } getFolderConversations(): FolderConversations { @@ -68,6 +80,26 @@ export class ChatBar extends SideBar { return this.sharedFolderConversations; } + getApproveRequiredConversations(): ApproveRequiredConversations { + if (!this.approveRequiredConversations) { + this.approveRequiredConversations = new ApproveRequiredConversations( + this.page, + this.getElementLocator(), + ); + } + return this.approveRequiredConversations; + } + + getApproveRequiredPrompts(): ApproveRequiredPrompts { + if (!this.approveRequiredPrompts) { + this.approveRequiredPrompts = new ApproveRequiredPrompts( + this.page, + this.getElementLocator(), + ); + } + return this.approveRequiredPrompts; + } + getBottomDropdownMenu(): DropdownMenu { if (!this.bottomDropdownMenu) { this.bottomDropdownMenu = new DropdownMenu(this.page); @@ -118,7 +150,7 @@ export class ChatBar extends SideBar { ) { const folder = this.getFolderConversations().getFolderByName(folderName); const conversation = - this.getConversations().getEntityByName(conversationName); + this.getConversationsTree().getEntityByName(conversationName); await this.dragEntityToFolder(conversation, folder); } @@ -133,7 +165,7 @@ export class ChatBar extends SideBar { folderConversationName, ); const conversation = - this.getConversations().getEntityByName(conversationName); + this.getConversationsTree().getEntityByName(conversationName); await this.dragAndDropEntityToFolder(conversation, folderConversation, { isHttpMethodTriggered, }); diff --git a/apps/chat-e2e/src/ui/webElements/conversationToCompare.ts b/apps/chat-e2e/src/ui/webElements/conversationToCompare.ts index 2652963b20..f2bc8fc05c 100644 --- a/apps/chat-e2e/src/ui/webElements/conversationToCompare.ts +++ b/apps/chat-e2e/src/ui/webElements/conversationToCompare.ts @@ -1,4 +1,8 @@ -import { CompareSelectors, SideBarSelectors } from '../selectors'; +import { + CompareSelectors, + EntitySelectors, + SideBarSelectors, +} from '../selectors'; import { BaseElement } from './baseElement'; import { Styles, Tags } from '@/src/ui/domData'; @@ -14,7 +18,7 @@ export class ConversationToCompare extends BaseElement { ); public compareConversationRowNames = this.getChildElementBySelector( - CompareSelectors.conversationRowName, + EntitySelectors.entityName, ); public noConversationsAvailable = this.getChildElementBySelector( diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/attachment/attachFilesTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/attachment/attachFilesTree.ts new file mode 100644 index 0000000000..36368c7f79 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/attachment/attachFilesTree.ts @@ -0,0 +1,36 @@ +import { Tags } from '@/src/ui/domData'; +import { + AttachFilesModalSelectors, + EntitySelectors, + ErrorLabelSelectors, + FileSelectors, +} from '@/src/ui/selectors'; +import { EntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class AttachFilesTree extends EntitiesTree { + constructor(page: Page, parentLocator: Locator, filesSection: string) { + super(page, parentLocator, filesSection, EntitySelectors.file); + } + + public attachedFileIcon = (filename: string) => + this.getEntityByName(filename).locator( + AttachFilesModalSelectors.attachedFileIcon, + ); + + public attachedFileLoadingIndicator = (filename: string) => + this.getEntityByName(filename).locator(FileSelectors.loadingIndicator); + + public removeAttachedFileIcon = (filename: string) => + this.createElementFromLocator( + this.getEntityByName(filename).locator(FileSelectors.remove), + ); + + public attachedFileErrorIcon = (filename: string) => + this.getEntityByName(filename).locator( + `${Tags.svg}${ErrorLabelSelectors.fieldError}`, + ); + + public attachedFileLoadingRetry = (filename: string) => + this.getEntityByName(filename).locator(FileSelectors.loadingRetry); +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/entitiesTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/entitiesTree.ts new file mode 100644 index 0000000000..20bacae3d5 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/entitiesTree.ts @@ -0,0 +1,70 @@ +import { Attributes, Styles } from '@/src/ui/domData'; +import { EntitySelectors, IconSelectors } from '@/src/ui/selectors'; +import { BaseElement } from '@/src/ui/webElements'; +import { Locator, Page } from '@playwright/test'; + +export class EntitiesTree extends BaseElement { + protected entitySelector: string; + + constructor( + page: Page, + parentLocator: Locator, + rootSelector: string, + entitySelector: string, + ) { + super(page, rootSelector, parentLocator); + this.entitySelector = entitySelector; + } + + getEntityByName(name: string, index?: number) { + return this.getChildElementBySelector( + this.entitySelector, + ).getElementLocatorByText(name, index); + } + + getEntityName(name: string, index?: number) { + return this.createElementFromLocator( + this.getEntityByName(name, index).locator(EntitySelectors.entityName), + ); + } + + getEntityCheckbox(name: string, index?: number) { + return this.getEntityByName(name, index).getByRole('checkbox'); + } + + getEntityCheckboxElement(name: string, index?: number) { + return this.createElementFromLocator(this.getEntityCheckbox(name, index)); + } + + async getEntityCheckboxState(name: string, index?: number) { + return this.getEntityCheckbox(name, index).getAttribute(Attributes.dataQA); + } + + async getEntityIcon(name: string, index?: number) { + const entity = this.getEntityByName(name, index); + return this.getElementIconHtml(entity); + } + + public async getEntityBackgroundColor(name: string, index?: number) { + const backgroundColor = await this.createElementFromLocator( + this.getEntityByName(name, index), + ).getComputedStyleProperty(Styles.backgroundColor); + return backgroundColor[0]; + } + + public async getEntitiesCount() { + return this.getChildElementBySelector( + this.entitySelector, + ).getElementsCount(); + } + + public getEntityPlaybackIcon(name: string, index?: number) { + return this.getEntityByName(name, index).locator( + IconSelectors.playbackIcon, + ); + } + + public getEntityReplayIcon(name: string, index?: number) { + return this.getEntityByName(name, index).locator(IconSelectors.replayIcon); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/folders.ts b/apps/chat-e2e/src/ui/webElements/entityTree/folders.ts similarity index 95% rename from apps/chat-e2e/src/ui/webElements/folders.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/folders.ts index bed6fd0182..314cb6a3c0 100644 --- a/apps/chat-e2e/src/ui/webElements/folders.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/folders.ts @@ -1,9 +1,10 @@ import { ChatBarSelectors, + EntitySelectors, MenuSelectors, SideBarSelectors, -} from '../selectors'; -import { BaseElement, elementIndexExceptionError } from './baseElement'; +} from '../../selectors'; +import { BaseElement, elementIndexExceptionError } from '../baseElement'; import { isApiStorageType } from '@/src/hooks/global-setup'; import { API, ExpectedConstants } from '@/src/testData'; @@ -383,6 +384,23 @@ export class Folders extends BaseElement { ).getComputedStyleProperty(Styles.backgroundColor); } + public async getFolderEntityColor( + folderName: string, + entityName: string, + folderIndex?: number, + entityIndex?: number, + ) { + const folderEntityColor = await this.createElementFromLocator( + this.getFolderEntity( + folderName, + entityName, + folderIndex, + entityIndex, + ).locator(EntitySelectors.entityName), + ).getComputedStyleProperty(Styles.color); + return folderEntityColor[0]; + } + public getFolderEntityArrowIcon( folderName: string, entityName: string, diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/index.ts b/apps/chat-e2e/src/ui/webElements/entityTree/index.ts new file mode 100644 index 0000000000..0258fce882 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/index.ts @@ -0,0 +1,35 @@ +export * from './entitiesTree'; +export * from './folders'; +export * from './publishFilesTree'; +export * from './publishEntitiesTree'; +export * from './publishFolder'; + +export * from './sidebar/sideBarEntitiesTree'; +export * from './sidebar/baseSideBarConversationTree'; +export * from './sidebar/conversationsTree'; +export * from './sidebar/sharedWithMeConversationsTree'; +export * from './sidebar/promptsTree'; +export * from './sidebar/folderConversations'; +export * from './sidebar/folderPrompts'; +export * from './sidebar/sharedFolderConversations'; +export * from './sidebar/sharedWithMePromptsTree'; +export * from './sidebar/sharedFolderPrompts'; +export * from './sidebar/approveRequiredConversations'; +export * from './sidebar/approveRequiredPrompts'; + +export * from './attachment/attachFilesTree'; + +export * from './publishapproval/conversationsToApproveTree'; +export * from './publishapproval/applicationsToApproveTree'; +export * from './publishapproval/promptsToApproveTree'; +export * from './publishapproval/filesToApproveTree'; +export * from './publishapproval/folderConversationsToApprove'; +export * from './publishapproval/folderFilesToApprove'; +export * from './publishapproval/folderPromptsToApprove'; + +export * from './publishrequest/conversationsToPublishTree'; +export * from './publishrequest/promptsToPublishTree'; +export * from './publishrequest/applicationsToPublishTree'; +export * from './publishrequest/filesToPublishTree'; +export * from './publishrequest/folderConversationsToPublish'; +export * from './publishrequest/folderPromptsToPublish'; diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishEntitiesTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishEntitiesTree.ts new file mode 100644 index 0000000000..91b71b8664 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishEntitiesTree.ts @@ -0,0 +1,10 @@ +import { PublishEntitySelectors } from '@/src/ui/selectors'; +import { EntitiesTree } from '@/src/ui/webElements/entityTree'; + +export class PublishEntitiesTree extends EntitiesTree { + public getEntityVersion(entityName: string, entityIndex?: number) { + return this.getEntityByName(entityName, entityIndex) + .locator('~*') + .locator(PublishEntitySelectors.version); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishFilesTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishFilesTree.ts new file mode 100644 index 0000000000..c59bff9a49 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishFilesTree.ts @@ -0,0 +1,7 @@ +import { FileSelectors } from '@/src/ui/selectors'; +import { EntitiesTree } from '@/src/ui/webElements/entityTree'; + +export class PublishFilesTree extends EntitiesTree { + public getFileDownloadIcon = (filename: string) => + this.getEntityByName(filename).locator(`~${FileSelectors.downloadIcon}`); +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishFolder.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishFolder.ts new file mode 100644 index 0000000000..a2787c57d6 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishFolder.ts @@ -0,0 +1,20 @@ +import { PublishEntitySelectors } from '@/src/ui/selectors'; +import { Folders } from '@/src/ui/webElements/entityTree'; + +export class PublishFolder extends Folders { + public getFolderEntityVersion( + folderName: string, + entityName: string, + folderIndex?: number, + entityIndex?: number, + ) { + return this.getFolderEntity( + folderName, + entityName, + folderIndex, + entityIndex, + ) + .locator('~*') + .locator(PublishEntitySelectors.version); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/applicationsToApproveTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/applicationsToApproveTree.ts new file mode 100644 index 0000000000..2ae69aa206 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/applicationsToApproveTree.ts @@ -0,0 +1,18 @@ +import { + EntitySelectors, + PublishingApprovalModalSelectors, +} from '../../../selectors'; + +import { PublishEntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class ApplicationsToApproveTree extends PublishEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.applicationsToApproveContainer, + EntitySelectors.application, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/conversationsToApproveTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/conversationsToApproveTree.ts new file mode 100644 index 0000000000..7c23999b55 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/conversationsToApproveTree.ts @@ -0,0 +1,17 @@ +import { + EntitySelectors, + PublishingApprovalModalSelectors, +} from '@/src/ui/selectors'; +import { PublishEntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class ConversationsToApproveTree extends PublishEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.conversationsToApproveContainer, + EntitySelectors.conversation, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/filesToApproveTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/filesToApproveTree.ts new file mode 100644 index 0000000000..7246730b5e --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/filesToApproveTree.ts @@ -0,0 +1,17 @@ +import { + EntitySelectors, + PublishingApprovalModalSelectors, +} from '@/src/ui/selectors'; +import { PublishFilesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FilesToApproveTree extends PublishFilesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.filesToApproveContainer, + EntitySelectors.file, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderConversationsToApprove.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderConversationsToApprove.ts new file mode 100644 index 0000000000..ddcad15e39 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderConversationsToApprove.ts @@ -0,0 +1,17 @@ +import { + EntitySelectors, + PublishingApprovalModalSelectors, +} from '@/src/ui/selectors'; +import { PublishFolder } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FolderConversationsToApprove extends PublishFolder { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.conversationsToApproveContainer, + EntitySelectors.conversation, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderFilesToApprove.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderFilesToApprove.ts new file mode 100644 index 0000000000..4444af50fe --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderFilesToApprove.ts @@ -0,0 +1,23 @@ +import { + EntitySelectors, + FileSelectors, + PublishingApprovalModalSelectors, +} from '@/src/ui/selectors'; +import { Folders } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FolderFilesToApprove extends Folders { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.filesToApproveContainer, + EntitySelectors.file, + ); + } + + public folderFileDownloadIcon = (folderName: string, filename: string) => + this.getFolderEntity(folderName, filename).locator( + `~${FileSelectors.downloadIcon}`, + ); +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderPromptsToApprove.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderPromptsToApprove.ts new file mode 100644 index 0000000000..8507902908 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/folderPromptsToApprove.ts @@ -0,0 +1,17 @@ +import { + EntitySelectors, + PublishingApprovalModalSelectors, +} from '@/src/ui/selectors'; +import { PublishFolder } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FolderPromptsToApprove extends PublishFolder { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.promptsToApproveContainer, + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/promptsToApproveTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/promptsToApproveTree.ts new file mode 100644 index 0000000000..e8418ed1ab --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishapproval/promptsToApproveTree.ts @@ -0,0 +1,17 @@ +import { + EntitySelectors, + PublishingApprovalModalSelectors, +} from '@/src/ui/selectors'; +import { PublishEntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class PromptsToApproveTree extends PublishEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingApprovalModalSelectors.promptsToApproveContainer, + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/applicationsToPublishTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/applicationsToPublishTree.ts new file mode 100644 index 0000000000..39fd0de687 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/applicationsToPublishTree.ts @@ -0,0 +1,15 @@ +import { EntitySelectors, PublishingModalSelectors } from '../../../selectors'; + +import { PublishEntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class ApplicationsToPublishTree extends PublishEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingModalSelectors.appsToPublishContainer, + EntitySelectors.application, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/conversationsToPublishTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/conversationsToPublishTree.ts new file mode 100644 index 0000000000..3e88e239a6 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/conversationsToPublishTree.ts @@ -0,0 +1,14 @@ +import { EntitySelectors, PublishingModalSelectors } from '@/src/ui/selectors'; +import { PublishEntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class ConversationsToPublishTree extends PublishEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingModalSelectors.conversationsToPublishContainer, + EntitySelectors.conversation, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/filesToPublishTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/filesToPublishTree.ts new file mode 100644 index 0000000000..b91535dcd5 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/filesToPublishTree.ts @@ -0,0 +1,14 @@ +import { EntitySelectors, PublishingModalSelectors } from '@/src/ui/selectors'; +import { PublishFilesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FilesToPublishTree extends PublishFilesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingModalSelectors.filesToPublishContainer, + EntitySelectors.file, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/folderConversationsToPublish.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/folderConversationsToPublish.ts new file mode 100644 index 0000000000..7214fd4bba --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/folderConversationsToPublish.ts @@ -0,0 +1,14 @@ +import { EntitySelectors, PublishingModalSelectors } from '@/src/ui/selectors'; +import { PublishFolder } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FolderConversationsToPublish extends PublishFolder { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingModalSelectors.conversationsToPublishContainer, + EntitySelectors.conversation, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/folderPromptsToPublish.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/folderPromptsToPublish.ts new file mode 100644 index 0000000000..119eded02a --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/folderPromptsToPublish.ts @@ -0,0 +1,14 @@ +import { EntitySelectors, PublishingModalSelectors } from '@/src/ui/selectors'; +import { PublishFolder } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class FolderPromptsToPublish extends PublishFolder { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingModalSelectors.promptsToPublishContainer, + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/promptsToPublishTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/promptsToPublishTree.ts new file mode 100644 index 0000000000..f97c3dbaa3 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/publishrequest/promptsToPublishTree.ts @@ -0,0 +1,14 @@ +import { EntitySelectors, PublishingModalSelectors } from '@/src/ui/selectors'; +import { PublishEntitiesTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class PromptsToPublishTree extends PublishEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PublishingModalSelectors.promptsToPublishContainer, + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/approveRequiredConversations.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/approveRequiredConversations.ts new file mode 100644 index 0000000000..292eb9b597 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/approveRequiredConversations.ts @@ -0,0 +1,14 @@ +import { ChatBarSelectors, EntitySelectors } from '@/src/ui/selectors'; +import { Folders } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class ApproveRequiredConversations extends Folders { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + ChatBarSelectors.approveRequiredConversations(), + EntitySelectors.conversation, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/approveRequiredPrompts.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/approveRequiredPrompts.ts new file mode 100644 index 0000000000..81931e01e9 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/approveRequiredPrompts.ts @@ -0,0 +1,14 @@ +import { EntitySelectors, PromptBarSelectors } from '@/src/ui/selectors'; +import { Folders } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; + +export class ApproveRequiredPrompts extends Folders { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PromptBarSelectors.approveRequiredPrompts(), + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/baseConversation.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/baseSideBarConversationTree.ts similarity index 69% rename from apps/chat-e2e/src/ui/webElements/baseConversation.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/baseSideBarConversationTree.ts index f192a3b93e..155e50f136 100644 --- a/apps/chat-e2e/src/ui/webElements/baseConversation.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/baseSideBarConversationTree.ts @@ -1,13 +1,9 @@ import { isApiStorageType } from '@/src/hooks/global-setup'; import { keys } from '@/src/ui/keyboard'; -import { ChatBarSelectors, IconSelectors } from '@/src/ui/selectors'; -import { SideBarEntities } from '@/src/ui/webElements/sideBarEntities'; - -export class BaseConversation extends SideBarEntities { - public getConversationName(name: string, index?: number) { - return this.getEntityName(ChatBarSelectors.conversationName, name, index); - } +import { ChatBarSelectors } from '@/src/ui/selectors'; +import { SideBarEntitiesTree } from '@/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree'; +export class BaseSideBarConversationTree extends SideBarEntitiesTree { public async selectConversation(name: string, index?: number) { const conversationToSelect = this.getEntityByName(name, index); if (isApiStorageType) { @@ -50,14 +46,4 @@ export class BaseConversation extends SideBarEntities { } await this.page.keyboard.press(keys.enter); } - - public getConversationPlaybackIcon(name: string, index?: number) { - return this.getEntityByName(name, index).locator( - IconSelectors.playbackIcon, - ); - } - - public getConversationReplayIcon(name: string, index?: number) { - return this.getEntityByName(name, index).locator(IconSelectors.replayIcon); - } } diff --git a/apps/chat-e2e/src/ui/webElements/conversations.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/conversationsTree.ts similarity index 81% rename from apps/chat-e2e/src/ui/webElements/conversations.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/conversationsTree.ts index 0fe3ffde8c..8b7f783805 100644 --- a/apps/chat-e2e/src/ui/webElements/conversations.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/conversationsTree.ts @@ -1,17 +1,26 @@ -import { ChatBarSelectors, SideBarSelectors } from '../selectors'; +import { + ChatBarSelectors, + EntitySelectors, + SideBarSelectors, +} from '../../../selectors'; import { Chronology } from '@/src/testData'; -import { BaseConversation } from '@/src/ui/webElements/baseConversation'; -import { Page } from '@playwright/test'; +import { BaseSideBarConversationTree } from '@/src/ui/webElements/entityTree'; +import { Locator, Page } from '@playwright/test'; interface ConversationsChronologyType { chronology: string; conversations: string[]; } -export class Conversations extends BaseConversation { - constructor(page: Page) { - super(page, ChatBarSelectors.conversations, ChatBarSelectors.conversation); +export class ConversationsTree extends BaseSideBarConversationTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + ChatBarSelectors.conversations, + EntitySelectors.conversation, + ); } public chronologyByTitle = (chronology: string) => diff --git a/apps/chat-e2e/src/ui/webElements/folderConversations.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/folderConversations.ts similarity index 84% rename from apps/chat-e2e/src/ui/webElements/folderConversations.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/folderConversations.ts index 53767e4d32..85ff66de53 100644 --- a/apps/chat-e2e/src/ui/webElements/folderConversations.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/folderConversations.ts @@ -1,11 +1,11 @@ -import { ChatBarSelectors } from '../selectors'; +import { ChatBarSelectors, EntitySelectors } from '../../../selectors'; import { ShareByLinkResponseModel, ShareRequestModel, } from '@/chat/types/share'; import { MenuOptions } from '@/src/testData'; -import { Folders } from '@/src/ui/webElements/folders'; +import { Folders } from '@/src/ui/webElements/entityTree'; import { Locator, Page } from '@playwright/test'; export class FolderConversations extends Folders { @@ -14,7 +14,7 @@ export class FolderConversations extends Folders { page, parentLocator, ChatBarSelectors.pinnedChats(), - ChatBarSelectors.conversation, + EntitySelectors.conversation, ); } diff --git a/apps/chat-e2e/src/ui/webElements/folderPrompts.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/folderPrompts.ts similarity index 58% rename from apps/chat-e2e/src/ui/webElements/folderPrompts.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/folderPrompts.ts index 64948ae94e..64374b5c91 100644 --- a/apps/chat-e2e/src/ui/webElements/folderPrompts.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/folderPrompts.ts @@ -1,6 +1,6 @@ -import { PromptBarSelectors } from '../selectors'; +import { EntitySelectors, PromptBarSelectors } from '../../../selectors'; -import { Folders } from '@/src/ui/webElements/folders'; +import { Folders } from '@/src/ui/webElements/entityTree/folders'; import { Locator, Page } from '@playwright/test'; export class FolderPrompts extends Folders { @@ -9,7 +9,7 @@ export class FolderPrompts extends Folders { page, parentLocator, PromptBarSelectors.pinnedChats(), - PromptBarSelectors.prompt, + EntitySelectors.prompt, ); } } diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/promptsTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/promptsTree.ts new file mode 100644 index 0000000000..416f29cff6 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/promptsTree.ts @@ -0,0 +1,15 @@ +import { EntitySelectors, PromptBarSelectors } from '../../../selectors'; + +import { SideBarEntitiesTree } from '@/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree'; +import { Locator, Page } from '@playwright/test'; + +export class PromptsTree extends SideBarEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PromptBarSelectors.prompts, + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/sharedFolderConversations.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedFolderConversations.ts similarity index 59% rename from apps/chat-e2e/src/ui/webElements/sharedFolderConversations.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedFolderConversations.ts index c30e312cfd..0fd0072fb9 100644 --- a/apps/chat-e2e/src/ui/webElements/sharedFolderConversations.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedFolderConversations.ts @@ -1,6 +1,6 @@ -import { ChatBarSelectors } from '../selectors'; +import { ChatBarSelectors, EntitySelectors } from '../../../selectors'; -import { Folders } from '@/src/ui/webElements/folders'; +import { Folders } from '@/src/ui/webElements/entityTree/folders'; import { Locator, Page } from '@playwright/test'; export class SharedFolderConversations extends Folders { @@ -9,7 +9,7 @@ export class SharedFolderConversations extends Folders { page, parentLocator, ChatBarSelectors.sharedWithMeChats(), - ChatBarSelectors.conversation, + EntitySelectors.conversation, ); } } diff --git a/apps/chat-e2e/src/ui/webElements/sharedFolderPrompts.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedFolderPrompts.ts similarity index 61% rename from apps/chat-e2e/src/ui/webElements/sharedFolderPrompts.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedFolderPrompts.ts index 4409090939..e2e54adb56 100644 --- a/apps/chat-e2e/src/ui/webElements/sharedFolderPrompts.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedFolderPrompts.ts @@ -1,6 +1,6 @@ -import { PromptBarSelectors } from '../selectors'; +import { EntitySelectors, PromptBarSelectors } from '../../../selectors'; -import { Folders } from '@/src/ui/webElements/folders'; +import { Folders } from '@/src/ui/webElements/entityTree'; import { Locator, Page } from '@playwright/test'; export class SharedFolderPrompts extends Folders { @@ -9,7 +9,7 @@ export class SharedFolderPrompts extends Folders { page, parentLocator, PromptBarSelectors.sharedWithMePrompts(), - PromptBarSelectors.prompt, + EntitySelectors.prompt, ); } } diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedWithMeConversationsTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedWithMeConversationsTree.ts new file mode 100644 index 0000000000..050beb51df --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedWithMeConversationsTree.ts @@ -0,0 +1,15 @@ +import { ChatBarSelectors, EntitySelectors } from '../../../selectors'; + +import { BaseSideBarConversationTree } from '@/src/ui/webElements/entityTree/sidebar/baseSideBarConversationTree'; +import { Locator, Page } from '@playwright/test'; + +export class SharedWithMeConversationsTree extends BaseSideBarConversationTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + ChatBarSelectors.sharedWithMeChats(), + EntitySelectors.conversation, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedWithMePromptsTree.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedWithMePromptsTree.ts new file mode 100644 index 0000000000..ab2334e289 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sharedWithMePromptsTree.ts @@ -0,0 +1,15 @@ +import { EntitySelectors, PromptBarSelectors } from '../../../selectors'; + +import { SideBarEntitiesTree } from '@/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree'; +import { Locator, Page } from '@playwright/test'; + +export class SharedWithMePromptsTree extends SideBarEntitiesTree { + constructor(page: Page, parentLocator: Locator) { + super( + page, + parentLocator, + PromptBarSelectors.sharedWithMePrompts(), + EntitySelectors.prompt, + ); + } +} diff --git a/apps/chat-e2e/src/ui/webElements/sideBarEntities.ts b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree.ts similarity index 55% rename from apps/chat-e2e/src/ui/webElements/sideBarEntities.ts rename to apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree.ts index fd57f0889e..8dc87882d0 100644 --- a/apps/chat-e2e/src/ui/webElements/sideBarEntities.ts +++ b/apps/chat-e2e/src/ui/webElements/entityTree/sidebar/sideBarEntitiesTree.ts @@ -1,20 +1,12 @@ -import { MenuSelectors, SideBarSelectors } from '../selectors'; -import { BaseElement } from './baseElement'; +import { MenuSelectors, SideBarSelectors } from '../../../selectors'; -import { Attributes, Styles, Tags } from '@/src/ui/domData'; +import { Styles, Tags } from '@/src/ui/domData'; import { DropdownMenu } from '@/src/ui/webElements/dropdownMenu'; import { EditInput } from '@/src/ui/webElements/editInput'; import { EditInputActions } from '@/src/ui/webElements/editInputActions'; -import { Page } from '@playwright/test'; - -export class SideBarEntities extends BaseElement { - protected entitySelector: string; - - constructor(page: Page, rootSelector: string, entitySelector: string) { - super(page, rootSelector); - this.entitySelector = entitySelector; - } +import { EntitiesTree } from '@/src/ui/webElements/entityTree'; +export class SideBarEntitiesTree extends EntitiesTree { private editEntityInput!: EditInput; getEditEntityInput(): EditInput { @@ -54,18 +46,6 @@ export class SideBarEntities extends BaseElement { return this.getEntityByName(name, index).locator(MenuSelectors.dotsMenu); }; - getEntityByName(name: string, index?: number) { - return this.getChildElementBySelector( - this.entitySelector, - ).getElementLocatorByText(name, index); - } - - protected getEntityName(nameSelector: string, name: string, index?: number) { - return this.createElementFromLocator( - this.getEntityByName(name, index).locator(nameSelector), - ); - } - getEntityArrowIcon(name: string, index?: number) { return this.getEntityByName(name, index).locator( SideBarSelectors.arrowAdditionalIcon, @@ -78,18 +58,6 @@ export class SideBarEntities extends BaseElement { ).getComputedStyleProperty(Styles.color); } - getEntityCheckbox(name: string, index?: number) { - return this.getEntityByName(name, index).getByRole('checkbox'); - } - - getEntityCheckboxElement(name: string, index?: number) { - return this.createElementFromLocator(this.getEntityCheckbox(name, index)); - } - - async getEntityCheckboxState(name: string, index?: number) { - return this.getEntityCheckbox(name, index).getAttribute(Attributes.dataQA); - } - async openEntityDropdownMenu(name: string, index?: number) { const entity = this.getEntityByName(name, index); await entity.hover(); @@ -103,18 +71,6 @@ export class SideBarEntities extends BaseElement { return input; } - async getEntityIcon(name: string, index?: number) { - const entity = this.getEntityByName(name, index); - return this.getElementIconHtml(entity); - } - - public async getEntityBackgroundColor(name: string, index?: number) { - const backgroundColor = await this.createElementFromLocator( - this.getEntityByName(name, index), - ).getComputedStyleProperty(Styles.backgroundColor); - return backgroundColor[0]; - } - public async selectMoveToMenuOption( name: string, { isHttpMethodTriggered = true }: { isHttpMethodTriggered?: boolean } = {}, @@ -124,10 +80,4 @@ export class SideBarEntities extends BaseElement { isHttpMethodTriggered, }); } - - public async getEntitiesCount() { - return this.getChildElementBySelector( - this.entitySelector, - ).getElementsCount(); - } } diff --git a/apps/chat-e2e/src/ui/webElements/folderFiles.ts b/apps/chat-e2e/src/ui/webElements/folderFiles.ts deleted file mode 100644 index 1959637084..0000000000 --- a/apps/chat-e2e/src/ui/webElements/folderFiles.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { AttachFilesModalSelectors } from '../selectors'; - -import { Folders } from '@/src/ui/webElements/folders'; -import { Locator, Page } from '@playwright/test'; - -export class FolderFiles extends Folders { - constructor(page: Page, parentLocator: Locator) { - super( - page, - parentLocator, - AttachFilesModalSelectors.allFilesContainer, - AttachFilesModalSelectors.attachedFile, - ); - } - - public attachedFolderFileName = ( - folderName: string, - filename: string, - folderIndex?: number, - ) => - this.createElementFromLocator( - this.getFolderEntity(folderName, filename, folderIndex).locator( - AttachFilesModalSelectors.attachedFileName, - ), - ); - - public attachedFolderFileIcon = ( - folderName: string, - filename: string, - folderIndex?: number, - ) => - this.getFolderEntity(folderName, filename, folderIndex).locator( - AttachFilesModalSelectors.attachedFileIcon, - ); - - public attachedFolderFileCheckBox = ( - folderName: string, - filename: string, - folderIndex?: number, - ) => - this.attachedFolderFileIcon(folderName, filename, folderIndex).getByRole( - 'checkbox', - ); -} diff --git a/apps/chat-e2e/src/ui/webElements/index.ts b/apps/chat-e2e/src/ui/webElements/index.ts index 9398561fea..0819b97843 100644 --- a/apps/chat-e2e/src/ui/webElements/index.ts +++ b/apps/chat-e2e/src/ui/webElements/index.ts @@ -2,24 +2,18 @@ export * from './baseElement'; export * from './chat'; export * from './chatBar'; export * from './chatMessages'; -export * from './conversations'; -export * from './folderConversations'; export * from './conversationSettings'; export * from './entitySelector'; export * from './sendMessage'; export * from './promptBar'; -export * from './conversations'; export * from './dropdownMenu'; export * from './editInput'; export * from './addonsDialog'; export * from './addons'; export * from './confirmationDialog'; export * from './entitySettings'; -export * from './folderPrompts'; -export * from './folders'; export * from './modelSelector'; export * from './promptModalDialog'; -export * from './prompts'; export * from './temperatureSlider'; export * from './promptList'; export * from './variableModalDialog'; @@ -43,19 +37,16 @@ export * from './modelsDialog'; export * from './recentEntities'; export * from './talkToGroup'; export * from './errorToast'; -export * from './baseConversation'; export * from './chatNotFound'; -export * from './sharedFolderConversations'; -export * from './sharedWithMeConversations'; export * from './attachFilesModal'; export * from './inputAttachments'; export * from './uploadFromDeviceModal'; export * from './filesModalHeader'; export * from './selectFolderModal'; export * from './editInputActions'; -export * from './folderFiles'; export * from './playbackMessage'; export * from './sharedPromptPreviewModal'; -export * from './sharedWithMePrompts'; export * from './keycloak'; -export * from './sharedFolderPrompts'; +export * from './publishingRequestModal'; +export * from './changePath'; +export * from './publishingApprovalModal'; diff --git a/apps/chat-e2e/src/ui/webElements/promptBar.ts b/apps/chat-e2e/src/ui/webElements/promptBar.ts index f6a2056f6e..d48e39ac0f 100644 --- a/apps/chat-e2e/src/ui/webElements/promptBar.ts +++ b/apps/chat-e2e/src/ui/webElements/promptBar.ts @@ -1,9 +1,11 @@ import { SideBarSelectors } from '../selectors'; -import { FolderPrompts } from '@/src/ui/webElements/folderPrompts'; -import { Prompts } from '@/src/ui/webElements/prompts'; -import { SharedFolderPrompts } from '@/src/ui/webElements/sharedFolderPrompts'; -import { SharedWithMePrompts } from '@/src/ui/webElements/sharedWithMePrompts'; +import { + FolderPrompts, + PromptsTree, + SharedFolderPrompts, + SharedWithMePromptsTree, +} from '@/src/ui/webElements/entityTree'; import { SideBar } from '@/src/ui/webElements/sideBar'; import { Page } from '@playwright/test'; @@ -12,9 +14,9 @@ export class PromptBar extends SideBar { super(page, SideBarSelectors.promptBar); } - private prompts!: Prompts; + private promptsTree!: PromptsTree; private folderPrompts!: FolderPrompts; - private sharedWithMePrompts!: SharedWithMePrompts; + private sharedWithMePromptsTree!: SharedWithMePromptsTree; private sharedFolderPrompts!: SharedFolderPrompts; getFolderPrompts(): FolderPrompts { @@ -27,18 +29,21 @@ export class PromptBar extends SideBar { return this.folderPrompts; } - getPrompts(): Prompts { - if (!this.prompts) { - this.prompts = new Prompts(this.page); + getPromptsTree(): PromptsTree { + if (!this.promptsTree) { + this.promptsTree = new PromptsTree(this.page, this.rootLocator); } - return this.prompts; + return this.promptsTree; } - getSharedWithMePrompts(): SharedWithMePrompts { - if (!this.sharedWithMePrompts) { - this.sharedWithMePrompts = new SharedWithMePrompts(this.page); + getSharedWithMePromptsTree(): SharedWithMePromptsTree { + if (!this.sharedWithMePromptsTree) { + this.sharedWithMePromptsTree = new SharedWithMePromptsTree( + this.page, + this.rootLocator, + ); } - return this.sharedWithMePrompts; + return this.sharedWithMePromptsTree; } getSharedFolderPrompts(): SharedFolderPrompts { @@ -72,7 +77,7 @@ export class PromptBar extends SideBar { public async drugPromptToFolder(folderName: string, promptName: string) { const folder = this.getFolderPrompts().getFolderByName(folderName); - const prompt = this.getPrompts().getEntityByName(promptName); + const prompt = this.getPromptsTree().getEntityByName(promptName); await this.dragEntityToFolder(prompt, folder); } @@ -86,7 +91,7 @@ export class PromptBar extends SideBar { folderName, folderPromptName, ); - const prompt = this.getPrompts().getEntityByName(promptName); + const prompt = this.getPromptsTree().getEntityByName(promptName); await this.dragAndDropEntityToFolder(prompt, folderPrompt, { isHttpMethodTriggered, }); diff --git a/apps/chat-e2e/src/ui/webElements/prompts.ts b/apps/chat-e2e/src/ui/webElements/prompts.ts deleted file mode 100644 index 5ff187efea..0000000000 --- a/apps/chat-e2e/src/ui/webElements/prompts.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { PromptBarSelectors } from '../selectors'; - -import { SideBarEntities } from '@/src/ui/webElements/sideBarEntities'; -import { Page } from '@playwright/test'; - -export class Prompts extends SideBarEntities { - constructor(page: Page) { - super(page, PromptBarSelectors.prompts, PromptBarSelectors.prompt); - } - - public getPromptName(name: string, index?: number) { - return this.getEntityName(PromptBarSelectors.promptName, name, index); - } -} diff --git a/apps/chat-e2e/src/ui/webElements/publishingApprovalModal.ts b/apps/chat-e2e/src/ui/webElements/publishingApprovalModal.ts new file mode 100644 index 0000000000..35a3fac757 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/publishingApprovalModal.ts @@ -0,0 +1,110 @@ +import { PublishingApprovalModalSelectors } from '@/src/ui/selectors'; +import { BaseElement } from '@/src/ui/webElements/baseElement'; +import { + ApplicationsToApproveTree, + ConversationsToApproveTree, + FilesToApproveTree, + FolderConversationsToApprove, + FolderFilesToApprove, + FolderPromptsToApprove, + PromptsToApproveTree, +} from '@/src/ui/webElements/entityTree'; +import { Page } from '@playwright/test'; + +export class PublishingApprovalModal extends BaseElement { + constructor(page: Page) { + super(page, PublishingApprovalModalSelectors.modalContainer); + } + + //conversations to approve trees + private conversationsToApproveTree!: ConversationsToApproveTree; + private folderConversationsToApprove!: FolderConversationsToApprove; + //files to approve trees + private filesToApproveTree!: FilesToApproveTree; + private folderFilesToApprove!: FolderFilesToApprove; + //prompts to approve trees + private promptsToApproveTree!: PromptsToApproveTree; + private folderPromptsToApprove!: FolderPromptsToApprove; + //applications to approve tree + private applicationsToPublishTree!: ApplicationsToApproveTree; + + getConversationsToApproveTree(): ConversationsToApproveTree { + if (!this.conversationsToApproveTree) { + this.conversationsToApproveTree = new ConversationsToApproveTree( + this.page, + this.rootLocator, + ); + } + return this.conversationsToApproveTree; + } + + getFolderConversationsToApprove(): FolderConversationsToApprove { + if (!this.folderConversationsToApprove) { + this.folderConversationsToApprove = new FolderConversationsToApprove( + this.page, + this.rootLocator, + ); + } + return this.folderConversationsToApprove; + } + + getFilesToApproveTree(): FilesToApproveTree { + if (!this.filesToApproveTree) { + this.filesToApproveTree = new FilesToApproveTree( + this.page, + this.rootLocator, + ); + } + return this.filesToApproveTree; + } + + getFolderFilesToApprove(): FolderFilesToApprove { + if (!this.folderFilesToApprove) { + this.folderFilesToApprove = new FolderFilesToApprove( + this.page, + this.rootLocator, + ); + } + return this.folderFilesToApprove; + } + + getPromptsToApproveTree(): PromptsToApproveTree { + if (!this.promptsToApproveTree) { + this.promptsToApproveTree = new PromptsToApproveTree( + this.page, + this.rootLocator, + ); + } + return this.promptsToApproveTree; + } + + getFolderPromptsToApprove(): FolderPromptsToApprove { + if (!this.folderPromptsToApprove) { + this.folderPromptsToApprove = new FolderPromptsToApprove( + this.page, + this.rootLocator, + ); + } + return this.folderPromptsToApprove; + } + + getApplicationsToApproveTree(): ApplicationsToApproveTree { + if (!this.applicationsToPublishTree) { + this.applicationsToPublishTree = new ApplicationsToApproveTree( + this.page, + this.rootLocator, + ); + } + return this.applicationsToPublishTree; + } + + public publishName = this.getChildElementBySelector( + PublishingApprovalModalSelectors.publishName, + ); + public publishToPath = this.getChildElementBySelector( + PublishingApprovalModalSelectors.publishToPath, + ); + public publishDate = this.getChildElementBySelector( + PublishingApprovalModalSelectors.publishDate, + ); +} diff --git a/apps/chat-e2e/src/ui/webElements/publishingRequestModal.ts b/apps/chat-e2e/src/ui/webElements/publishingRequestModal.ts new file mode 100644 index 0000000000..42e470bb66 --- /dev/null +++ b/apps/chat-e2e/src/ui/webElements/publishingRequestModal.ts @@ -0,0 +1,105 @@ +import { PublishingModalSelectors } from '@/src/ui/selectors'; +import { BaseElement } from '@/src/ui/webElements/baseElement'; +import { ChangePath } from '@/src/ui/webElements/changePath'; +import { + ApplicationsToPublishTree, + ConversationsToPublishTree, + FilesToPublishTree, + FolderConversationsToPublish, + FolderPromptsToPublish, + PromptsToPublishTree, +} from '@/src/ui/webElements/entityTree'; +import { Page } from '@playwright/test'; + +export class PublishingRequestModal extends BaseElement { + constructor(page: Page) { + super(page, PublishingModalSelectors.modalContainer); + } + + //conversations to publish trees + private conversationsToPublishTree!: ConversationsToPublishTree; + private folderConversationsToPublish!: FolderConversationsToPublish; + //files to publish tree + private filesToPublishTree!: FilesToPublishTree; + //prompts to publish trees + private promptsToPublishTree!: PromptsToPublishTree; + private folderPromptsToPublish!: FolderPromptsToPublish; + //applications to publish tree + private applicationsToPublishTree!: ApplicationsToPublishTree; + //change publish path element + private changePublishToPath!: ChangePath; + + getConversationsToPublishTree(): ConversationsToPublishTree { + if (!this.conversationsToPublishTree) { + this.conversationsToPublishTree = new ConversationsToPublishTree( + this.page, + this.rootLocator, + ); + } + return this.conversationsToPublishTree; + } + + getFolderConversationsToPublish(): FolderConversationsToPublish { + if (!this.folderConversationsToPublish) { + this.folderConversationsToPublish = new FolderConversationsToPublish( + this.page, + this.rootLocator, + ); + } + return this.folderConversationsToPublish; + } + + getFilesToPublishTree(): FilesToPublishTree { + if (!this.filesToPublishTree) { + this.filesToPublishTree = new FilesToPublishTree( + this.page, + this.rootLocator, + ); + } + return this.filesToPublishTree; + } + + getPromptsToPublishTree(): PromptsToPublishTree { + if (!this.promptsToPublishTree) { + this.promptsToPublishTree = new PromptsToPublishTree( + this.page, + this.rootLocator, + ); + } + return this.promptsToPublishTree; + } + + getFolderPromptsToPublish(): FolderPromptsToPublish { + if (!this.folderPromptsToPublish) { + this.folderPromptsToPublish = new FolderPromptsToPublish( + this.page, + this.rootLocator, + ); + } + return this.folderPromptsToPublish; + } + + getApplicationsToPublishTree(): ApplicationsToPublishTree { + if (!this.applicationsToPublishTree) { + this.applicationsToPublishTree = new ApplicationsToPublishTree( + this.page, + this.rootLocator, + ); + } + return this.applicationsToPublishTree; + } + + getChangePublishToPath(): ChangePath { + if (!this.changePublishToPath) { + this.changePublishToPath = new ChangePath(this.page, this.rootLocator); + } + return this.changePublishToPath; + } + + public requestName = this.getChildElementBySelector( + PublishingModalSelectors.requestName, + ); + public sendRequestButton = this.getChildElementBySelector( + PublishingModalSelectors.sendButton, + ); +} diff --git a/apps/chat-e2e/src/ui/webElements/selectFolderModal.ts b/apps/chat-e2e/src/ui/webElements/selectFolderModal.ts index da61861cf8..884c8c77ff 100644 --- a/apps/chat-e2e/src/ui/webElements/selectFolderModal.ts +++ b/apps/chat-e2e/src/ui/webElements/selectFolderModal.ts @@ -5,7 +5,7 @@ import { SelectFolderModalSelectors, } from '@/src/ui/selectors'; import { BaseElement } from '@/src/ui/webElements/baseElement'; -import { Folders } from '@/src/ui/webElements/folders'; +import { Folders } from '@/src/ui/webElements/entityTree/folders'; import { Page } from '@playwright/test'; export class SelectFolderModal extends BaseElement { @@ -13,14 +13,14 @@ export class SelectFolderModal extends BaseElement { super(page, SelectFolderModalSelectors.modalContainer); } - private uploadFolder!: Folders; + private selectFolders!: Folders; public allFoldersSection = this.getChildElementBySelector( SelectFolderModalSelectors.allFolders, ); - public allFilesRoot = this.getChildElementBySelector( - SelectFolderModalSelectors.uploadRootFolder, + public rootFolder = this.getChildElementBySelector( + SelectFolderModalSelectors.rootFolder, ); public selectFolderErrorText = this.getChildElementBySelector( @@ -29,15 +29,15 @@ export class SelectFolderModal extends BaseElement { public closeModal = this.getChildElementBySelector(IconSelectors.cancelIcon); - getUploadFolder() { - if (!this.uploadFolder) { - this.uploadFolder = new Folders( + getSelectFolders() { + if (!this.selectFolders) { + this.selectFolders = new Folders( this.page, this.getElementLocator(), - SelectFolderModalSelectors.uploadFolders, + SelectFolderModalSelectors.selectFolders, ); } - return this.uploadFolder; + return this.selectFolders; } public newFolderButton = this.getChildElementBySelector( @@ -52,7 +52,7 @@ export class SelectFolderModal extends BaseElement { const respPremise = this.page.waitForResponse((r) => r.request().url().includes(API.listingHost), ); - await this.getUploadFolder().getFolderName(folderName).click(); + await this.getSelectFolders().getFolderName(folderName).click(); await respPremise; } @@ -60,7 +60,7 @@ export class SelectFolderModal extends BaseElement { const respPremise = this.page.waitForResponse((r) => r.request().url().includes(API.listingHost), ); - await this.allFilesRoot.click(); + await this.rootFolder.click(); await respPremise; } } diff --git a/apps/chat-e2e/src/ui/webElements/sharedWithMeConversations.ts b/apps/chat-e2e/src/ui/webElements/sharedWithMeConversations.ts deleted file mode 100644 index 5d9b95e065..0000000000 --- a/apps/chat-e2e/src/ui/webElements/sharedWithMeConversations.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChatBarSelectors } from '../selectors'; - -import { BaseConversation } from '@/src/ui/webElements/baseConversation'; -import { Page } from '@playwright/test'; - -export class SharedWithMeConversations extends BaseConversation { - constructor(page: Page) { - super( - page, - ChatBarSelectors.sharedWithMeChats(), - ChatBarSelectors.conversation, - ); - } -} diff --git a/apps/chat-e2e/src/ui/webElements/sharedWithMePrompts.ts b/apps/chat-e2e/src/ui/webElements/sharedWithMePrompts.ts deleted file mode 100644 index 334959be93..0000000000 --- a/apps/chat-e2e/src/ui/webElements/sharedWithMePrompts.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { PromptBarSelectors } from '../selectors'; - -import { Styles } from '@/src/ui/domData'; -import { SideBarEntities } from '@/src/ui/webElements/sideBarEntities'; -import { Page } from '@playwright/test'; - -export class SharedWithMePrompts extends SideBarEntities { - constructor(page: Page) { - super( - page, - PromptBarSelectors.sharedWithMePrompts(), - PromptBarSelectors.prompt, - ); - } - - public async getSharedPromptBackgroundColor(name: string, index?: number) { - const backgroundColor = await this.createElementFromLocator( - this.getEntityByName(name, index), - ).getComputedStyleProperty(Styles.backgroundColor); - return backgroundColor[0]; - } -} diff --git a/apps/chat-e2e/src/ui/webElements/uploadFromDeviceModal.ts b/apps/chat-e2e/src/ui/webElements/uploadFromDeviceModal.ts index 8009503434..c32b4ecb5d 100644 --- a/apps/chat-e2e/src/ui/webElements/uploadFromDeviceModal.ts +++ b/apps/chat-e2e/src/ui/webElements/uploadFromDeviceModal.ts @@ -8,6 +8,7 @@ import { IconSelectors, UploadFromDeviceModalSelectors, } from '@/src/ui/selectors'; +import { ChangePath } from '@/src/ui/webElements/changePath'; import { FilesModalHeader } from '@/src/ui/webElements/filesModalHeader'; import { Page } from '@playwright/test'; @@ -17,6 +18,7 @@ export class UploadFromDeviceModal extends BaseElement { } private modalHeader!: FilesModalHeader; + private changeUploadToPath!: ChangePath; getModalHeader(): FilesModalHeader { if (!this.modalHeader) { @@ -25,6 +27,13 @@ export class UploadFromDeviceModal extends BaseElement { return this.modalHeader; } + getChangeUploadToPath(): ChangePath { + if (!this.changeUploadToPath) { + this.changeUploadToPath = new ChangePath(this.page, this.rootLocator); + } + return this.changeUploadToPath; + } + public uploadedFiles = this.getChildElementBySelector( UploadFromDeviceModalSelectors.uploadedFiles, ); @@ -39,23 +48,11 @@ export class UploadFromDeviceModal extends BaseElement { public closeButton = this.getChildElementBySelector(IconSelectors.cancelIcon); - public uploadToButton = this.getChildElementBySelector( - UploadFromDeviceModalSelectors.uploadTo, - ); - - public uploadToPath = this.uploadToButton.getChildElementBySelector( - UploadFromDeviceModalSelectors.uploadToPath, - ); - - public changeUploadToButton = this.uploadToButton.getChildElementBySelector( - UploadFromDeviceModalSelectors.changeUploadTo, - ); - public async changeUploadToLocation() { const responsePromise = this.page.waitForResponse( (resp) => resp.request().method() === 'GET', ); - await this.changeUploadToButton.click(); + await this.getChangeUploadToPath().changeButton.click(); await responsePromise; } diff --git a/apps/chat/src/components/Chat/ChangePathDialog.tsx b/apps/chat/src/components/Chat/ChangePathDialog.tsx index bb0685dd64..5a73e8d4cd 100644 --- a/apps/chat/src/components/Chat/ChangePathDialog.tsx +++ b/apps/chat/src/components/Chat/ChangePathDialog.tsx @@ -269,7 +269,7 @@ export const ChangePathDialog = ({ return ( diff --git a/apps/chat/src/components/Chat/ChatSettingsEmpty.tsx b/apps/chat/src/components/Chat/ChatSettingsEmpty.tsx index b4925e2038..d17084cebd 100644 --- a/apps/chat/src/components/Chat/ChatSettingsEmpty.tsx +++ b/apps/chat/src/components/Chat/ChatSettingsEmpty.tsx @@ -64,7 +64,7 @@ export const ChatSettingsEmpty = ({ {appName && (

{isolatedModelId && modelsMap[isolatedModelId] ? ( diff --git a/apps/chat/src/components/Chat/Publish/ApproveRequiredSection.tsx b/apps/chat/src/components/Chat/Publish/ApproveRequiredSection.tsx index c08ea9acb4..541830ccfe 100644 --- a/apps/chat/src/components/Chat/Publish/ApproveRequiredSection.tsx +++ b/apps/chat/src/components/Chat/Publish/ApproveRequiredSection.tsx @@ -102,6 +102,7 @@ const PublicationItem = ({ publication, featureTypes }: PublicationProps) => { ? 'border-l-accent-primary bg-accent-primary-alpha' : 'border-l-transparent', )} + data-qa="folder" >

-