Skip to content

Commit

Permalink
test(signin): complete e2e test for landing page and sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunan-k committed Dec 13, 2023
1 parent 4305b73 commit 86c17f2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
10 changes: 9 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ const Home = () => {
fontWeight="900"
letterSpacing="16px"
color={Theme.colors.white}
data-cy="companyLogo"
>
BYTEPING
</Text>
</Link>
<Container border="2px solid white" padding="48px" mPadding="24px" width="528px" mWidth="324px">
<Text fontSize="3.5rem" mFontSize="32px" fontWeight="100" color={Theme.colors.white} letterSpacing="4px">
<Text
fontSize="3.5rem"
mFontSize="32px"
fontWeight="100"
color={Theme.colors.white}
letterSpacing="4px"
data-cy="companyMotto"
>
IMPRESSIVE EXPERIENCES THAT DELIVER
</Text>
</Container>
Expand Down
31 changes: 22 additions & 9 deletions cypress/e2e/signIn.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@ describe("sign in", () => {
cy.visit("/");
});
it("should test entire sign in functionalities", () => {
cy.fixture("signIn.json").then((signInJson: signInJsonTypes) => {});
cy.get("[data-cy='signInErrorMessage']").as("signInErrorMessage");
cy.get("[data-cy='signInEmail']").as("signInEmail");
cy.get("[data-cy='signInPassword']").as("signInPassword");
cy.get("[data-cy='signInSubmitButton']").as("signInSubmitButton");
cy.get("[data-cy='signInGuestButton']").as("signInGuestButton");
cy.get("@signInErrorMessage").should("have.text", "Fill your email");
cy.get("@signInSubmitButton").click();
cy.get("@signInErrorMessage").should("have.text", "Type your secret");
cy.fixture("signIn.json").then((signInJson: signInJsonTypes) => {
cy.get("[data-cy='companyLogo']").should("have.text", "BYTEPING");
cy.get("[data-cy='companyMotto']").should("have.text", "IMPRESSIVE EXPERIENCES THAT DELIVER");
cy.get("[data-cy='signInErrorMessage']").as("signInErrorMessage");
cy.get("[data-cy='signInEmail']").as("signInEmail");
cy.get("[data-cy='signInPassword']").as("signInPassword");
cy.get("[data-cy='signInSubmitButton']").as("signInSubmitButton");
cy.get("[data-cy='signInGuestButton']").as("signInGuestButton");
cy.get("[data-cy='signInAndUpTitle']").should("have.text", "Sign In");
cy.get("@signInSubmitButton").click();
cy.get("@signInErrorMessage").should("have.text", "Fill your email");
cy.get("@signInEmail").type(signInJson.email);
cy.get("@signInSubmitButton").click();
cy.get("@signInErrorMessage").should("have.text", "Type your secret");
cy.get("@signInPassword").type(signInJson.wrongPassword);
cy.get("@signInSubmitButton").click();
cy.get("@signInErrorMessage").should("have.text", "Failed to sign in");
cy.get("@signInGuestButton").click();
cy.get("@signInSubmitButton").click();
cy.location("pathname").should("eq", "/chats");
cy.visit("/");
});
});
});
1 change: 1 addition & 0 deletions cypress/e2e/signUp.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe("sign up", () => {
cy.get("@submitButton").click();
cy.wait("@signUp");
cy.location("pathname").should("eq", "/chats");
cy.visit("/");
});
});
});
1 change: 0 additions & 1 deletion cypress/fixtures/signIn.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"email": "[email protected]",
"password": "123456",
"wrongPassword": "abcdef"
}
Binary file added cypress/videos/signIn.cy.ts.mp4
Binary file not shown.
Binary file modified cypress/videos/signUp.cy.ts.mp4
Binary file not shown.

0 comments on commit 86c17f2

Please sign in to comment.