Skip to content

Commit

Permalink
fix(chat): fix error placement in select folder window (Issue #1335) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Derikyan authored Jan 9, 2025
1 parent a952a91 commit 654ce18
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/chat-e2e/src/tests/selectUploadFolder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ dialTest(
attachFilesModal,
selectFolderModal,
selectFolders,
toast,
}) => {
setTestIds('EPMRTC-3017', 'EPMRTC-3246');

Expand Down Expand Up @@ -607,15 +606,17 @@ dialTest(
{ isHttpMethodTriggered: false },
);
await expect
.soft(toast.getElementLocator(), ExpectedMessages.errorToastIsShown)
.soft(
await selectFolderModal.getErrorContainer(),
ExpectedMessages.errorToastIsShown,
)
.toBeVisible();
expect
.soft(
await toast.getElementContent(),
await selectFolderModal.getErrorMessage(),
ExpectedMessages.errorMessageContentIsValid,
)
.toBe(ExpectedConstants.nameWithDotErrorMessage);
await selectFolders.getEditFolderInputActions().clickCancelButton();
},
);

Expand Down
1 change: 1 addition & 0 deletions apps/chat-e2e/src/ui/selectors/chatSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const ErrorLabelSelectors = {
notAllowedModel: '[data-qa="not-allowed-model-error"]',
fieldError: '.text-error',
errorText: '[data-qa="error-text"]',
errorContainer: '[data-qa="error-message-container"]',
};

export const ImportExportSelectors = {
Expand Down
12 changes: 12 additions & 0 deletions apps/chat-e2e/src/ui/webElements/selectFolderModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,16 @@ export class SelectFolderModal extends BaseElement {
await this.selectFolderButton.click();
}
}

public async getErrorMessage() {
return this.getChildElementBySelector(
ErrorLabelSelectors.errorText,
).getElementContent();
}

public async getErrorContainer() {
return this.getChildElementBySelector(
ErrorLabelSelectors.errorContainer,
).getElementLocator();
}
}
1 change: 1 addition & 0 deletions apps/chat/src/components/Common/ErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const ErrorMessage = ({ error, type = MessageType.ERROR }: Props) => {
'flex w-full gap-3 rounded border p-3',
isErrorMessage ? 'border-error bg-error' : 'border-warning bg-warning',
)}
data-qa="error-message-container"
>
<span
className={classNames(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const SelectFolderList = <T extends Conversation | Prompt | DialFile>({
? FeatureType.File
: FeatureType.Prompt
}
skipFolderRenameValidation
maxDepth={MAX_CONVERSATION_AND_PROMPT_FOLDERS_DEPTH}
currentFolder={folder}
highlightedFolders={highlightedFolders}
Expand Down

0 comments on commit 654ce18

Please sign in to comment.