Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(test): fix chats sidebar tests failing when is hidden #18

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/03-chats-sidebar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("Chats Sidebar Tests", () => {
it("C4 - Clicking hamburger button should collapse sidebar", () => {
chatsMainPage.ensureSidebarIsDisplayed();
chatsMainPage.buttonHideSidebar.click();
chatsMainPage.sidebar.should("not.be.visible");
chatsMainPage.sidebar.should("not.exist");
chatsMainPage.buttonShowSidebar.click();
chatsMainPage.sidebar.should("be.visible");
});
Expand Down
18 changes: 12 additions & 6 deletions cypress/e2e/PageObjects/ChatsMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class ChatsMainPage {
return cy.getByTestAttr("input-sidebar-search");
}

get navigationBar() {
return cy.get(".navigation");
}

get sectionAddSomeone() {
return cy.getByTestAttr("section-add-someone");
}
Expand All @@ -92,12 +96,14 @@ class ChatsMainPage {
}

public ensureSidebarIsDisplayed() {
if (!this.sidebar) {
this.buttonShowSidebar.click();
this.sidebar.should("be.visible");
} else {
this.sidebar.should("be.visible");
}
this.navigationBar.then(($navBar) => {
if ($navBar.hasClass("vertical")) {
this.buttonShowSidebar.click();
this.sidebar.should("be.visible");
} else {
this.sidebar.should("be.visible");
}
});
}

public validateChatsMainPageIsShown() {
Expand Down
Loading