Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission Box Settings Form #221

Merged
merged 21 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e_tests_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: |
echo "${{ secrets.ENV_PREVIEW }}" > .env
- name: Migrate Database
run: npx prisma migrate dev &> prisma_migrate.log
run: npx prisma migrate deploy &> prisma_migrate.log
te-sa marked this conversation as resolved.
Show resolved Hide resolved



Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/app/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Login tests', () => {
cy.visit('/signup')
cy.get('[data-cy="email"]').type(userEmail)
cy.get('[data-cy="password"]').type(password)
cy.get('[data-cy="passwordVerification"]').type(password)
cy.get('[data-cy="passwordConfirmation"]').type(password)
cy.get('[data-cy="submit"]').click()

// We shouldn't be on the signup page anymore
Expand Down
53 changes: 53 additions & 0 deletions cypress/e2e/app/submission-box/settings.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { TIMEOUT } from '../../../utils/constants'

describe('Submission box settings tests', () => {
before(() => {
cy.task('clearDB')
})

beforeEach(() => {
cy.task('clearDB')
})

it('Should not allow the user to go to the next step without entering a title', () => {
// Check that submitting with nothing in the fields presents user with prompts and does not let the user move on
cy.visit('/submission-box/settings')

cy.wait(1000) // this is necessary because the layout shifts slightly due to the multiline text box

// Check that the errors do not exist
cy.get('p.Mui-error').should('have.length', 0)

cy.get('[data-cy="next"]').click()

cy.url().should('include', '/submission-box/settings')

cy.get('p.Mui-error').should('have.length', 1)
cy.get('[data-cy="submission-box-title"]')
.find('p.Mui-error')
.should('be.visible')
.and('contain', 'Please enter a title for your submission box')
})

it('Should allow user to move on to the next page', () => {
// User data
const title = 'My Test Title'

// Create submission box
cy.visit('/submission-box/settings')
cy.get('[data-cy="submission-box-title"]').type(title)
cy.get('[data-cy="next"]').click()

// We shouldn't be on the submission-box/settings page anymore
cy.url({ timeout: TIMEOUT.EXTRA_LONG }).should('include', '/submission-box/add-members')
})

it('Should let the user return to the previous page using the back button', () => {
cy.visit('/submission-box/settings')

cy.get('[data-cy="back-button"]').click()
te-sa marked this conversation as resolved.
Show resolved Hide resolved

// TODO: change this to test for appropriate URL (currently not implemented as the user is not logged in for this test and would therefore be re-routed to login)
// cy.url().should('include', '/dashboard')
})
})
Loading