-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chat-e2e): duplicate shared prompt tests (#2076)
Co-authored-by: Maksim Nartov <[email protected]>
- Loading branch information
1 parent
7cc8b0d
commit 07d26fa
Showing
14 changed files
with
427 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
); | ||
}, | ||
); | ||
}, | ||
); |
Oops, something went wrong.