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): move from edit to move endpoint for conversations/prompts rename (Issue #3052) #3062

Merged
merged 44 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
765cd44
feat(chat): move from to endpoint for conversations/prompts rename …
Alexander-Kezik Jan 30, 2025
6687928
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Jan 30, 2025
9f9d1fc
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Jan 31, 2025
e0c1ccc
feat/3052-from-edit-to-move-endpoint: fixed method to rename
irinakartun Jan 31, 2025
48e4b49
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Jan 31, 2025
be5a177
fix local conversations
Alexander-Kezik Jan 31, 2025
1c088f4
fix prompt name saving
Alexander-Kezik Jan 31, 2025
250aed0
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Jan 31, 2025
87bb1a8
feat/3052-from-edit-to-move-endpoint: fixed more e2e
irinakartun Jan 31, 2025
6e588d6
fix updates and remove unhare dialogs
Alexander-Kezik Feb 3, 2025
889efd9
fix prompt update
Alexander-Kezik Feb 3, 2025
83a3577
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 3, 2025
a2cb220
remoce logs
Alexander-Kezik Feb 3, 2025
cac14d8
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 3, 2025
22836a4
revert rename folder confirmation for shared folders
Alexander-Kezik Feb 3, 2025
606a501
do not trigger update when creating new prompt
Alexander-Kezik Feb 3, 2025
a01f60d
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Feb 4, 2025
4a59021
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 4, 2025
cb9c42a
fix import
Alexander-Kezik Feb 4, 2025
4adacf4
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 4, 2025
eee2e78
refactor to previous logic and replace recreate with move
Alexander-Kezik Feb 4, 2025
d07dd5d
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 4, 2025
15d4254
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Feb 4, 2025
73b1224
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Feb 4, 2025
e797f9c
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
irinakartun Feb 4, 2025
2ae7206
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Feb 5, 2025
a486fa5
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Feb 5, 2025
9c2c702
fix conversation/prompt update
Alexander-Kezik Feb 5, 2025
ae82cdc
remove ignore elements
Alexander-Kezik Feb 5, 2025
427f9c6
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 5, 2025
e98b941
refactor with regeneratePromptId
Alexander-Kezik Feb 5, 2025
1adcc03
remove imports
Alexander-Kezik Feb 5, 2025
786b118
feat/3052-from-edit-to-move-endpoint: fixed e2e
irinakartun Feb 5, 2025
9437875
Merge remote-tracking branch 'origin/feat/3052-from-edit-to-move-endp…
irinakartun Feb 5, 2025
bc989d4
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
Alexander-Kezik Feb 5, 2025
14c1723
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
irinakartun Feb 6, 2025
21594b1
feat/3052-from-edit-to-move-endpoint: improved e2e
irinakartun Feb 6, 2025
3f3a7c2
feat/3052-from-edit-to-move-endpoint: added Get response waiting on c…
irinakartun Feb 6, 2025
ba28e2f
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
irinakartun Feb 6, 2025
0499e28
Revert "feat/3052-from-edit-to-move-endpoint: added Get response wait…
irinakartun Feb 6, 2025
c9ab9b5
feat/3052-from-edit-to-move-endpoint: fixed tests with agent change
irinakartun Feb 6, 2025
878a640
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
irinakartun Feb 6, 2025
9d3df94
feat/3052-from-edit-to-move-endpoint: fixed tests
irinakartun Feb 6, 2025
2d24bb0
Merge branch 'development' into feat/3052-from-edit-to-move-endpoint
IlyaBondar Feb 7, 2025
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
42 changes: 21 additions & 21 deletions apps/chat-e2e/src/assertions/api/apiAssertion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChatBody } from '@/chat/types/chat';
import { MoveModel } from '@/chat/types/common';
import { DialAIEntityModel } from '@/chat/types/models';
import { Prompt } from '@/chat/types/prompt';
import { ExpectedConstants, ExpectedMessages } from '@/src/testData';
import { Message } from '@epam/ai-dial-shared';
import { expect } from '@playwright/test';
Expand Down Expand Up @@ -123,30 +123,30 @@ export class ApiAssertion {
.toBe(expectedMessage);
}

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

public async assertRequestPromptDescription(
request: Prompt,
expectedValue: string,
public async assertMoveRequest(
request: MoveModel,
expectedDestination: string,
expectedSource: string,
isOverwritten = false,
) {
expect
.soft(
request.description,
ExpectedMessages.promptRequestDescriptionIsValid,
request.destinationUrl.endsWith(`/${expectedDestination}`),
ExpectedMessages.moveDestinationIsValid,
)
.toBe(expectedValue);
}

public async assertRequestPromptContent(
request: Prompt,
expectedValue: string,
) {
.toBeTruthy();
expect
.soft(request.content, ExpectedMessages.promptRequestContentIsValid)
.toBe(expectedValue);
.soft(
request.sourceUrl.endsWith(`/${expectedSource}`),
ExpectedMessages.moveSourceIsValid,
)
.toBeTruthy();
isOverwritten
? expect
.soft(isOverwritten, ExpectedMessages.moveSourceIsValid)
.toBeTruthy()
: expect
.soft(isOverwritten, ExpectedMessages.moveOverwriteIsValid)
.toBeFalsy();
}
}
16 changes: 5 additions & 11 deletions apps/chat-e2e/src/testData/expectedConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,11 @@ export const ExpectedConstants = {
'Deleting will stop sharing and other users will no longer see this conversation.',
renameSharedFolderMessage:
'Renaming will stop sharing and other users will no longer see this folder.',
renameSharedConversationMessage:
'Renaming will stop sharing and other users will no longer see this conversation.',
deleteSharedPromptMessage:
'Are you sure that you want to delete a prompt?\n' +
'Deleting will stop sharing and other users will no longer see this prompt.',
sharedConversationModelChangeDialogTitle: 'Confirm model changing',
renameSharedConversationDialogTitle: 'Confirm renaming conversation',
renameSharedPromptDialogTitle: 'Confirm renaming prompt',
notAllowedToMoveParentToChild:
"It's not allowed to move parent folder in child folder",
sharedConversationModelChangeMessage:
'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.',
deletePromptConfirmationModalTitle: 'Confirm deleting prompt',
deletePromptConfirmationModalMessage:
'Are you sure that you want to delete a prompt?',
Expand Down Expand Up @@ -116,9 +107,9 @@ export const ExpectedConstants = {
responseFileUrlContentPattern: (model: string) =>
new RegExp('/appdata/' + model + '/images/.*\\.png', 'g'),
shareConversationText:
'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.',
'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.',
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.',
'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.',
shareApplicationText:
'This application and its updates will be visible to users with the link. Renaming or changing the version will stop sharing.',
shareConversationFolderText:
Expand Down Expand Up @@ -300,6 +291,9 @@ export const API = {
promptsHost: () => `${API.listingHost}/prompts`,
filesListingHost: () => `${API.listingHost}/files`,
fileHost: '/api/files',
conversationHost: '/api/conversations',
promptHost: '/api/prompts',
moveHost: '/api/ops/resource/move',
importFileRootPath: (bucket: string) => `files/${bucket}`,
modelFilePath: (modelId: string) => `appdata/${modelId}/images`,
importFilePath: (bucket: string, modelId: string) =>
Expand Down
6 changes: 3 additions & 3 deletions apps/chat-e2e/src/testData/expectedMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +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',
moveDestinationIsValid = 'Move API request destination is valid',
moveSourceIsValid = 'Move API request source is valid',
moveOverwriteIsValid = 'Move API request overwrite is valid',
sendMessageButtonDisabled = 'Send message button is disabled',
sendMessageButtonEnabled = 'Send message button is enabled',
tooltipContentIsValid = 'Tooltip content is valid',
Expand Down
1 change: 0 additions & 1 deletion apps/chat-e2e/src/tests/defaultModelSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ dialTest(
});
await dialHomePage.waitForPageLoaded();
await chat.changeAgentButton.click();
nonDefaultModel = ModelsUtil.getModel('gpt-4-turbo-2024-04-09')!;
await talkToAgentDialog.selectAgent(nonDefaultModel, marketplacePage);
await dialHomePage.mockChatTextResponse(
MockedChatApiResponseBodies.simpleTextBody,
Expand Down
1 change: 1 addition & 0 deletions apps/chat-e2e/src/tests/folderNameNumeration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ dialTest(
await folderDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderConversations.editFolderNameWithTick(
GeneratorUtil.randomString(5),
{ isHttpMethodTriggered: false },
);

await chatBar.createNewFolder();
Expand Down
4 changes: 3 additions & 1 deletion apps/chat-e2e/src/tests/parametrizedReplay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ dialTest(
await dialTest.step(
'Export conversation and then delete all Dial entities',
async () => {
await conversations.openEntityDropdownMenu(conversation.name, 2);
await conversations.openEntityDropdownMenu(conversation.name, {
exactMatch: true,
});
await conversationDropdownMenu.selectMenuOption(MenuOptions.export);
exportedData = await dialHomePage.downloadData(
() =>
Expand Down
5 changes: 4 additions & 1 deletion apps/chat-e2e/src/tests/promptFolderNamesakes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ dialTest(
ExpectedConstants.newFolderWithIndexTitle(1),
);
await promptDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(duplicatedFolderName);
await folderPrompts.editFolderNameWithTick(duplicatedFolderName, {
isHttpMethodTriggered: false,
});
});

await dialTest.step(
Expand Down Expand Up @@ -207,6 +209,7 @@ dialTest(
await folderDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(
ExpectedConstants.newFolderWithIndexTitle(2),
{ isHttpMethodTriggered: false },
);
});

Expand Down
9 changes: 7 additions & 2 deletions apps/chat-e2e/src/tests/promptFolderNumeration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ dialTest(
ExpectedConstants.newFolderWithIndexTitle(folderNumber),
);
await promptDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick('Renamed Folder');
await folderPrompts.editFolderNameWithTick('Renamed Folder', {
isHttpMethodTriggered: false,
});

await promptBar.createNewFolder();
await expect
Expand Down Expand Up @@ -211,6 +213,7 @@ dialTest(
await promptDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(
ExpectedConstants.newPromptFolderWithIndexTitle(999),
{ isHttpMethodTriggered: false },
);
});

Expand Down Expand Up @@ -285,7 +288,9 @@ dialTest(
ExpectedConstants.newFolderWithIndexTitle(i),
);
await promptDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(duplicatedFolderName);
await folderPrompts.editFolderNameWithTick(duplicatedFolderName, {
isHttpMethodTriggered: false,
});
await expect(
folderPrompts.getFolderByName(duplicatedFolderName, i),
ExpectedMessages.folderNameUpdated,
Expand Down
8 changes: 6 additions & 2 deletions apps/chat-e2e/src/tests/promptFoldersSpecialChars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ dialTest(
});

await dialTest.step('Rename it to contain special characters', async () => {
await folderPrompts.editFolderNameWithTick(newNameWithSpecialChars);
await folderPrompts.editFolderNameWithTick(newNameWithSpecialChars, {
isHttpMethodTriggered: false,
});
await promptBarFolderAssertion.assertFolderState(
{ name: newNameWithSpecialChars },
'visible',
Expand Down Expand Up @@ -174,7 +176,9 @@ dialTest(
async () => {
await folderPrompts.openFolderDropdownMenu(expectedName);
await folderDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(newNameWithEmojis);
await folderPrompts.editFolderNameWithTick(newNameWithEmojis, {
isHttpMethodTriggered: false,
});
await promptBarFolderAssertion.assertFolderState(
{ name: newNameWithEmojis },
'visible',
Expand Down
12 changes: 6 additions & 6 deletions apps/chat-e2e/src/tests/promptMaximumNameLength.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ dialTest(
await dialTest.step('Rename the prompt to a long name', async () => {
await prompts.openEntityDropdownMenu(expectedName);
await promptDropdownMenu.selectMenuOption(MenuOptions.edit);
await promptModalDialog.setField(
promptModalDialog.name,
nameUnder160Symbols,
);
// Wait for the API request to update the prompt name
await promptModalDialog.updatePromptDetailsWithButton(
nameUnder160Symbols,
Expand Down Expand Up @@ -138,14 +134,18 @@ dialTest(
ExpectedConstants.newPromptFolderWithIndexTitle(1),
);
await promptDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(longName);
await folderPrompts.editFolderNameWithTick(longName, {
isHttpMethodTriggered: false,
});

// Rename folder_child
await folderPrompts.openFolderDropdownMenu(
ExpectedConstants.newPromptFolderWithIndexTitle(2),
);
await promptDropdownMenu.selectMenuOption(MenuOptions.rename);
await folderPrompts.editFolderNameWithTick(longName);
await folderPrompts.editFolderNameWithTick(longName, {
isHttpMethodTriggered: false,
});
},
);

Expand Down
19 changes: 5 additions & 14 deletions apps/chat-e2e/src/tests/promptUsage.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Conversation } from '@/chat/types/chat';
import { Prompt } from '@/chat/types/prompt';
import { ShareByLinkResponseModel } from '@/chat/types/share';
import dialTest from '@/src/core/dialFixtures';
Expand Down Expand Up @@ -510,7 +509,6 @@ dialTest(
async ({
dialHomePage,
promptData,
conversationData,
dataInjector,
agentSettings,
conversationSettingsModal,
Expand All @@ -533,24 +531,17 @@ dialTest(
`{{${aVar}}}`,
`{{${bVar}|${bVarDefaultValue}}}`,
);
let conversation: Conversation;

await dialTest.step(
'Prepare prompt with vars and empty conversation',
async () => {
prompt = promptData.preparePrompt(promptContent);
conversation = conversationData.prepareEmptyConversation();
await dataInjector.createPrompts([prompt]);
await dataInjector.createConversations([conversation]);
},
);
await dialTest.step('Prepare prompt with vars', async () => {
prompt = promptData.preparePrompt(promptContent);
await dataInjector.createPrompts([prompt]);
});

await dialTest.step(
`Type / in system prompt field, select created prompt and verify variable modal with default values is displayed`,
async () => {
await dialHomePage.openHomePage();
await dialHomePage.waitForPageLoaded();
await conversations.selectConversation(conversation.name);
await chat.configureSettingsButton.click();
await agentSettings.setSystemPrompt('/');
const promptsList = agentSettings.getPromptList();
Expand All @@ -574,7 +565,7 @@ dialTest(
await agentSettingAssertion.assertSystemPromptValue(
promptTemplate(aVarValue, bVarDefaultValue),
);
await conversationSettingsModal.cancelButton.click();
await conversationSettingsModal.applyChangesButton.click();
},
);

Expand Down
Loading