-
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.
- Loading branch information
1 parent
af33c8f
commit e5abdb6
Showing
14 changed files
with
220 additions
and
49 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
Validating CODEOWNERS rules …
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 +1 @@ | ||
* @farisashai @raymosun @trevorkw7 @sheeptester | ||
* @farisashai @raymosun @trevorkw7 @sheeptester @alexzhang1618 |
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
This file was deleted.
Oops, something went wrong.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"first": "John", | ||
"last": "Doe", | ||
"bio": "I am a testing account.", | ||
"major": "Computer Engineering", | ||
"year": "2026" | ||
} |
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 +1,50 @@ | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
/** | ||
* Log in as the specified user, pulling details from accounts.json | ||
* @example cy.login('standard') | ||
*/ | ||
login(account: string): Chainable<void>; | ||
|
||
/** | ||
* Type text into a form input or textarea under specified label | ||
* @param label - text of label that the input is a child of | ||
* @param value - text to be typed into input | ||
*/ | ||
typeInForm(label: string, value: string): Chainable<void>; | ||
|
||
/** | ||
* Select the given option in a select under specified label | ||
* @param label - text of label that the select is a child of | ||
* @param value - option to be selected | ||
*/ | ||
selectInForm(label: string, value: string): Chainable<void>; | ||
} | ||
} | ||
} | ||
|
||
Cypress.Commands.add('login', (account: string) => { | ||
cy.fixture('accounts.json').then(accs => { | ||
if (!(account in accs)) | ||
throw new Error(`Account '${account}' isn't specified in \`accounts.json\``); | ||
const { email, password } = accs[account]; | ||
|
||
cy.visit('/login'); | ||
cy.get('input[name="email"]').type(email); | ||
cy.get('input[name="password"]').type(password); | ||
cy.get('button').contains('Sign In').click(); | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('typeInForm', (label: string, value: string) => { | ||
cy.get(`label:contains("${label}") input, label:contains("${label}") textarea`).as('input'); | ||
cy.get('@input').clear(); | ||
cy.get('@input').type(value as string); | ||
}); | ||
|
||
Cypress.Commands.add('selectInForm', (label: string, value: string | number) => { | ||
cy.get(`label:contains("${label}") select`).select(value); | ||
}); | ||
|
||
export {}; |