-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
2,709 additions
and
607 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
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,97 @@ | ||
import { v4 as uuidv4 } from 'uuid' | ||
import { TIMEOUT } from '../../../utils/constants' | ||
|
||
describe('Dashboard Search Bar', () => { | ||
let email: string | ||
|
||
beforeEach(() => { | ||
cy.task('clearDB') | ||
|
||
email = 'user' + uuidv4() + '@example.com' | ||
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') | ||
|
||
// Login | ||
cy.get('[data-cy=email]').type(email) | ||
cy.get('[data-cy=password]').type(password) | ||
cy.get('[data-cy=submit]').click() | ||
cy.url({ timeout: TIMEOUT.EXTRA_EXTRA_LONG }).should('not.contain', 'login') | ||
}) | ||
|
||
it('should display search bar', () => { | ||
cy.visit('/dashboard') | ||
cy.get('[data-cy="dashboard-search-bar"]').should('be.visible') | ||
}) | ||
|
||
it('should only display searched videos', () => { | ||
cy.visit('/dashboard') | ||
|
||
const visibleVideo1 = 'Test Video Title ' + uuidv4() | ||
const visibleVideo2 = 'Test Video Title ' + uuidv4() | ||
const videoShouldNotBeDisplayed = 'Not Display' + uuidv4() | ||
cy.task('getUserId', email).then((userId) => { | ||
cy.task('createRequestSubmissionForUser', { userId }).then((submissionBoxId) => { | ||
cy.task('createOneVideoAndRetrieveVideoId', { ownerId: userId, title: visibleVideo1 }).then((videoId) => { | ||
cy.task('submitVideoToSubmissionBox', { requestedSubmissionId: submissionBoxId, videoId }) | ||
}) | ||
cy.task('createOneVideoAndRetrieveVideoId', { ownerId: userId, title: visibleVideo2 }).then((videoId) => { | ||
cy.task('submitVideoToSubmissionBox', { requestedSubmissionId: submissionBoxId, videoId }) | ||
}) | ||
cy.task('createOneVideoAndRetrieveVideoId', { ownerId: userId, title: videoShouldNotBeDisplayed }).then( | ||
(videoId) => { | ||
cy.task('submitVideoToSubmissionBox', { requestedSubmissionId: submissionBoxId, videoId }) | ||
} | ||
) | ||
}) | ||
}) | ||
|
||
cy.reload() | ||
cy.get('[data-cy="video-list"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.children() | ||
.should('have.length', 3) | ||
|
||
cy.get('[data-cy="dashboard-search-bar"]').type('Test Video Title') | ||
|
||
|
||
cy.get('[data-cy="video-list"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.children() | ||
.should('have.length', 2) | ||
}) | ||
|
||
|
||
it('should display different string when no videos are found', () => { | ||
cy.visit('/dashboard') | ||
|
||
cy.get('[data-cy="no-video-text"]', { timeout: TIMEOUT.EXTRA_LONG }).should('be.visible').should('contain', 'You Do Not Have Any Videos') | ||
|
||
const videoShouldNotBeDisplayed = 'Not Display' + uuidv4() | ||
cy.task('getUserId', email).then((userId) => { | ||
cy.task('createRequestSubmissionForUser', { userId }).then((submissionBoxId) => { | ||
cy.task('createOneVideoAndRetrieveVideoId', { ownerId: userId, title: videoShouldNotBeDisplayed }).then( | ||
(videoId) => { | ||
cy.task('submitVideoToSubmissionBox', { requestedSubmissionId: submissionBoxId, videoId }) | ||
} | ||
) | ||
}) | ||
}) | ||
|
||
cy.reload() | ||
cy.get('[data-cy="video-list"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.children() | ||
.should('have.length', 1) | ||
|
||
cy.get('[data-cy="dashboard-search-bar"]').type('Random String') | ||
|
||
cy.get('[data-cy="no-video-text"]', { timeout: TIMEOUT.EXTRA_LONG }).should('be.visible').should('contain', 'There Are No Videos That Match This Search') | ||
}) | ||
}) |
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,143 @@ | ||
import { TIMEOUT } from '../../../utils/constants' | ||
import { v4 as uuidv4 } from 'uuid' | ||
|
||
describe('Dashboard Recent Videos Tests', () => { | ||
if (!Cypress.env('CYPRESS_RUN_LOCAL_ONLY')) { | ||
// TODO: Remove this when we have a way to get the video ID (aka using Cognito) | ||
it.skip('Skipped in production', () => {}) | ||
return | ||
} | ||
|
||
beforeEach(() => { | ||
cy.task('clearDB') | ||
}) | ||
|
||
it('should not display any recent videos when no video is provided', () => { | ||
const email = 'noVideos@box.com' | ||
const password = 'noSubmissions1' | ||
|
||
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') | ||
|
||
// Login | ||
cy.get('[data-cy=email]').type(email) | ||
cy.get('[data-cy=password]').type(password) | ||
cy.get('[data-cy=submit]').click() | ||
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('not.contain', 'login') | ||
|
||
cy.visit('/dashboard') | ||
cy.get('[data-cy="Recent"]') | ||
.should('be.visible') | ||
.and('contain', 'Recent') | ||
.and('have.css', 'background-color', 'rgb(225, 240, 255)') // Check if the tab is focused | ||
|
||
cy.get('[data-cy="no-video-text"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.and('contain', 'You Do Not Have Any Videos') | ||
}) | ||
|
||
it('should display sent videos when a user has sent videos', () => { | ||
const email = 'user' + uuidv4() + '@example.com' | ||
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') | ||
|
||
// Create submission box and submit video | ||
const videoTitle = 'Test Video Title ' + uuidv4() | ||
cy.task('getUserId', email).then((userId) => { | ||
cy.task('createRequestSubmissionForUser', { userId }).then((submissionBoxId) => { | ||
cy.task('createOneVideoAndRetrieveVideoId', { ownerId: userId, title: videoTitle }).then((videoId) => { | ||
cy.task('submitVideoToSubmissionBox', { requestedSubmissionId: submissionBoxId, videoId }) | ||
}) | ||
}) | ||
}) | ||
|
||
// Login | ||
cy.get('[data-cy=email]').type(email) | ||
cy.get('[data-cy=password]').type(password) | ||
cy.get('[data-cy=submit]').click() | ||
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('not.contain', 'login') | ||
|
||
cy.visit('/dashboard') | ||
|
||
cy.get('[data-cy="video-list"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.children() | ||
.should('have.length', 1) | ||
|
||
cy.get('[data-cy="video-list"]').children().first().should('contain', videoTitle) | ||
|
||
cy.get('[data-cy="Submitted Videos"]').click() | ||
cy.get('[data-cy="Submitted Videos"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.should('have.css', 'background-color', 'rgb(225, 240, 255)') // Check if the tab is focused | ||
|
||
|
||
cy.get('[data-cy="video-list"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.children() | ||
.should('have.length', 1) | ||
|
||
cy.get('[data-cy="video-list"]').children().first().should('contain', videoTitle) | ||
|
||
}) | ||
|
||
it('should display received videos when a user has received videos', () => { | ||
const email = 'user' + uuidv4() + '@example.com' | ||
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') | ||
|
||
// Create submission box and submit video | ||
const videoTitle = 'Test Video Title ' + uuidv4() | ||
const submissionBoxTitle = 'Test Submission Box ' + uuidv4() | ||
cy.task('getUserId', email).then((userId) => { | ||
cy.task('createSubmissionBoxWithEmail', { userId, submissionBoxTitle }).then((submissionBoxId) => { | ||
cy.task('createOneVideoAndRetrieveVideoId', { title: videoTitle }).then((videoId) => { | ||
cy.task('submitVideoToSubmissionBox', { requestedSubmissionId: submissionBoxId, videoId }) | ||
}) | ||
}) | ||
}) | ||
|
||
// Login | ||
cy.get('[data-cy=email]').type(email) | ||
cy.get('[data-cy=password]').type(password) | ||
cy.get('[data-cy=submit]').click() | ||
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('not.contain', 'login') | ||
|
||
cy.visit('/dashboard') | ||
|
||
cy.get('[data-cy="video-list"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.children() | ||
.should('have.length', 1) | ||
|
||
cy.get('[data-cy="video-list"]').children().first().should('contain', videoTitle) | ||
|
||
cy.get('[data-cy="Submitted Videos"]').click() | ||
cy.get('[data-cy="Submitted Videos"]', { timeout: TIMEOUT.EXTRA_LONG }) | ||
.should('be.visible') | ||
.should('have.css', 'background-color', 'rgb(225, 240, 255)') // Check if the tab is focused | ||
|
||
cy.get('[data-cy="no-video-text"]', { timeout: TIMEOUT.EXTRA_LONG }).should('contain', 'You Do Not Have Any Videos') | ||
}) | ||
}) |
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
Oops, something went wrong.