Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chat-e2e): shared prompt folder icon tests #1954

Merged
merged 44 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
48281c1
feat/added-gpt4o-mini-model: added 'gpt-4o-mini-2024-07-18' model to …
irinakartun Aug 5, 2024
2e490ae
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 6, 2024
38868f8
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 6, 2024
c1a14e6
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 8, 2024
d524ea2
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 8, 2024
6083a80
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 8, 2024
46cef34
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 12, 2024
a6c287b
Merge branch 'development' of github.com:epam/ai-dial-chat into devel…
irinakartun Aug 12, 2024
86facb2
feat/shared-with-me-prompts-tests: implemented tests for shared with …
irinakartun Aug 12, 2024
620b0b1
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Aug 12, 2024
b263940
Merge branch 'development' into feat/shared-with-me-prompts-tests
irinakartun Aug 13, 2024
855d223
Merge branch 'development' into feat/shared-with-me-prompts-tests
irinakartun Aug 13, 2024
bcf4a7b
Merge branch 'development' into feat/shared-with-me-prompts-tests
irinakartun Aug 13, 2024
d378f0a
Merge branch 'development' into feat/shared-with-me-prompts-tests
irinakartun Aug 14, 2024
0767709
Merge branch 'development' into feat/shared-with-me-prompts-tests
irinakartun Aug 16, 2024
cb4b2fc
feat/shared-folder-icon-tests: implemented shared folder icons tests
irinakartun Aug 16, 2024
a8b3aa2
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Aug 22, 2024
9bb0792
feat/shared-prompt-folder-icon-tests: fixed formatting/lint issues
irinakartun Aug 22, 2024
865dcb8
feat/shared-prompt-folder-icon-tests: fixed menu option selection
irinakartun Aug 22, 2024
cfa461e
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Aug 22, 2024
f12aa07
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 22, 2024
ab8c5ff
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 26, 2024
8917e80
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 26, 2024
1a1beef
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 26, 2024
21ba32b
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 27, 2024
1ebb8de
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 27, 2024
acd43da
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 28, 2024
460e343
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 28, 2024
92f210a
feat/shared-prompt-folder-icon-tests: fixed menu select
irinakartun Aug 28, 2024
04e5198
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 28, 2024
e67ed32
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 28, 2024
61753a4
feat/shared-prompt-folder-icon-tests: fixed filter menu select
irinakartun Aug 29, 2024
978bcdf
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Aug 30, 2024
8392328
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Sep 2, 2024
618b3c2
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Sep 2, 2024
1f44556
feat/shared-prompt-folder-icon-tests: fixed merge conflict
irinakartun Sep 2, 2024
81bab8f
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Sep 3, 2024
cf18b49
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
nartovm Sep 3, 2024
5f42587
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Sep 4, 2024
8dd5b6d
feat/shared-prompt-folder-icon-tests: fixed review comments
irinakartun Sep 4, 2024
35838d9
feat/shared-prompt-folder-icon-tests: fixed review comments
irinakartun Sep 4, 2024
8efb550
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Sep 4, 2024
9c0912a
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Sep 4, 2024
9424220
Merge branch 'development' into feat/shared-prompt-folder-icon-tests
irinakartun Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions apps/chat-e2e/src/assertions/folderAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,51 @@ export class FolderAssertion {
.soft(folderLocator, ExpectedMessages.folderIsNotVisible)
.toBeHidden();
}

public async assertFolderArrowIconState(
folder: TreeEntity,
expectedState: ElementState,
) {
const arrowIcon = this.folder.getFolderArrowIcon(folder.name, folder.index);
expectedState === 'visible'
? await expect
.soft(arrowIcon, ExpectedMessages.sharedEntityIconIsVisible)
.toBeVisible()
: await expect
.soft(arrowIcon, ExpectedMessages.sharedEntityIconIsNotVisible)
.toBeHidden();
}

public async assertSharedFolderArrowIconColor(
folder: TreeEntity,
expectedColor: string,
) {
const arrowIconColor = await this.folder.getFolderArrowIconColor(
folder.name,
folder.index,
);
expect
.soft(arrowIconColor[0], ExpectedMessages.sharedIconColorIsValid)
.toBe(expectedColor);
}

public async assertFolderEntityArrowIconState(
folder: TreeEntity,
folderEntity: TreeEntity,
expectedState: ElementState,
) {
const entityArrowIcon = this.folder.getFolderEntityArrowIcon(
folder.name,
folderEntity.name,
folder.index,
folderEntity.index,
);
expectedState === 'visible'
? await expect
.soft(entityArrowIcon, ExpectedMessages.sharedEntityIconIsVisible)
.toBeVisible()
: await expect
.soft(entityArrowIcon, ExpectedMessages.sharedEntityIconIsNotVisible)
.toBeHidden();
}
}
5 changes: 5 additions & 0 deletions apps/chat-e2e/src/core/dialFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ const dialTest = test.extend<
accountSettingsAssertion: AccountSettingsAssertion;
accountDropdownMenuAssertion: MenuAssertion;
conversationDropdownMenuAssertion: MenuAssertion;
folderDropdownMenuAssertion: MenuAssertion;
settingsModalAssertion: SettingsModalAssertion;
sendMessageAssertion: SendMessageAssertion;
chatHeaderAssertion: ChatHeaderAssertion;
Expand Down Expand Up @@ -693,6 +694,10 @@ const dialTest = test.extend<
);
await use(conversationDropdownMenuAssertion);
},
folderDropdownMenuAssertion: async ({ folderDropdownMenu }, use) => {
const folderDropdownMenuAssertion = new MenuAssertion(folderDropdownMenu);
await use(folderDropdownMenuAssertion);
},
settingsModalAssertion: async ({ settingsModal }, use) => {
const settingsModalAssertion = new SettingsModalAssertion(settingsModal);
await use(settingsModalAssertion);
Expand Down
5 changes: 4 additions & 1 deletion apps/chat-e2e/src/testData/expectedConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const ExpectedConstants = {
'Model changing will stop sharing and other users will no longer see this conversation.',
renameSharedPromptMessage:
'Renaming will stop sharing and other users will no longer see this prompt.',
unshareFolderMessage: 'Are you sure that you want to unshare this folder?',
irinakartun marked this conversation as resolved.
Show resolved Hide resolved
backgroundColorPattern: /(rgba\(\d+,\s*\d+,\s*\d+),\s*\d+\.*\d+\)/,
sendMessageTooltip: 'Please type a message',
sendMessageAttachmentLoadingTooltip: 'Please wait for the attachment to load',
Expand Down Expand Up @@ -106,8 +107,10 @@ export const ExpectedConstants = {
'This link is temporary and will be active for 3 days. This conversation and future changes to it will be visible to users who follow the link. Only owner will be able to make changes. Renaming or changing the model will stop sharing.',
sharePromptText:
'This link is temporary and will be active for 3 days. This prompt and future changes to it will be visible to users who follow the link. Only owner will be able to make changes. Renaming will stop sharing.',
shareFolderText:
shareConversationFolderText:
'This link is temporary and will be active for 3 days. This conversation folder and future changes to it will be visible to users who follow the link. Only owner will be able to make changes. Renaming will stop sharing.',
sharePromptFolderText:
'This link is temporary and will be active for 3 days. This prompt folder and future changes to it will be visible to users who follow the link. Only owner will be able to make changes. Renaming will stop sharing.',
chatNotFoundMessage:
'Conversation not found.Please select another conversation.',
promptNameLabel: 'promptName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ dialTest(

await dialTest.step('Click on Duplicate', async () => {
await conversations.openEntityDropdownMenu(firstConversation.name, 2);
await conversationDropdownMenu.selectMenuOption(MenuOptions.duplicate);
await conversationDropdownMenu.selectMenuOption(MenuOptions.duplicate, {
triggeredHttpMethod: 'POST',
});
clonedConversation = `${firstConversation.name} 1`;
await conversations.getEntityByName(clonedConversation).waitFor();
await conversationAssertion.assertSelectedConversation(
Expand Down
14 changes: 9 additions & 5 deletions apps/chat-e2e/src/tests/duplicateConversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dialTest(
async ({
dialHomePage,
conversations,
conversationDropdownMenu,
setTestIds,
conversationData,
localStorageManager,
Expand Down Expand Up @@ -49,9 +50,12 @@ dialTest(
await dialHomePage.waitForPageLoaded();
for (let i = 1; i <= 2; i++) {
await conversations.openEntityDropdownMenu(conversation.name, i);
await conversations.selectEntityMenuOption(MenuOptions.duplicate, {
triggeredHttpMethod: 'POST',
});
await conversationDropdownMenu.selectMenuOption(
MenuOptions.duplicate,
{
triggeredHttpMethod: 'POST',
},
);
await expect
.soft(
conversations.getEntityByName(
Expand Down Expand Up @@ -79,7 +83,7 @@ dialTest(
folderConversations,
setTestIds,
conversationData,
conversations,
conversationDropdownMenu,
localStorageManager,
dataInjector,
}) => {
Expand Down Expand Up @@ -107,7 +111,7 @@ dialTest(
folderConversation.folders.name,
folderConversation.conversations[0].name,
);
await conversations.selectEntityMenuOption(MenuOptions.duplicate, {
await conversationDropdownMenu.selectMenuOption(MenuOptions.duplicate, {
triggeredHttpMethod: 'POST',
});
await expect
Expand Down
28 changes: 24 additions & 4 deletions apps/chat-e2e/src/tests/duplicatePrompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ExpectedConstants,
ExpectedMessages,
FolderPrompt,
MenuOptions,
} from '@/src/testData';
import { expect } from '@playwright/test';

Expand All @@ -13,7 +14,14 @@ const promptDescr = `line1\nline2`;
dialTest(
'Duplicate prompt located in recent.\n' +
'Duplicate prompt located in recent several times to check postfixes',
async ({ dialHomePage, promptData, prompts, dataInjector, setTestIds }) => {
async ({
dialHomePage,
promptData,
prompts,
promptDropdownMenu,
dataInjector,
setTestIds,
}) => {
setTestIds('EPMRTC-2998', 'EPMRTC-3049');
let prompt: Prompt;

Expand All @@ -29,7 +37,13 @@ dialTest(
await dialHomePage.waitForPageLoaded();
for (let i = 1; i <= 2; i++) {
await prompts.openEntityDropdownMenu(prompt.name, i);
const request = await prompts.duplicatePrompt();
const response = await promptDropdownMenu.selectMenuOption(
MenuOptions.duplicate,
{
triggeredHttpMethod: 'POST',
},
);
const request = await response?.request().postDataJSON();
await expect
.soft(
prompts.getEntityByName(
Expand Down Expand Up @@ -57,7 +71,7 @@ dialTest(
folderPrompts,
setTestIds,
promptData,
prompts,
promptDropdownMenu,
dataInjector,
}) => {
setTestIds('EPMRTC-2999');
Expand All @@ -84,7 +98,13 @@ dialTest(
folderPrompt.folders.name,
folderPrompt.prompts[0].name,
);
const request = await prompts.duplicatePrompt();
const response = await promptDropdownMenu.selectMenuOption(
MenuOptions.duplicate,
{
triggeredHttpMethod: 'POST',
},
);
const request = await response?.request().postDataJSON();
await expect
.soft(
folderPrompts.getFolderEntity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dialSharedWithMeTest(
additionalUserShareApiHelper,
additionalShareUserDialHomePage,
additionalShareUserSharedWithMeConversations,
additionalShareUserSharedWithMeConversationDropdownMenu,
additionalShareUserConversations,
additionalShareUserChatMessages,
additionalShareUserChat,
Expand Down Expand Up @@ -58,11 +59,9 @@ dialSharedWithMeTest(
await additionalShareUserSharedWithMeConversations.openEntityDropdownMenu(
conversation.name,
);
await additionalShareUserSharedWithMeConversations.selectEntityMenuOption(
await additionalShareUserSharedWithMeConversationDropdownMenu.selectMenuOption(
MenuOptions.duplicate,
{
triggeredHttpMethod: 'POST',
},
{ triggeredHttpMethod: 'POST' },
);
await additionalShareUserConversations
.getEntityByName(conversation.name)
Expand Down
101 changes: 60 additions & 41 deletions apps/chat-e2e/src/tests/folderPrompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,62 +65,81 @@ dialTest(
);

dialTest(
'Rename prompt folder on Enter.\n' + 'Rename prompt folders on nested levels',
'Share option is unavailable in prompt folder if there is no any prompt inside.\n' +
'Rename prompt folder on Enter.\n' +
'Rename prompt folders on nested levels',
async ({
dialHomePage,
promptBar,
folderPrompts,
folderDropdownMenu,
folderDropdownMenuAssertion,
promptBarFolderAssertion,
setTestIds,
}) => {
setTestIds('EPMRTC-948', 'EPMRTC-1382');
setTestIds('EPMRTC-2730', 'EPMRTC-948', 'EPMRTC-1382');
const newName = 'updated folder name';
const randomFolderIndex = GeneratorUtil.randomNumberInRange(2) + 1;

await dialHomePage.openHomePage();
await dialHomePage.waitForPageLoaded();
await dialTest.step(
'Prepare nested folders hierarchy and expand it',
async () => {
await dialHomePage.openHomePage();
await dialHomePage.waitForPageLoaded();

for (let i = 1; i <= 3; i++) {
await promptBar.createNewFolder();
}
for (let i = 3; i >= 2; i--) {
await promptBar.dragAndDropEntityToFolder(
folderPrompts.getFolderByName(
ExpectedConstants.newFolderWithIndexTitle(i),
),
folderPrompts.getFolderByName(
ExpectedConstants.newFolderWithIndexTitle(i - 1),
),
);
}
await folderPrompts.expandFolder(
ExpectedConstants.newFolderWithIndexTitle(2),
for (let i = 1; i <= 3; i++) {
await promptBar.createNewFolder();
}
for (let i = 3; i >= 2; i--) {
await promptBar.dragAndDropEntityToFolder(
folderPrompts.getFolderByName(
ExpectedConstants.newFolderWithIndexTitle(i),
),
folderPrompts.getFolderByName(
ExpectedConstants.newFolderWithIndexTitle(i - 1),
),
);
}
await folderPrompts.expandFolder(
ExpectedConstants.newFolderWithIndexTitle(2),
);
},
);

await folderPrompts.openFolderDropdownMenu(
ExpectedConstants.newFolderWithIndexTitle(randomFolderIndex),
await dialTest.step(
'Open folder dropdown menu and verify available options',
async () => {
await folderPrompts.openFolderDropdownMenu(
ExpectedConstants.newFolderWithIndexTitle(randomFolderIndex),
);
await folderDropdownMenuAssertion.assertMenuOptions([
MenuOptions.select,
MenuOptions.rename,
MenuOptions.delete,
]);
},
);
await folderDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithEnter(newName);
await expect
.soft(
folderPrompts.getFolderByName(newName),
ExpectedMessages.folderNameUpdated,
)
.toBeVisible();

for (let i = 1; i <= 3; i++) {
if (i !== randomFolderIndex) {
await expect
.soft(
folderPrompts.getFolderByName(
ExpectedConstants.newFolderWithIndexTitle(i),
),
ExpectedMessages.folderNameNotUpdated,
)
.toBeVisible();
}
}
await dialTest.step(
'Select "Rename" option, set new name and verify folder is renamed',
async () => {
await folderDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithEnter(newName);
await promptBarFolderAssertion.assertFolderState(
{ name: newName },
'visible',
);

for (let i = 1; i <= 3; i++) {
if (i !== randomFolderIndex) {
await promptBarFolderAssertion.assertFolderState(
{ name: ExpectedConstants.newFolderWithIndexTitle(i) },
'visible',
);
}
}
},
);
},
);

Expand Down
5 changes: 3 additions & 2 deletions apps/chat-e2e/src/tests/parametrizedReplay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ dialTest(
chatBar.importButton.click(),
);
await conversations.openEntityDropdownMenu(conversation.name);
await conversations.selectEntityMenuOption(MenuOptions.replay, {
await conversationDropdownMenu.selectMenuOption(MenuOptions.replay, {
irinakartun marked this conversation as resolved.
Show resolved Hide resolved
triggeredHttpMethod: 'POST',
});
await chat.replay.click();
Expand Down Expand Up @@ -324,6 +324,7 @@ dialSharedWithMeTest(
additionalShareUserLocalStorageManager,
additionalShareUserDialHomePage,
additionalShareUserSharedWithMeConversations,
additionalShareUserSharedWithMeConversationDropdownMenu,
additionalShareUserChat,
additionalShareUserVariableModalAssertion,
}) => {
Expand Down Expand Up @@ -376,7 +377,7 @@ dialSharedWithMeTest(
await additionalShareUserSharedWithMeConversations.openEntityDropdownMenu(
conversation.name,
);
await additionalShareUserSharedWithMeConversations.selectEntityMenuOption(
await additionalShareUserSharedWithMeConversationDropdownMenu.selectMenuOption(
MenuOptions.replay,
{
triggeredHttpMethod: 'POST',
Expand Down
3 changes: 2 additions & 1 deletion apps/chat-e2e/src/tests/promptUsage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ dialTest(
entitySettingAssertion,
variableModalDialog,
conversations,
conversationDropdownMenu,
chat,
setTestIds,
}) => {
Expand Down Expand Up @@ -563,7 +564,7 @@ dialTest(
);
await chat.sendRequestWithKeyboard(newName);
await conversations.openEntityDropdownMenu(newName);
await conversations.selectEntityMenuOption(MenuOptions.replay, {
await conversationDropdownMenu.selectMenuOption(MenuOptions.replay, {
triggeredHttpMethod: 'POST',
});
},
Expand Down
Loading
Loading