Skip to content

Commit

Permalink
feat(chat-e2e): fixed files section visibility test (#2845)
Browse files Browse the repository at this point in the history
  • Loading branch information
irinakartun authored Dec 19, 2024
1 parent 6cac0cc commit fd27029
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 9 additions & 4 deletions apps/chat-e2e/src/assertions/manageAttachmentsAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ export class ManageAttachmentsAssertion {
state: ElementCaretState,
) {
const sectionElement = this.attachFilesModal.getSectionElement(section);
const isExpanded =
await this.attachFilesModal.isSectionExpanded(sectionElement);
const filesSection = this.attachFilesModal.getFilesSection(sectionElement);
state === 'expanded'
? expect(isExpanded, `Section "${section}" is ${state}`).toBeTruthy()
: expect(isExpanded, `Section "${section}" is ${state}`).toBeFalsy();
? await expect(
filesSection,
`Section "${section}" is ${state}`,
).toBeVisible()
: await expect(
filesSection,
`Section "${section}" is ${state}`,
).toBeHidden();
}
}
13 changes: 5 additions & 8 deletions apps/chat-e2e/src/ui/webElements/attachFilesModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export class AttachFilesModal extends BaseElement {
SelectFolderModalSelectors.newFolderButton,
);

public getFilesSection = (sectionElement: BaseElement) =>
sectionElement
.getChildElementBySelector(AttachFilesModalSelectors.fileSection)
.getElementLocator();

public closeButton = this.getChildElementBySelector(IconSelectors.cancelIcon);

public async checkAttachedFile(
Expand Down Expand Up @@ -209,12 +214,4 @@ export class AttachFilesModal extends BaseElement {
ErrorLabelSelectors.errorText,
).getElementContent();
}

public async isSectionExpanded(
sectionElement: BaseElement,
): Promise<boolean> {
return sectionElement
.getChildElementBySelector(AttachFilesModalSelectors.fileSection)
.isVisible();
}
}

0 comments on commit fd27029

Please sign in to comment.