Skip to content

Commit

Permalink
Merge branch 'feat/2641-chat-and-marketplace-header-buttons' of https…
Browse files Browse the repository at this point in the history
…://github.com/epam/ai-dial-chat into feat/2641-chat-and-marketplace-header-buttons
  • Loading branch information
Derikyan committed Nov 26, 2024
2 parents d3ca2c0 + 10b7118 commit d544c9a
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 60 deletions.
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/tests/compareMode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ dialTest(
dataInjector,
compare,
conversations,
chatBar,
header,
chatHeader,
compareConversation,
conversationDropdownMenu,
Expand Down Expand Up @@ -1347,7 +1347,7 @@ dialTest(
await dialTest.step(
'Create new chat and verify Compare mode is closed',
async () => {
await chatBar.createNewConversation();
await header.createNewConversation();
await compare.waitForState({ state: 'hidden' });
},
);
Expand Down
19 changes: 10 additions & 9 deletions apps/chat-e2e/src/tests/conversationNameNumeration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dialTest(
async ({
dialHomePage,
conversations,
chatBar,
header,
conversationData,
dataInjector,
setTestIds,
Expand Down Expand Up @@ -52,7 +52,7 @@ dialTest(
await dialHomePage.waitForPageLoaded();
await conversations.selectConversation(conversation.name);
for (let i = 1; i <= 2; i++) {
await chatBar.createNewConversation();
await header.createNewConversation();
await expect
.soft(
conversations.getEntityByName(
Expand All @@ -74,7 +74,7 @@ dialTest(
async ({
dialHomePage,
conversations,
chatBar,
header,
conversationData,
dataInjector,
conversationDropdownMenu,
Expand Down Expand Up @@ -113,7 +113,7 @@ dialTest(
await dialHomePage.openHomePage();
await dialHomePage.waitForPageLoaded();
await conversations.selectConversation(secondConversation.name);
await chatBar.createNewConversation();
await header.createNewConversation();
await expect
.soft(
conversations.getEntityByName(thirdConversationName),
Expand All @@ -140,7 +140,7 @@ dialTest(
GeneratorUtil.randomString(7),
{ isHttpMethodTriggered: false },
);
await chatBar.createNewConversation();
await header.createNewConversation();
await expect
.soft(
conversations.getEntityByName(fourthConversationName),
Expand All @@ -157,7 +157,7 @@ dialTest(
async ({
dialHomePage,
conversations,
chatBar,
header,
conversationData,
dataInjector,
conversationDropdownMenu,
Expand Down Expand Up @@ -194,7 +194,7 @@ dialTest(
);
await conversationDropdownMenu.selectMenuOption(MenuOptions.delete);
await confirmationDialog.confirm({ triggeredHttpMethod: 'DELETE' });
await chatBar.createNewConversation();
await header.createNewConversation();
await expect
.soft(
conversations.getEntityByName(
Expand All @@ -213,6 +213,7 @@ dialTest(
async ({
dialHomePage,
conversations,
header,
chatBar,
conversationData,
dataInjector,
Expand Down Expand Up @@ -259,7 +260,7 @@ dialTest(
folderConversation.conversations[0].name,
);
await chatBar.createNewFolder();
await chatBar.createNewConversation();
await header.createNewConversation();

await chatBar.dragAndDropEntityToFolder(
conversations.getEntityByName(initConversationName),
Expand All @@ -283,7 +284,7 @@ dialTest(
await dialTest.step(
'Verify one more conversation with name "New conversation 1" can be created',
async () => {
await chatBar.createNewConversation();
await header.createNewConversation();
await expect
.soft(
conversations.getEntityByName(initConversationName),
Expand Down
12 changes: 6 additions & 6 deletions apps/chat-e2e/src/tests/defaultModelSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dialTest(
'Addon icon is set in recent and selected list on default screen for new chat',
async ({
dialHomePage,
chatBar,
header,
conversations,
recentEntities,
entitySettings,
Expand Down Expand Up @@ -66,7 +66,7 @@ dialTest(
await dialHomePage.waitForPageLoaded({
isNewConversationVisible: true,
});
await chatBar.createNewConversation();
await header.createNewConversation();

const todayConversations = await conversations.getTodayConversations();
expect
Expand Down Expand Up @@ -213,7 +213,7 @@ dialTest(
`It's impossible to send a message with spaces only`,
async ({
dialHomePage,
chatBar,
header,
talkToSelector,
chat,
sendMessage,
Expand Down Expand Up @@ -319,7 +319,7 @@ dialTest(
await dialTest.step(
'Create new conversation and verify previous model is preselected and highlighted',
async () => {
await chatBar.createNewConversation();
await header.createNewConversation();
const modelBorderColors = await talkToEntities
.getTalkToEntity(nonDefaultModel)
.getAllBorderColors();
Expand Down Expand Up @@ -407,7 +407,7 @@ dialTest(
'Recent "Talk to" list is updated',
async ({
dialHomePage,
chatBar,
header,
chat,
talkToSelector,
marketplacePage,
Expand All @@ -424,7 +424,7 @@ dialTest(
MockedChatApiResponseBodies.simpleTextBody,
);
await chat.sendRequestWithButton('test message');
await chatBar.createNewConversation();
await header.createNewConversation();
const modelBorderColors = await talkToEntities
.getTalkToEntity(nonDefaultModel)
.getAllBorderColors();
Expand Down
3 changes: 2 additions & 1 deletion apps/chat-e2e/src/tests/entityIcon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dialTest(
dialHomePage,
talkToSelector,
marketplacePage,
header,
addons,
addonsDialog,
iconApiHelper,
Expand Down Expand Up @@ -77,7 +78,7 @@ dialTest(
await dialTest.step(
'Click "See all addons" and verify all addons have valid icons',
async () => {
await marketplaceSidebar.backToChatButton.click();
await header.backToChatButton.click();
const expectedAddons = ModelsUtil.getAddons();
await addons.seeAllAddons();
const actualAddonsIcons = await addonsDialog.getAddonsIcons();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dialTest(
'Create new conversation and send new message',
async ({
dialHomePage,
chatBar,
header,
conversations,
talkToEntities,
entitySettings,
Expand All @@ -41,7 +41,7 @@ dialTest(
await dialHomePage.waitForPageLoaded({
isNewConversationVisible: true,
});
await chatBar.createNewConversation();
await header.createNewConversation();

const todayConversations = await conversations.getTodayConversations();
expect
Expand Down
3 changes: 2 additions & 1 deletion apps/chat-e2e/src/tests/publishConversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dialAdminTest(
adminTooltipAssertion,
baseAssertion,
setTestIds,
header,
}) => {
dialAdminTest.slow();
setTestIds(
Expand Down Expand Up @@ -383,7 +384,7 @@ dialAdminTest(
await dialHomePage.mockChatTextResponse(
MockedChatApiResponseBodies.simpleTextBody,
);
await chatBar.createNewConversation();
await header.createNewConversation();
await chat.sendRequestWithButton('test');
const exportedData: UploadDownloadData =
await dialHomePage.downloadData(
Expand Down
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/tests/scrolling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ dialTest(
conversations,
conversationDropdownMenu,
conversationAssertion,
chatBar,
header,
}) => {
setTestIds('EPMRTC-493', 'EPMRTC-3072', 'EPMRTC-1783', 'EPMRTC-1754');
let firstConversation: Conversation;
Expand Down Expand Up @@ -245,7 +245,7 @@ dialTest(
undefined,
{ isHttpMethodTriggered: false },
);
await chatBar.createNewConversation();
await header.createNewConversation();
await expect
.soft(
sendMessage.scrollDownButton.getElementLocator(),
Expand Down
3 changes: 2 additions & 1 deletion apps/chat-e2e/src/tests/selectChatPanelEntity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ dialTest(
conversations,
folderConversations,
chatBar,
header,
chatFilter,
chatFilterDropdownMenu,
dataInjector,
Expand Down Expand Up @@ -1538,7 +1539,7 @@ dialTest(
async () => {
await conversations.openEntityDropdownMenu(singleConversation.name);
await conversationDropdownMenu.selectMenuOption(MenuOptions.select);
await chatBar.createNewConversation();
await header.createNewConversation();
await chatBarAssertion.assertUnselectAllButtonState('hidden');
},
);
Expand Down
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/tests/sharedChatIcons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ dialTest(
additionalUserShareApiHelper,
conversationDropdownMenu,
confirmationDialog,
chatBar,
header,
chat,
conversationAssertion,
setTestIds,
Expand Down Expand Up @@ -1115,7 +1115,7 @@ dialTest(
'Create new conversation, send any request and verify Unshare option is not available in context menu',
async () => {
const newChatRequest = '1+2';
await chatBar.createNewConversation();
await header.createNewConversation();
await dialHomePage.mockChatTextResponse(
MockedChatApiResponseBodies.simpleTextBody,
);
Expand Down
2 changes: 2 additions & 0 deletions apps/chat-e2e/src/ui/selectors/headerSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export const HeaderSelectors = {
rightPanelToggle: '[data-qa="right-panel-toggle"]:visible',
banner: '[data-qa="banner"]',
accountSettings: '[data-qa="account-settings"]',
newEntity: '[data-qa="new-entity"]',
backToChatButton: '[data-qa="back-to-chat"]',
};
1 change: 0 additions & 1 deletion apps/chat-e2e/src/ui/selectors/marketplaceSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const MarketplaceDetailsModal = {

export const MarketplaceSideBarSelectors = {
sidebar: '[data-qa="marketplace-sidebar"]',
backToChatButton: '[data-qa="back-to-chat"]',
homePageButton: '[data-qa="home-page"]',
myApplicationsButton: '[data-qa="my-applications"]',
searchInput: '[name="titleInput"]',
Expand Down
2 changes: 1 addition & 1 deletion apps/chat-e2e/src/ui/selectors/sideBarSelectors.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const SideBarSelectors = {
chatBar: '[data-qa="chatbar"]',
promptBar: '[data-qa="promptbar"]',
newEntity: '[data-qa="new-entity"]',
import: '[data-qa="import"]',
export: '[data-qa="export"]',
deleteEntities: '[data-qa="delete-entities"]',
Expand Down Expand Up @@ -55,6 +54,7 @@ export const PromptBarSelectors = {
approveRequiredPrompts: () =>
`${PromptBarSelectors.promptFolders} > ${SideBarSelectors.approveRequiredContainer}`,
leftResizeIcon: '[data-qa="left-resize-icon"]',
newEntity: '[data-qa="new-entity"]',
};

export const EntitySelectors = {
Expand Down
8 changes: 0 additions & 8 deletions apps/chat-e2e/src/ui/webElements/chatBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,6 @@ export class ChatBar extends SideBar {
return this.bottomDropdownMenu;
}

public async createNewConversation() {
const modelsResponsePromise = this.page.waitForResponse(API.modelsHost);
const addonsResponsePromise = this.page.waitForResponse(API.addonsHost);
await this.newEntityButton.click();
await modelsResponsePromise;
await addonsResponsePromise;
}

public async openCompareMode() {
const modelsResponsePromise = this.page.waitForResponse(API.modelsHost);
const addonsResponsePromise = this.page.waitForResponse(API.addonsHost);
Expand Down
17 changes: 17 additions & 0 deletions apps/chat-e2e/src/ui/webElements/header.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { API } from '@/src/testData';
import { HeaderSelectors } from '@/src/ui/selectors';
import { AccountSettings } from '@/src/ui/webElements/accountSettings';
import { BaseElement } from '@/src/ui/webElements/baseElement';
Expand All @@ -23,4 +24,20 @@ export class Header extends BaseElement {
public rightPanelToggle = this.getChildElementBySelector(
HeaderSelectors.rightPanelToggle,
);

public newEntityButton = this.getChildElementBySelector(
HeaderSelectors.newEntity,
);

public backToChatButton = this.getChildElementBySelector(
HeaderSelectors.backToChatButton,
);

public async createNewConversation() {
const modelsResponsePromise = this.page.waitForResponse(API.modelsHost);
const addonsResponsePromise = this.page.waitForResponse(API.addonsHost);
await this.newEntityButton.click();
await modelsResponsePromise;
await addonsResponsePromise;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ export class MarketplaceSidebar extends BaseElement {
return this.marketplaceFilter;
}

public backToChatButton = this.getChildElementBySelector(
MarketplaceSideBarSelectors.backToChatButton,
);
public homePageButton = this.getChildElementBySelector(
MarketplaceSideBarSelectors.homePageButton,
);
Expand Down
23 changes: 22 additions & 1 deletion apps/chat-e2e/src/ui/webElements/promptBar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SideBarSelectors } from '../selectors';
import { PromptBarSelectors, SideBarSelectors } from '../selectors';

import { Styles, removeAlpha } from '@/src/ui/domData';
import {
FolderPrompts,
PromptsTree,
Expand Down Expand Up @@ -56,11 +57,31 @@ export class PromptBar extends SideBar {
return this.sharedFolderPrompts;
}

public newEntityButton = this.getChildElementBySelector(
PromptBarSelectors.newEntity,
);

public async createNewPrompt() {
await this.newEntityButton.waitForState();
await this.newEntityButton.click();
}

public async hoverOverNewEntity() {
await this.newEntityButton.waitForState();
await this.newEntityButton.hoverOver();
}

public async getNewEntityBackgroundColor() {
const backgroundColor = await this.newEntityButton.getComputedStyleProperty(
Styles.backgroundColor,
);
return removeAlpha(backgroundColor[0]);
}

public async getNewEntityCursor() {
return this.newEntityButton.getComputedStyleProperty(Styles.cursor);
}

public async dragAndDropPromptFromFolder(
folderName: string,
promptName: string,
Expand Down
Loading

0 comments on commit d544c9a

Please sign in to comment.