diff --git a/cypress/e2e/user/signUpPage.cy.js b/cypress/e2e/user/signUpPage.cy.js new file mode 100644 index 0000000..2d1c1b7 --- /dev/null +++ b/cypress/e2e/user/signUpPage.cy.js @@ -0,0 +1,51 @@ +// cypress/integration/signUpPage.spec.js +describe("Sign Up Page", () => { + beforeEach(() => { + cy.visit("/signup"); + }); + + it("should display the Sign Up heading", () => { + cy.get("h1").contains("Sign Up").should("be.visible"); + }); + + it("should display the form heading", () => { + cy.get("h5").contains("Create an Account").should("be.visible"); + }); + + it("should display form description", () => { + cy.contains("Join us to access exclusive content and features").should( + "be.visible" + ); + }); + + it("should have a Username field", () => { + cy.get("input[placeholder='Your Username']").should("exist"); + }); + + it("should have an Email field", () => { + cy.get("input[type='email']").should("exist"); + }); + + it("should have a Password field", () => { + cy.get("input[type='password']").should("exist"); + }); + + it("should have a Confirm Password field", () => { + cy.get("input[placeholder='******']").should("exist"); + }); + + it("should have a Sign Up button", () => { + cy.get("button").contains("Sign Up").should("be.visible"); + }); + + it("should have a link to the Log In page", () => { + cy.contains("Already have an account? Log In").should("be.visible"); + cy.get('a[href="/login"]').should("exist"); + }); + + it("should have animations on elements", () => { + // Check for animations by ensuring elements are visible after a delay + cy.get("h1").should("be.visible"); + cy.get("form").should("be.visible"); + }); +}); diff --git a/cypress/screenshots/components/SignUpButton.cy.jsx/SignUpButton -- renders (failed).png b/cypress/screenshots/components/SignUpButton.cy.jsx/SignUpButton -- renders (failed).png new file mode 100644 index 0000000..02fec02 Binary files /dev/null and b/cypress/screenshots/components/SignUpButton.cy.jsx/SignUpButton -- renders (failed).png differ diff --git a/src/components/SignUpButton.cy.jsx b/src/components/SignUpButton.cy.jsx new file mode 100644 index 0000000..03867c9 --- /dev/null +++ b/src/components/SignUpButton.cy.jsx @@ -0,0 +1,9 @@ +import React from 'react' +import SignUpButton from './SignUpButton' + +describe('', () => { + it('renders', () => { + // see: https://on.cypress.io/mounting-react + cy.mount() + }) +}) \ No newline at end of file diff --git a/src/components/SignUpButton.jsx b/src/components/SignUpButton.jsx new file mode 100644 index 0000000..a220120 --- /dev/null +++ b/src/components/SignUpButton.jsx @@ -0,0 +1,24 @@ +import React from "react"; +import { useDispatch } from "react-redux"; +import { Button } from "@mui/material"; +import { signIn } from "../redux/slices/authSlice"; + +const SignUpButton = () => { + const dispatch = useDispatch(); + + const handleSignUp = () => { + const user = { + name: "Jane Doe", + avatarUrl: "https://via.placeholder.com/150", + }; + dispatch(signIn(user)); + }; + + return ( + + ); +}; + +export default SignUpButton; diff --git a/src/pages/SignUpPage.cy.jsx b/src/pages/SignUpPage.cy.jsx new file mode 100644 index 0000000..cf2d2b8 --- /dev/null +++ b/src/pages/SignUpPage.cy.jsx @@ -0,0 +1,9 @@ +import React from 'react' +import SignUpPage from './SignUpPage' + +describe('', () => { + it('renders', () => { + // see: https://on.cypress.io/mounting-react + cy.mount() + }) +}) \ No newline at end of file diff --git a/src/pages/SignUpPage.jsx b/src/pages/SignUpPage.jsx new file mode 100644 index 0000000..a24ee00 --- /dev/null +++ b/src/pages/SignUpPage.jsx @@ -0,0 +1,110 @@ +// src/pages/SignUpPage.js +import React from "react"; +import { + Container, + Typography, + TextField, + Button, + Grid, + Paper, +} from "@mui/material"; +import { styled } from "@mui/material/styles"; +import Fade from "@mui/material/Fade"; +import Zoom from "@mui/material/Zoom"; + +const SignUpFormContainer = styled(Paper)(({ theme }) => ({ + padding: theme.spacing(4), + display: "flex", + flexDirection: "column", + alignItems: "center", + textAlign: "center", + borderRadius: theme.shape.borderRadius, + boxShadow: theme.shadows[3], +})); + +const SignUpPage = () => ( + + + + Sign Up + + + + + + Create an Account + + + Join us to access exclusive content and features. Fill out the form + below to create your account. If you already have an account, you can{" "} + log in here. + +
+ + + + + + + + + + + + + + + + + + + Already have an account? Log In + + + +
+
+
+
+); + +export default SignUpPage;