forked from epam/ai-dial-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
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): footer and request token limits tests (epam#1807)
Co-authored-by: Ilya Bondar <[email protected]>
- Loading branch information
1 parent
7945ad9
commit 5cf5fd5
Showing
21 changed files
with
413 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ElementState, ExpectedMessages } from '@/src/testData'; | ||
import { Footer } from '@/src/ui/webElements/footer'; | ||
import { expect } from '@playwright/test'; | ||
|
||
export class FooterAssertion { | ||
readonly footer: Footer; | ||
|
||
constructor(footer: Footer) { | ||
this.footer = footer; | ||
} | ||
|
||
public async assertFooterState(expectedState: ElementState) { | ||
const footer = this.footer.getElementLocator(); | ||
expectedState === 'visible' | ||
? await expect | ||
.soft(footer, ExpectedMessages.footerIsVisible) | ||
.toBeVisible() | ||
: await expect | ||
.soft(footer, ExpectedMessages.footerIsNotVisible) | ||
.toBeHidden(); | ||
} | ||
|
||
public async assertFooterContentLength() { | ||
expect | ||
.soft( | ||
await this.footer.getElementInnerContent().then((c) => c.length), | ||
ExpectedMessages.footerContentIsNotEmpty, | ||
) | ||
.toBeGreaterThan(0); | ||
} | ||
} |
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
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,85 @@ | ||
import { Conversation } from '@/chat/types/chat'; | ||
import dialTest from '@/src/core/dialFixtures'; | ||
import { Colors } from '@/src/ui/domData'; | ||
import { ModelsUtil } from '@/src/utils'; | ||
|
||
dialTest( | ||
'Show more/less hides stages after 3rd', | ||
async ({ | ||
dialHomePage, | ||
conversationData, | ||
localStorageManager, | ||
dataInjector, | ||
setTestIds, | ||
chatMessages, | ||
chatMessagesAssertion, | ||
}) => { | ||
setTestIds('EPMRTC-1757'); | ||
let conversation: Conversation; | ||
const stagesCount = 5; | ||
const maxDisplayedStagesCount = 3; | ||
|
||
await dialTest.step( | ||
'Prepare conversation with 3+ stages in response', | ||
async () => { | ||
conversation = conversationData.prepareConversationWithStagesInResponse( | ||
ModelsUtil.getDefaultModel()!, | ||
stagesCount, | ||
); | ||
await dataInjector.createConversations([conversation]); | ||
await localStorageManager.setSelectedConversation(conversation); | ||
}, | ||
); | ||
|
||
await dialTest.step( | ||
'Open conversation, verify first 3 stages are displayed, other are hidden under "Show more" blue button', | ||
async () => { | ||
await dialHomePage.openHomePage(); | ||
await dialHomePage.waitForPageLoaded(); | ||
await chatMessagesAssertion.assertMessageStagesCount( | ||
2, | ||
maxDisplayedStagesCount, | ||
); | ||
await chatMessagesAssertion.assertShowMoreLessButtonState( | ||
'more', | ||
'visible', | ||
); | ||
await chatMessagesAssertion.assertShowMoreLessButtonColor( | ||
'more', | ||
Colors.controlsBackgroundAccent, | ||
); | ||
}, | ||
); | ||
|
||
await dialTest.step( | ||
'Click on "Show more" and verify all stages and "Show less" button are displayed', | ||
async () => { | ||
await chatMessages.showMoreButton.click(); | ||
await chatMessagesAssertion.assertMessageStagesCount(2, stagesCount); | ||
await chatMessagesAssertion.assertShowMoreLessButtonState( | ||
'less', | ||
'visible', | ||
); | ||
await chatMessagesAssertion.assertShowMoreLessButtonColor( | ||
'less', | ||
Colors.controlsBackgroundAccent, | ||
); | ||
}, | ||
); | ||
|
||
await dialTest.step( | ||
'Click on "Show less" and verify 3 stages and "Show more" button are displayed', | ||
async () => { | ||
await chatMessages.showLessButton.click(); | ||
await chatMessagesAssertion.assertMessageStagesCount( | ||
2, | ||
maxDisplayedStagesCount, | ||
); | ||
await chatMessagesAssertion.assertShowMoreLessButtonState( | ||
'more', | ||
'visible', | ||
); | ||
}, | ||
); | ||
}, | ||
); |
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,32 @@ | ||
import dialTest from '@/src/core/dialFixtures'; | ||
import { ExpectedMessages } from '@/src/testData'; | ||
import { expect } from '@playwright/test'; | ||
|
||
dialTest( | ||
'EPAM AI Dial leads to kb', | ||
async ({ dialHomePage, chat, footerAssertion, setTestIds }) => { | ||
setTestIds('EPMRTC-361'); | ||
|
||
await dialTest.step( | ||
'Open app and verify footer with configured content is displayed', | ||
async () => { | ||
await dialHomePage.openHomePage(); | ||
await dialHomePage.waitForPageLoaded({ | ||
isNewConversationVisible: true, | ||
}); | ||
await footerAssertion.assertFooterState('visible'); | ||
await footerAssertion.assertFooterContentLength(); | ||
}, | ||
); | ||
|
||
await dialTest.step( | ||
'Click on any footer link and verify it is opened in a new tab', | ||
async () => { | ||
const newPage = await dialHomePage.getNewPage(() => | ||
chat.getFooter().openFooterLink(), | ||
); | ||
expect.soft(newPage, ExpectedMessages.newPageIsOpened).toBeDefined(); | ||
}, | ||
); | ||
}, | ||
); |
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
Oops, something went wrong.