Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
justino599 committed Jan 18, 2024
1 parent 17e91e7 commit 13910be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
8 changes: 2 additions & 6 deletions cypress/e2e/app/dashboard/searchBar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ describe('Dashboard Search Bar', () => {
const password = 'Password1'

// Sign up
cy.visit('/signup')
cy.get('[data-cy="email"]').type(email)
cy.get('[data-cy="password"]').type(password)
cy.get('[data-cy="passwordConfirmation"]').type(password)
cy.get('[data-cy="submit"]').click()
cy.url().should('contain', 'login')
cy.task('createUser', { email, password })

// Login
cy.visit('/login')
cy.get('[data-cy=email]').type(email)
cy.get('[data-cy=password]').type(password)
cy.get('[data-cy=submit]').click()
Expand Down
24 changes: 6 additions & 18 deletions cypress/e2e/app/dashboard/videoTabs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ describe('Dashboard Recent Videos Tests', () => {
cy.visit('/signup')

// Sign up
cy.visit('/signup')
cy.get('[data-cy="email"]').type(email)
cy.get('[data-cy="password"]').type(password)
cy.get('[data-cy="passwordConfirmation"]').type(password)
cy.get('[data-cy="submit"]').click()
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('contain', 'login')
cy.task('createUser', { email, password })

// Login
cy.visit('/login')
cy.get('[data-cy=email]').type(email)
cy.get('[data-cy=password]').type(password)
cy.get('[data-cy=submit]').click()
Expand All @@ -48,12 +44,7 @@ describe('Dashboard Recent Videos Tests', () => {
const password = 'randomPasswordCool1'

// Sign up
cy.visit('/signup')
cy.get('[data-cy="email"]').type(email)
cy.get('[data-cy="password"]').type(password)
cy.get('[data-cy="passwordConfirmation"]').type(password)
cy.get('[data-cy="submit"]').click()
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('contain', 'login')
cy.task('createUser', { email, password })

// Create submission box and submit video
const videoTitle = 'Test Video Title ' + uuidv4()
Expand All @@ -66,6 +57,7 @@ describe('Dashboard Recent Videos Tests', () => {
})

// Login
cy.visit('/login')
cy.get('[data-cy=email]').type(email)
cy.get('[data-cy=password]').type(password)
cy.get('[data-cy=submit]').click()
Expand Down Expand Up @@ -100,12 +92,7 @@ describe('Dashboard Recent Videos Tests', () => {
const password = 'randomPasswordCool1'

// Sign up
cy.visit('/signup')
cy.get('[data-cy="email"]').type(email)
cy.get('[data-cy="password"]').type(password)
cy.get('[data-cy="passwordConfirmation"]').type(password)
cy.get('[data-cy="submit"]').click()
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('contain', 'login')
cy.task('createUser', { email, password })

// Create submission box and submit video
const videoTitle = 'Test Video Title ' + uuidv4()
Expand All @@ -119,6 +106,7 @@ describe('Dashboard Recent Videos Tests', () => {
})

// Login
cy.visit('/login')
cy.get('[data-cy=email]').type(email)
cy.get('[data-cy=password]').type(password)
cy.get('[data-cy=submit]').click()
Expand Down
1 change: 1 addition & 0 deletions cypress/tasks/clearDB.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import prisma from '@/lib/prisma'

export default async function clearDB() {
await prisma.requestedEmailVerification.deleteMany({})
await prisma.submittedVideo.deleteMany({})
await prisma.requestedSubmission.deleteMany({})
await prisma.submissionBoxManager.deleteMany({})
Expand Down

0 comments on commit 13910be

Please sign in to comment.