-
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 'main' into faris/misc-fixes
- Loading branch information
Showing
9 changed files
with
158 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: E2E Cypress tests | ||
on: push | ||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Install npm dependencies, cache them correctly | ||
# and run all Cypress tests | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
env: | ||
NEXT_PUBLIC_ACM_API_URL: https://testing.api.acmucsd.com/api/v2 | ||
with: | ||
start: yarn dev:start | ||
wait-on: 'http://localhost:3000' | ||
install-command: yarn install |
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Forgot Password Page', () => { | ||
beforeEach(() => { | ||
cy.visit('/forgot-password'); | ||
}); | ||
|
||
it('Should fail with missing email', () => { | ||
cy.contains('button', 'Submit').click(); | ||
cy.contains('p', 'Required').should('exist'); | ||
}); | ||
|
||
it('Should fail with unknown email', () => { | ||
const email = '[email protected]'; | ||
cy.get('input[name="email"]').type(email); | ||
cy.contains('button', 'Submit').click(); | ||
|
||
cy.get('.Toastify').contains('There is no account associated with that email').should('exist'); | ||
}); | ||
|
||
it('Should succeed with valid email', () => { | ||
cy.fixture('accounts').then(({ standard }) => { | ||
const { email } = standard; | ||
cy.get('input[name="email"]').type(email); | ||
cy.contains('button', 'Submit').click(); | ||
|
||
cy.get('.Toastify').contains('Success').should('exist'); | ||
}); | ||
}); | ||
}); |
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,79 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Login Page', () => { | ||
beforeEach(() => { | ||
cy.visit('/login'); | ||
}); | ||
|
||
it('Should succeed with valid member login', () => { | ||
cy.fixture('accounts').then(({ standard }) => { | ||
const { email, password } = standard; | ||
|
||
cy.get('input[name="email"]').type(email); | ||
cy.get('input[name="password"]').type(password); | ||
cy.get('button').contains('Sign In').click(); | ||
|
||
cy.location('pathname').should('equal', '/'); | ||
cy.getCookie('ACCESS_TOKEN').should('exist'); | ||
}); | ||
}); | ||
|
||
it('Should succeed with valid admin login', () => { | ||
cy.fixture('accounts').then(({ admin }) => { | ||
const { email, password } = admin; | ||
|
||
cy.get('input[name="email"]').type(email); | ||
cy.get('input[name="password"]').type(password); | ||
cy.get('button').contains('Sign In').click(); | ||
|
||
cy.location('pathname').should('equal', '/'); | ||
cy.getCookie('ACCESS_TOKEN').should('exist'); | ||
cy.getCookie('USER').should('exist'); | ||
}); | ||
}); | ||
|
||
it('Should fail with invalid credentials', () => { | ||
const [email, password] = ['[email protected]', 'abc']; | ||
|
||
cy.get('input[name="email"]').type(email); | ||
cy.get('input[name="password"]').type(password); | ||
cy.get('button').contains('Sign In').click(); | ||
|
||
cy.get('.Toastify').contains('Unable to login').should('exist'); | ||
cy.location('pathname').should('equal', '/login'); | ||
}); | ||
|
||
it('Should fail with missing username', () => { | ||
cy.fixture('accounts').then(({ standard }) => { | ||
const { password } = standard; | ||
|
||
cy.get('input[name="password"]').type(password); | ||
cy.get('button').contains('Sign In').click(); | ||
|
||
cy.location('pathname').should('equal', '/login'); | ||
cy.contains('p', 'Required').should('exist'); | ||
}); | ||
}); | ||
|
||
it('Should fail with missing password', () => { | ||
cy.fixture('accounts').then(({ standard }) => { | ||
const { email } = standard; | ||
|
||
cy.get('input[name="email"]').type(email); | ||
cy.get('button').contains('Sign In').click(); | ||
|
||
cy.location('pathname').should('equal', '/login'); | ||
cy.contains('p', 'Required').should('exist'); | ||
}); | ||
}); | ||
|
||
it('Should link to forgot password page', () => { | ||
cy.get('a').contains('Forgot your password?').click(); | ||
cy.location('pathname').should('equal', '/forgot-password'); | ||
}); | ||
|
||
it('Should link to account register page', () => { | ||
cy.get('a').contains('Sign Up').click(); | ||
cy.location('pathname').should('equal', '/register'); | ||
}); | ||
}); |
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,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Register Page', () => { | ||
beforeEach(() => { | ||
cy.visit('/register'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{ | ||
"admin": { | ||
"username": "[email protected]", | ||
"email": "[email protected]", | ||
"password": "password" | ||
}, | ||
"standard": { | ||
"email": "[email protected]", | ||
"password": "password" | ||
} | ||
} |
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