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): duplicate shared prompt tests #2076

Merged
merged 65 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 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
c97d77b
feat/shared-prompt-folder-tests: implemented shared prompt folder tests
irinakartun Aug 20, 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
6b1bdeb
Merge branch 'feat/shared-prompt-folder-icon-tests' of github.com:epa…
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
499e942
feat/view-shared-prompt: implemented tests for shared prompt preview …
irinakartun Aug 28, 2024
773bdfe
Merge branch 'feat/shared-prompt-folder-icon-tests' of github.com:epa…
irinakartun Aug 28, 2024
f00beb6
feat/view-shared-prompt: grammar fix
irinakartun Aug 28, 2024
d6967de
feat/duplicate-shared-prompt: implemented tests for shared prompt dup…
irinakartun Aug 28, 2024
92f210a
feat/shared-prompt-folder-icon-tests: fixed menu select
irinakartun Aug 28, 2024
ab1fce2
Merge branch 'feat/shared-prompt-folder-icon-tests' of github.com:epa…
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
07d00d9
feat/duplicate-shared-prompt-tests: implemented tests for shared prom…
irinakartun Aug 29, 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
4f34b4d
Merge branch 'feat/shared-prompt-folder-icon-tests' of github.com:epa…
irinakartun Aug 30, 2024
62a6961
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Sep 4, 2024
5ca9dfb
feat/shared-prompt-folder-tests: implemented tests for shared prompt …
irinakartun Sep 4, 2024
9c57b5f
feat/shared-prompt-folder-tests: fixed merge conflicts
irinakartun Sep 4, 2024
ec43ac9
Merge branch 'feat/shared-prompt-folder-tests' of github.com:epam/ai-…
irinakartun Sep 5, 2024
db31479
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Sep 5, 2024
867015d
Merge branch 'feat/view-shared-prompt' of github.com:epam/ai-dial-cha…
irinakartun Sep 5, 2024
1c5b3a6
Merge branch 'development' of github.com:epam/ai-dial-chat into feat/…
irinakartun Sep 6, 2024
1d945e4
feat/duplicate-shared-prompt: fixed test
irinakartun Sep 6, 2024
9e9bad1
feat/duplicate-shared-prompt: fixed test
irinakartun Sep 10, 2024
5f71410
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 10, 2024
a157ca6
feat/duplicate-shared-prompt: fixed test
irinakartun Sep 10, 2024
cca805e
Merge remote-tracking branch 'origin/feat/duplicate-shared-prompt' in…
irinakartun Sep 10, 2024
7438153
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 10, 2024
b94aa5b
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 10, 2024
4d6a282
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 11, 2024
149f138
feat/duplicate-shared-prompt: removed unnecessary waits
irinakartun Sep 11, 2024
f48ec47
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 11, 2024
12068cd
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 11, 2024
e275068
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 11, 2024
be0c74b
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 11, 2024
82dedb7
Merge branch 'development' into feat/duplicate-shared-prompt
nartovm Sep 11, 2024
ca8bf6f
Merge branch 'development' into feat/duplicate-shared-prompt
irinakartun Sep 12, 2024
68d50d4
feat/duplicate-shared-prompt: fixed comments
irinakartun Sep 12, 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
28 changes: 28 additions & 0 deletions apps/chat-e2e/src/assertions/api/apiAssertion.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChatBody } from '@/chat/types/chat';
import { DialAIEntityModel } from '@/chat/types/models';
import { Prompt } from '@/chat/types/prompt';
import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
import { expect } from '@playwright/test';
import { APIResponse } from 'playwright-core';
Expand Down Expand Up @@ -102,4 +103,31 @@ export class ApiAssertion {
.toBeDefined();
}
}

public async assertRequestPromptName(request: Prompt, expectedValue: string) {
expect
.soft(request.name, ExpectedMessages.promptRequestNameIsValid)
.toBe(expectedValue);
}

public async assertRequestPromptDescription(
request: Prompt,
expectedValue: string,
) {
expect
.soft(
request.description,
ExpectedMessages.promptRequestDescriptionIsValid,
)
.toBe(expectedValue);
}

public async assertRequestPromptContent(
request: Prompt,
expectedValue: string,
) {
expect
.soft(request.content, ExpectedMessages.promptRequestContentIsValid)
.toBe(expectedValue);
}
}
33 changes: 24 additions & 9 deletions apps/chat-e2e/src/assertions/promptListAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ export class PromptListAssertion {
this.promptList = promptList;
}

public async assertPromptOptionOverflow(name: string) {
public async assertPromptOptionOverflow(
name: string,
expectedOverflow: Overflow,
) {
const promptOptionOverflow = await this.promptList
.getPromptOption(name)
.getComputedStyleProperty(Styles.text_overflow);
expect
.soft(promptOptionOverflow[0], ExpectedMessages.entityNameIsTruncated)
.toBe(Overflow.ellipsis);
.toBe(expectedOverflow);
}

public async assertPromptListState(expectedState: ElementState) {
Expand All @@ -35,12 +38,24 @@ export class PromptListAssertion {
.toBeHidden();
}

public async assertPromptListOptions(expectedOptions: string[]) {
expect
.soft(
await this.promptList.getPromptOptions().getElementsInnerContent(),
ExpectedMessages.promptListValuesIsValid,
)
.toEqual(expectedOptions);
public async assertPromptListOptions(
expectedIncludedOptions: string[],
expectedExcludedOptions?: string[],
) {
const listOptions = await this.promptList
.getPromptOptions()
.getElementsInnerContent();
for (const includedOption of expectedIncludedOptions) {
expect
.soft(listOptions, ExpectedMessages.promptListValuesIsValid)
.toContain(includedOption);
}
if (expectedExcludedOptions) {
for (const excludedOption of expectedExcludedOptions) {
expect
.soft(listOptions, ExpectedMessages.promptListValuesIsValid)
.not.toContain(excludedOption);
}
}
}
}
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/assertions/sendMessageAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export class SendMessageAssertion {
.toBe(initialWidth);
}

public async assertMessageValue(expectedValue: string) {
public async assertMessageValue(expectedValue: string | undefined) {
const messageValue = await this.sendMessage.getMessage();
expect
.soft(messageValue, ExpectedMessages.messageContentIsValid)
.toBe(expectedValue);
.toBe(expectedValue ?? '');
}

public async assertContinueReplayButtonState(expectedState: ElementState) {
Expand Down
42 changes: 42 additions & 0 deletions apps/chat-e2e/src/core/dialSharedWithMeFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Conversations,
DropdownMenu,
EntitySelector,
EntitySettings,
ErrorToast,
FolderPrompts,
PromptBar,
Expand All @@ -26,9 +27,11 @@ import {

import config from '@/config/chat.playwright.config';
import { ConfirmationDialogAssertion } from '@/src/assertions/confirmationDialogAssertion';
import { EntitySettingAssertion } from '@/src/assertions/entitySettingAssertion';
import { FolderAssertion } from '@/src/assertions/folderAssertion';
import { MenuAssertion } from '@/src/assertions/menuAssertion';
import { PromptAssertion } from '@/src/assertions/promptAssertion';
import { PromptListAssertion } from '@/src/assertions/promptListAssertion';
import { PromptModalAssertion } from '@/src/assertions/promptModalAssertion';
import { SendMessageAssertion } from '@/src/assertions/sendMessageAssertion';
import { SharedPromptPreviewModalAssertion } from '@/src/assertions/sharedPromptPreviewModalAssertion';
Expand Down Expand Up @@ -58,6 +61,7 @@ const dialSharedWithMeTest = dialTest.extend<{
additionalShareUserSharedFolderPrompts: SharedFolderPrompts;
additionalShareUserChat: Chat;
additionalShareUserConversationSettings: ConversationSettings;
additionalShareUserEntitySettings: EntitySettings;
additionalShareUserTalkToSelector: EntitySelector;
additionalShareUserRecentEntities: RecentEntities;
additionalShareUserChatHeader: ChatHeader;
Expand Down Expand Up @@ -91,6 +95,9 @@ const dialSharedWithMeTest = dialTest.extend<{
additionalShareUserConfirmationDialogAssertion: ConfirmationDialogAssertion;
additionalShareUserPromptAssertion: PromptAssertion;
additionalShareUserPromptModalAssertion: PromptModalAssertion;
additionalShareUserPromptBarFolderAssertion: FolderAssertion;
additionalShareUserSystemPromptListAssertion: PromptListAssertion;
additionalShareUserEntitySettingAssertion: EntitySettingAssertion;
}>({
additionalShareUserPage: async ({ browser }, use) => {
const context = await browser.newContext({
Expand Down Expand Up @@ -208,6 +215,14 @@ const dialSharedWithMeTest = dialTest.extend<{
additionalShareUserAppContainer.getConversationSettings();
await use(additionalShareUserConversationSettings);
},
additionalShareUserEntitySettings: async (
{ additionalShareUserConversationSettings },
use,
) => {
const additionalShareUserEntitySettings =
additionalShareUserConversationSettings.getEntitySettings();
await use(additionalShareUserEntitySettings);
},
additionalShareUserTalkToSelector: async (
{ additionalShareUserConversationSettings },
use,
Expand Down Expand Up @@ -441,6 +456,33 @@ const dialSharedWithMeTest = dialTest.extend<{
);
await use(additionalShareUserPromptModalAssertion);
},
additionalShareUserPromptBarFolderAssertion: async (
{ additionalShareUserFolderPrompts },
use,
) => {
const additionalShareUserPromptBarFolderAssertion = new FolderAssertion(
additionalShareUserFolderPrompts,
);
await use(additionalShareUserPromptBarFolderAssertion);
},
additionalShareUserSystemPromptListAssertion: async (
{ additionalShareUserEntitySettings },
use,
) => {
const additionalShareUserSystemPromptListAssertion =
new PromptListAssertion(
additionalShareUserEntitySettings.getPromptList(),
);
await use(additionalShareUserSystemPromptListAssertion);
},
additionalShareUserEntitySettingAssertion: async (
{ additionalShareUserEntitySettings },
use,
) => {
const additionalShareUserEntitySettingAssertion =
new EntitySettingAssertion(additionalShareUserEntitySettings);
await use(additionalShareUserEntitySettingAssertion);
},
});

export let shareUserBucket: string;
Expand Down
3 changes: 3 additions & 0 deletions apps/chat-e2e/src/testData/expectedMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ export enum ExpectedMessages {
chatRequestAddonsAreValid = 'Chat API request addons are valid',
chatRequestMessageIsValid = 'Chat API request message is valid',
chatRequestAttachmentIsValid = 'Chat API request attachment is valid',
promptRequestNameIsValid = 'Prompt API request name is valid',
promptRequestDescriptionIsValid = 'Prompt API request description is valid',
promptRequestContentIsValid = 'Prompt API request content is valid',
sendMessageButtonDisabled = 'Send message button is disabled',
sendMessageButtonEnabled = 'Send message button is enabled',
tooltipContentIsValid = 'Tooltip content is valid',
Expand Down
6 changes: 4 additions & 2 deletions apps/chat-e2e/src/tests/compareMode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ dialTest(
.selectModel(firstUpdatedRandomModel);
const leftEntitySettings = leftConversationSettings.getEntitySettings();
if (firstUpdatedRandomModel.features?.systemPrompt) {
await leftEntitySettings.setSystemPrompt(firstUpdatedPrompt);
await leftEntitySettings.clearAndSetSystemPrompt(firstUpdatedPrompt);
}
await leftEntitySettings
.getTemperatureSlider()
Expand All @@ -734,7 +734,9 @@ dialTest(
const rightEntitySettings =
rightConversationSettings.getEntitySettings();
if (secondUpdatedRandomModel.features?.systemPrompt) {
await rightEntitySettings.setSystemPrompt(secondUpdatedPrompt);
await rightEntitySettings.clearAndSetSystemPrompt(
secondUpdatedPrompt,
);
}
await rightEntitySettings
.getTemperatureSlider()
Expand Down
118 changes: 118 additions & 0 deletions apps/chat-e2e/src/tests/duplicateSharedPrompts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import { ShareByLinkResponseModel } from '@/chat/types/share';
import dialSharedWithMeTest from '@/src/core/dialSharedWithMeFixtures';
import { ExpectedConstants, FolderPrompt, MenuOptions } from '@/src/testData';

dialSharedWithMeTest(
'Shared with me. Duplicate prompt.\n' +
'Shared with me. Move duplicated prompt to New folder',
async ({
additionalShareUserDialHomePage,
promptData,
dataInjector,
mainUserShareApiHelper,
additionalUserShareApiHelper,
additionalShareUserSharedFolderPrompts,
additionalShareUserSharedWithMePromptDropdownMenu,
additionalShareUserPrompts,
additionalShareUserPromptBarFolderAssertion,
additionalShareUserPromptDropdownMenu,
additionalShareUserFolderPrompts,
additionalShareUserPromptAssertion,
setTestIds,
}) => {
setTestIds('EPMRTC-1872', 'EPMRTC-2037');
let folderPrompt: FolderPrompt;
let promptName: string;
let shareFolderByLinkResponse: ShareByLinkResponseModel;

await dialSharedWithMeTest.step(
'Prepare folder with prompt and share it',
async () => {
folderPrompt = promptData.prepareDefaultPromptInFolder();
promptName = folderPrompt.prompts[0].name;
await dataInjector.createPrompts(
folderPrompt.prompts,
folderPrompt.folders,
);
shareFolderByLinkResponse =
await mainUserShareApiHelper.shareEntityByLink(
folderPrompt.prompts,
true,
);
await additionalUserShareApiHelper.acceptInvite(
shareFolderByLinkResponse,
);
},
);

await dialSharedWithMeTest.step(
'Select "Duplicate" option in dropdown menu for shared folder prompt and verify prompt is duplicated in Recent section',
async () => {
await additionalShareUserDialHomePage.openHomePage();
await additionalShareUserDialHomePage.waitForPageLoaded({
isNewConversationVisible: true,
});
await additionalShareUserSharedFolderPrompts.expandFolder(
folderPrompt.folders.name,
{ isHttpMethodTriggered: true },
);
await additionalShareUserSharedFolderPrompts.openFolderEntityDropdownMenu(
folderPrompt.folders.name,
promptName,
);
await additionalShareUserSharedWithMePromptDropdownMenu.selectMenuOption(
MenuOptions.duplicate,
{ triggeredHttpMethod: 'POST' },
);
await additionalShareUserPromptAssertion.assertEntityState(
{ name: promptName },
'visible',
);
},
);

await dialSharedWithMeTest.step(
'Verify prompts with incremented names are created on duplication',
async () => {
for (let i = 1; i <= 2; i++) {
await additionalShareUserSharedFolderPrompts.openFolderEntityDropdownMenu(
folderPrompt.folders.name,
promptName,
);
await additionalShareUserSharedWithMePromptDropdownMenu.selectMenuOption(
MenuOptions.duplicate,
{ triggeredHttpMethod: 'POST' },
);
await additionalShareUserPromptAssertion.assertEntityState(
{ name: `${promptName} ${i}` },
'visible',
);
}
},
);

await dialSharedWithMeTest.step(
'Select "Move To -> New folder" option in dropdown menu for duplicated prompt and verify prompt is successfully moved',
async () => {
await additionalShareUserPrompts.openEntityDropdownMenu(
`${promptName} 2`,
);
await additionalShareUserPromptDropdownMenu.selectMenuOption(
MenuOptions.moveTo,
);
await additionalShareUserPromptDropdownMenu.selectMenuOption(
MenuOptions.newFolder,
{ triggeredHttpMethod: 'POST' },
);
await additionalShareUserFolderPrompts.expandFolder(
ExpectedConstants.newFolderWithIndexTitle(1),
);
await additionalShareUserPromptBarFolderAssertion.assertFolderEntityState(
{ name: ExpectedConstants.newFolderWithIndexTitle(1) },
{ name: `${promptName} 2` },
'visible',
);
},
);
},
);
Loading