Skip to content

Commit

Permalink
feat(chat-e2e): e2e publishing preparation (#2074)
Browse files Browse the repository at this point in the history
Co-authored-by: Ilya Bondar <[email protected]>
  • Loading branch information
irinakartun and IlyaBondar authored Sep 17, 2024
1 parent 9585387 commit 8f78c2a
Show file tree
Hide file tree
Showing 88 changed files with 1,263 additions and 551 deletions.
18 changes: 10 additions & 8 deletions apps/chat-e2e/src/assertions/conversationAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Conversations> {
export class ConversationAssertion extends SideBarEntityAssertion<ConversationsTree> {
public async assertReplayIconState(
entity: TreeEntity,
expectedState: ElementState,
) {
const entityIcon = this.sideBarEntities.getConversationReplayIcon(
const entityIcon = this.sideBarEntitiesTree.getEntityReplayIcon(
entity.name,
entity.index,
);
Expand All @@ -31,9 +31,9 @@ export class ConversationAssertion extends SideBarEntityAssertion<Conversations>
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}`)
Expand All @@ -42,15 +42,17 @@ export class ConversationAssertion extends SideBarEntityAssertion<Conversations>

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);
}

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,
);
Expand Down
2 changes: 1 addition & 1 deletion apps/chat-e2e/src/assertions/folderAssertion.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/assertions/promptAssertion.ts
Original file line number Diff line number Diff line change
@@ -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<Prompts> {}
export class PromptAssertion extends SideBarEntityAssertion<PromptsTree> {}
6 changes: 3 additions & 3 deletions apps/chat-e2e/src/assertions/sharedWithMePromptsAssertion.ts
Original file line number Diff line number Diff line change
@@ -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<SharedWithMePrompts> {
export class SharedWithMePromptsAssertion extends SideBarEntityAssertion<SharedWithMePromptsTree> {
public async assertSharedEntityBackgroundColor(
entity: TreeEntity,
expectedColor: string,
) {
const entityBackgroundColor =
await this.sideBarEntities.getSharedPromptBackgroundColor(
await this.sideBarEntitiesTree.getEntityBackgroundColor(
entity.name,
entity.index,
);
Expand Down
39 changes: 20 additions & 19 deletions apps/chat-e2e/src/assertions/sideBarEntityAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends SideBarEntities> {
readonly sideBarEntities: T;
export class SideBarEntityAssertion<T extends SideBarEntitiesTree> {
readonly sideBarEntitiesTree: T;

constructor(sideBarEntities: T) {
this.sideBarEntities = sideBarEntities;
this.sideBarEntitiesTree = sideBarEntities;
}

public async assertEntityAndCheckboxHasSelectedColors(
Expand All @@ -32,7 +32,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedState: ElementState,
) {
const entityLocator = this.sideBarEntities.getEntityByName(
const entityLocator = this.sideBarEntitiesTree.getEntityByName(
entity.name,
entity.index,
);
Expand All @@ -49,7 +49,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedState: ElementState,
) {
const entityCheckboxLocator = this.sideBarEntities.getEntityCheckbox(
const entityCheckboxLocator = this.sideBarEntitiesTree.getEntityCheckbox(
entity.name,
entity.index,
);
Expand All @@ -72,7 +72,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
: ExpectedMessages.entityIsNotChecked;
expect
.soft(
await this.sideBarEntities.getEntityCheckboxState(
await this.sideBarEntitiesTree.getEntityCheckboxState(
entity.name,
entity.index,
),
Expand All @@ -85,7 +85,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedState: ElementState,
) {
const dotsMenuLocator = this.sideBarEntities.entityDotsMenu(
const dotsMenuLocator = this.sideBarEntitiesTree.entityDotsMenu(
entity.name,
entity.index,
);
Expand All @@ -102,7 +102,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedState: ElementState,
) {
await this.sideBarEntities.getEntityByName(entity.name).hover();
await this.sideBarEntitiesTree.getEntityByName(entity.name).hover();
await this.assertEntityDotsMenuState(
{
name: entity.name,
Expand All @@ -115,7 +115,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
expectedColor: string,
) {
const entityBackgroundColor =
await this.sideBarEntities.getEntityBackgroundColor(
await this.sideBarEntitiesTree.getEntityBackgroundColor(
entity.name,
entity.index,
);
Expand All @@ -131,7 +131,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedColor: string,
) {
const checkboxElement = this.sideBarEntities.getEntityCheckboxElement(
const checkboxElement = this.sideBarEntitiesTree.getEntityCheckboxElement(
entity.name,
entity.index,
);
Expand All @@ -145,7 +145,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedColor: string,
) {
const checkboxElement = this.sideBarEntities.getEntityCheckboxElement(
const checkboxElement = this.sideBarEntitiesTree.getEntityCheckboxElement(
entity.name,
entity.index,
);
Expand All @@ -161,7 +161,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
}

public async assertEntityIcon(entity: TreeEntity, expectedIcon: string) {
const entityIcon = await this.sideBarEntities.getEntityIcon(
const entityIcon = await this.sideBarEntitiesTree.getEntityIcon(
entity.name,
entity.index,
);
Expand All @@ -174,7 +174,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedState: ElementState,
) {
const arrowIcon = this.sideBarEntities.getEntityArrowIcon(
const arrowIcon = this.sideBarEntitiesTree.getEntityArrowIcon(
entity.name,
entity.index,
);
Expand All @@ -191,10 +191,11 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
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);
Expand All @@ -204,7 +205,7 @@ export class SideBarEntityAssertion<T extends SideBarEntities> {
entity: TreeEntity,
expectedCount: number,
) {
const arrowIconsCount = await this.sideBarEntities
const arrowIconsCount = await this.sideBarEntitiesTree
.getEntityArrowIcon(entity.name, entity.index)
.count();
expect
Expand Down
37 changes: 22 additions & 15 deletions apps/chat-e2e/src/core/dialFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
ChatNotFound,
ConversationSettings,
ConversationToCompare,
Conversations,
EntitySelector,
Folders,
MoreInfo,
PromptBar,
SelectFolderModal,
Expand Down Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 8f78c2a

Please sign in to comment.