chore: add wait time for loader

This commit is contained in:
Van-QA 2024-04-10 18:51:08 +07:00
parent cdab762a6a
commit 9abea8067b
3 changed files with 5 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import { expect } from '@playwright/test' import { expect } from '@playwright/test'
import { page, test, TIMEOUT } from '../config/fixtures' import { page, test, TIMEOUT } from '../config/fixtures'
test('Select GPT model for chat via Use model button from Jan Hub', async ({ hubPage }) => { test('Select GPT model from Hub and Chat with Invalid API Key', async ({ hubPage }) => {
await hubPage.navigateByMenu() await hubPage.navigateByMenu()
await hubPage.verifyContainerVisible() await hubPage.verifyContainerVisible()
@ -23,6 +23,8 @@ test('Select GPT model for chat via Use model button from Jan Hub', async ({ hub
.getByTestId('btn-send-chat') .getByTestId('btn-send-chat')
.click() .click()
await page.waitForSelector('[data-testid$="-loader"]', { state: 'hidden', timeout: TIMEOUT });
const APIKeyError = page.getByTestId('invalid-API-key-error') const APIKeyError = page.getByTestId('invalid-API-key-error')
await expect(APIKeyError).toBeVisible({ await expect(APIKeyError).toBeVisible({
timeout: TIMEOUT, timeout: TIMEOUT,

View File

@ -31,6 +31,7 @@ export default function GenerateResponse() {
<div <div
className="absolute left-0 top-0 h-full bg-gray-200" className="absolute left-0 top-0 h-full bg-gray-200"
style={{ width: `${loader}%` }} style={{ width: `${loader}%` }}
data-testid="response-loader"
/> />
<span className="relative z-10">Generating response...</span> <span className="relative z-10">Generating response...</span>
</div> </div>

View File

@ -40,6 +40,7 @@ export default function ModelStart() {
<div <div
className="absolute left-0 top-0 h-full bg-blue-200" className="absolute left-0 top-0 h-full bg-blue-200"
style={{ width: `${loader}%` }} style={{ width: `${loader}%` }}
data-testid="model-loader"
/> />
<span className="relative z-10"> <span className="relative z-10">
{stateModel.state === 'start' ? 'Starting' : 'Stopping'} {stateModel.state === 'start' ? 'Starting' : 'Stopping'}