Skip to content

Commit

Permalink
Merge branch 'development' into feat/overlay-events-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
irinakartun authored Jan 31, 2025
2 parents 69f1b67 + a859859 commit a057fe2
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 26 deletions.
20 changes: 14 additions & 6 deletions apps/chat-e2e/src/ui/webElements/marketplace/agentDetailsModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ export class AgentDetailsModal extends BaseElement {
);
public closeButton = this.getChildElementBySelector(IconSelectors.cancelIcon);

public async clickUseButton() {
const responsePromise = this.page.waitForResponse(
(resp) => resp.request().method() === 'PUT',
);
await this.useButton.click();
await responsePromise;
public async clickUseButton({
isInstalledDeploymentsUpdated = false,
}: {
isInstalledDeploymentsUpdated?: boolean;
}) {
if (isInstalledDeploymentsUpdated) {
const responsePromise = this.page.waitForResponse(
(resp) => resp.request().method() === 'PUT',
);
await this.useButton.click();
await responsePromise;
} else {
await this.useButton.click();
}
}
}
19 changes: 15 additions & 4 deletions apps/chat-e2e/src/ui/webElements/marketplace/marketplaceAgents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ export class MarketplaceAgents extends BaseElement {
}
}

public async isAgentUsed(entity: DialAIEntityModel): Promise<boolean> {
public async isAgentUsed(
entity: DialAIEntityModel,
{
isInstalledDeploymentsUpdated = false,
}: { isInstalledDeploymentsUpdated?: boolean } = {},
): Promise<boolean> {
let isAgentVisible = false;
const entityLocator = this.agentName(entity.name);
//open entity details modal if it is visible
Expand Down Expand Up @@ -129,7 +134,9 @@ export class MarketplaceAgents extends BaseElement {
await agentDetailsModal
.getVersionDropdownMenu()
.selectMenuOption(entity.version);
await agentDetailsModal.clickUseButton();
await agentDetailsModal.clickUseButton({
isInstalledDeploymentsUpdated,
});
isAgentVisible = true;
} else {
await agentDetailsModal.closeButton.click();
Expand All @@ -138,11 +145,15 @@ export class MarketplaceAgents extends BaseElement {
await agentDetailsModal.closeButton.click();
}
} else {
await agentDetailsModal.clickUseButton();
await agentDetailsModal.clickUseButton({
isInstalledDeploymentsUpdated,
});
isAgentVisible = true;
}
} else {
await agentDetailsModal.clickUseButton();
await agentDetailsModal.clickUseButton({
isInstalledDeploymentsUpdated,
});
isAgentVisible = true;
}
}
Expand Down
4 changes: 3 additions & 1 deletion apps/chat-e2e/src/ui/webElements/talkToAgentDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class TalkToAgentDialog extends BaseElement {
const expectedAgents = ModelsUtil.getLatestOpenAIEntities();
const allAgents = marketplace.getAgents();
await allAgents.waitForAgentByIndex(expectedAgents.length);
const isAllApplicationUsed = await allAgents.isAgentUsed(entity);
const isAllApplicationUsed = await allAgents.isAgentUsed(entity, {
isInstalledDeploymentsUpdated: true,
});
if (!isAllApplicationUsed) {
throw new Error(
`Entity with name: ${entity.name} and version: ${entity.version ?? 'N/A'} is not found!`,
Expand Down
12 changes: 7 additions & 5 deletions apps/chat/src/components/Chat/ModelVersionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ export const ModelVersionSelect = ({
if (entities.length < 2) {
if (entities.length && entities[0].version) {
return (
<div
className={classNames('flex truncate', className)}
data-qa="version"
>
<div className={classNames('flex truncate', className)}>
{showVersionPrefix && <VersionPrefix />}
{entities[0].version}
<span
className="mr-3 max-w-full overflow-hidden truncate whitespace-nowrap"
data-qa="version"
>
{entities[0].version}
</span>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/chat/src/components/Chat/TalkTo/TalkToCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export const TalkToCard = ({
<p className="mr-1 text-xs text-secondary">{t('Version')}: </p>
<ModelVersionSelect
readonly={conversation.playback?.isPlayback}
className="h-max text-xs"
className="h-max truncate text-xs"
entities={versionsToSelect}
onSelect={handleSelectVersion}
currentEntity={entity}
Expand Down
17 changes: 13 additions & 4 deletions apps/chat/src/components/Common/ApplicationWizard/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,19 @@ export const validators: Validators = {
validate: (v) => {
const reg = /^[0-9]+\.[0-9]+\.[0-9]+$/;

return (
reg.test(v) ||
'Version should be in x.y.z format and contain only numbers and dots.'
);
if (!reg.test(v)) {
return 'Version should be in x.y.z format and contain only numbers and dots.';
}

const parts = v.split('.');

for (const part of parts) {
if (part.length > 5) {
return 'Each part of the version should contain no more than five numbers.';
}
}

return true;
},
setValueAs: (v) => {
return (v as string).replace(/[^0-9.]/g, '');
Expand Down
12 changes: 7 additions & 5 deletions apps/chat/src/components/Marketplace/ApplicationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,21 @@ export const ApplicationCard = ({
{entity.version && (
<div
className={classNames(
'text-xs leading-[14px] text-secondary',
!isMyApp && 'mr-6',
'mr-6 flex gap-1 text-xs leading-[14px] text-secondary',
!isMyApp && '!mr-12',
)}
>
{t('Version: ')}
{entity.version}
<span className="max-w-full overflow-hidden truncate whitespace-nowrap">
{entity.version}
</span>
</div>
)}
<div className="flex whitespace-nowrap">
<div
className={classNames(
'shrink truncate text-base font-semibold leading-[20px] text-primary',
!isMyApp && !entity.version && 'mr-6',
'mr-6 shrink truncate text-base font-semibold leading-[20px] text-primary',
!isMyApp && !entity.version && '!mr-12',
)}
data-qa="agent-name"
>
Expand Down

0 comments on commit a057fe2

Please sign in to comment.