-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
…ormador-feb-jun-2024-Azteca into update-pcp-ui
- Loading branch information
Showing
28 changed files
with
4,839 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import db from "@/db/drizzle"; | ||
import { user } from "@/db/schema"; | ||
import { eq } from "drizzle-orm"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export const dynamic = "force-dynamic"; // defaults to auto | ||
|
||
export async function POST() { | ||
try { | ||
// Delete cypress user | ||
await db.delete(user).where(eq(user.email, "[email protected]")); | ||
console.log("User deleted successfully"); | ||
// Return success response | ||
return NextResponse.json({ message: "User deleted successfully" }); | ||
} catch (error) { | ||
console.error("Error deleting user:", error); | ||
// Return error response | ||
return NextResponse.json({ message: "Error deleting user" }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import db from "./db/drizzle"; | ||
import { user } from "./db/schema"; | ||
import { defineConfig } from "cypress"; | ||
import { eq } from "drizzle-orm"; | ||
import dotenv from "dotenv"; | ||
|
||
dotenv.config({ | ||
path: ".env.local", | ||
}); | ||
|
||
export default defineConfig({ | ||
env: { | ||
AUTH_SECRET: process.env.AUTH_SECRET, | ||
POSTGRES_URL: process.env.POSTGRES_URL, | ||
}, | ||
e2e: { | ||
viewportWidth: 1920, | ||
viewportHeight: 1080, | ||
baseUrl: "http://localhost:3000", | ||
setupNodeEvents(on, config) { | ||
on("task", { | ||
async deleteDummyUser({ email }) { | ||
await db | ||
.delete(user) | ||
.where(eq(user.email, email)) | ||
.then((res) => { | ||
if (res) { | ||
return true; | ||
} | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
return false; | ||
}); | ||
return null; | ||
}, | ||
}); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"AUTH_SECRET": "B2MpnwcQe/tHVNSiLLNzxBsOJbz/rdkr5nryhA7V5wXn", | ||
"POSTGRES_URL": "postgres://default:IJ9zyn6TVsRk@ep-delicate-brook-a4k70q8v-pooler.us-east-1.aws.neon.tech:5432/verceldb?sslmode=require" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe("Login", () => { | ||
it("Visits Login page, and signs in", () => { | ||
cy.visit("/"); | ||
cy.get("label").contains("Email").click().type("[email protected]"); | ||
cy.get("label").contains("Password").click().type("cypress"); | ||
cy.get("button").contains("Log in").click(); | ||
cy.url().should("include", "/profile"); | ||
}); | ||
it("Visits page not being signed in, and gets redirected to login", () => { | ||
cy.visit("/profile"); | ||
cy.url().should("include", "/login"); | ||
}); | ||
it("Tries to sign in with wrong credentials", () => { | ||
cy.visit("/"); | ||
cy.get("label").contains("Email").click().type("[email protected]"); | ||
cy.get("label").contains("Password").click().type("prueba"); | ||
cy.get("button").contains("Log in").click(); | ||
cy.get("div").contains("Email or password is not valid.").should("exist"); | ||
cy.url().should("include", "/login"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe("Profile", () => { | ||
beforeEach(() => { | ||
cy.visit("/profile"); | ||
cy.get("label").contains("Email").click().type("[email protected]"); | ||
cy.get("label").contains("Password").click().type("cypress"); | ||
cy.get("button").contains("Log in").click(); | ||
}); | ||
it("Change banner image", () => { | ||
const randomNumber = Math.floor(Math.random() * 5); | ||
cy.get('[data-testid="user-icon-navbar"]').click(); | ||
cy.get('[data-testid="settings-button"]').click(); | ||
cy.get('[data-testid="banner-tab"]').click(); | ||
cy.get(`[data-testid="banner-image-${randomNumber}"]`).click(); | ||
cy.get("button").contains("Done").click(); | ||
cy.get(`[data-testid="Banner${randomNumber}.svg"]`).should( | ||
"have.attr", | ||
"src", | ||
`/Banner${randomNumber}.svg`, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.