-
Notifications
You must be signed in to change notification settings - Fork 4
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
Cypress - Frontend Tests Integration [WIP] #479
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e84c286
some
pratyush1712 7a9d7f2
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 b8f3211
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 8ac410a
switched to crypto-js as crypto is a node module
pratyush1712 1af1aa2
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 758bba0
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 26220c3
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 0bf9ccb
fixed removing aria-descibedby in production
pratyush1712 d2d16dc
remove console.log
pratyush1712 746e675
fixed notification design
pratyush1712 6090796
reverting back to usage of Carriage initials
pratyush1712 e01d2dc
delete mock test data
pratyush1712 5cc9d41
compress
pratyush1712 a6f78be
remoce unused useId
pratyush1712 154e934
Merge branch 'master' into pratyush/notification-design
pratyush1712 cdffcce
save
pratyush1712 9103855
Merge branch 'pratyush/notification-design' of https://github.com/cor…
pratyush1712 ee8d640
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 6160061
Merge branch 'master' of https://github.com/cornell-dti/carriage-web
pratyush1712 26486bf
first step
pratyush1712 7810ce3
added tests for the landing page
pratyush1712 d94c206
resolve lint issues
pratyush1712 9a84046
Documentation Updates:
pratyush1712 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,24 @@ | ||
name: CI Frontend Test | ||
on: | ||
pull_request: | ||
paths: ['frontend/**'] | ||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
containers: [1, 2, 3] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
start: npm start | ||
wait-on: 'http://localhost:3000' | ||
record: true | ||
parallel: true | ||
env: | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,10 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
projectId: 'n22mn9', | ||
video: false, | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
}, | ||
}); |
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,58 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Landing Page', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it('successfully loads', () => { | ||
cy.get('[data-cy="home"]').should('be.visible'); | ||
}); | ||
|
||
it('has the correct title', () => { | ||
cy.title().should('include', 'Login - Carriage'); | ||
}); | ||
|
||
it('has visible student and admin login buttons with correct text', () => { | ||
cy.get('[data-cy="container_item_left"]') | ||
.should('contain', 'Sign in with Google') | ||
.and('contain', 'Students'); | ||
cy.get('[data-cy="container_item_right"]') | ||
.should('contain', 'Sign in with Google') | ||
.and('contain', 'Admins'); | ||
}); | ||
|
||
it('has a visible logo for both student and admin buttons', () => { | ||
cy.get('[data-cy="badge"]').should('have.attr', 'alt', 'Carriage logo'); | ||
cy.get('[data-cy="container_item_left"] img').should( | ||
'have.attr', | ||
'alt', | ||
'google logo' | ||
); | ||
cy.get('[data-cy="container_item_right"] img').should( | ||
'have.attr', | ||
'alt', | ||
'google logo' | ||
); | ||
}); | ||
|
||
it('student login button triggers the correct function', () => { | ||
// Spy on 'studentLogin' function | ||
// const spy = cy.spy().as('studentLoginSpy'); | ||
// cy.window().then((win) => { | ||
// // win.studentLogin = spy; | ||
// }); | ||
// cy.get('[data-cy="container_item_left"] .btn').click(); | ||
// cy.get('@studentLoginSpy').should('have.been.calledOnce'); | ||
}); | ||
|
||
it('admin login button triggers the correct function', () => { | ||
// Spy on 'adminLogin' function | ||
// const spy = cy.spy().as('adminLoginSpy'); | ||
// cy.window().then((win) => { | ||
// // win.adminLogin = spy; | ||
// }); | ||
// cy.get('[data-cy="container_item_right"] .btn').click(); | ||
// cy.get('@adminLoginSpy').should('have.been.calledOnce'); | ||
}); | ||
}); |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
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,5 @@ | ||
{ | ||
"id": 8739, | ||
"name": "Jane", | ||
"email": "jane@example.com" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: eof should be line break |
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,232 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"name": "Leanne Graham", | ||
"username": "Bret", | ||
"email": "Sincere@april.biz", | ||
"address": { | ||
"street": "Kulas Light", | ||
"suite": "Apt. 556", | ||
"city": "Gwenborough", | ||
"zipcode": "92998-3874", | ||
"geo": { | ||
"lat": "-37.3159", | ||
"lng": "81.1496" | ||
} | ||
}, | ||
"phone": "1-770-736-8031 x56442", | ||
"website": "hildegard.org", | ||
"company": { | ||
"name": "Romaguera-Crona", | ||
"catchPhrase": "Multi-layered client-server neural-net", | ||
"bs": "harness real-time e-markets" | ||
} | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Ervin Howell", | ||
"username": "Antonette", | ||
"email": "Shanna@melissa.tv", | ||
"address": { | ||
"street": "Victor Plains", | ||
"suite": "Suite 879", | ||
"city": "Wisokyburgh", | ||
"zipcode": "90566-7771", | ||
"geo": { | ||
"lat": "-43.9509", | ||
"lng": "-34.4618" | ||
} | ||
}, | ||
"phone": "010-692-6593 x09125", | ||
"website": "anastasia.net", | ||
"company": { | ||
"name": "Deckow-Crist", | ||
"catchPhrase": "Proactive didactic contingency", | ||
"bs": "synergize scalable supply-chains" | ||
} | ||
}, | ||
{ | ||
"id": 3, | ||
"name": "Clementine Bauch", | ||
"username": "Samantha", | ||
"email": "Nathan@yesenia.net", | ||
"address": { | ||
"street": "Douglas Extension", | ||
"suite": "Suite 847", | ||
"city": "McKenziehaven", | ||
"zipcode": "59590-4157", | ||
"geo": { | ||
"lat": "-68.6102", | ||
"lng": "-47.0653" | ||
} | ||
}, | ||
"phone": "1-463-123-4447", | ||
"website": "ramiro.info", | ||
"company": { | ||
"name": "Romaguera-Jacobson", | ||
"catchPhrase": "Face to face bifurcated interface", | ||
"bs": "e-enable strategic applications" | ||
} | ||
}, | ||
{ | ||
"id": 4, | ||
"name": "Patricia Lebsack", | ||
"username": "Karianne", | ||
"email": "Julianne.OConner@kory.org", | ||
"address": { | ||
"street": "Hoeger Mall", | ||
"suite": "Apt. 692", | ||
"city": "South Elvis", | ||
"zipcode": "53919-4257", | ||
"geo": { | ||
"lat": "29.4572", | ||
"lng": "-164.2990" | ||
} | ||
}, | ||
"phone": "493-170-9623 x156", | ||
"website": "kale.biz", | ||
"company": { | ||
"name": "Robel-Corkery", | ||
"catchPhrase": "Multi-tiered zero tolerance productivity", | ||
"bs": "transition cutting-edge web services" | ||
} | ||
}, | ||
{ | ||
"id": 5, | ||
"name": "Chelsey Dietrich", | ||
"username": "Kamren", | ||
"email": "Lucio_Hettinger@annie.ca", | ||
"address": { | ||
"street": "Skiles Walks", | ||
"suite": "Suite 351", | ||
"city": "Roscoeview", | ||
"zipcode": "33263", | ||
"geo": { | ||
"lat": "-31.8129", | ||
"lng": "62.5342" | ||
} | ||
}, | ||
"phone": "(254)954-1289", | ||
"website": "demarco.info", | ||
"company": { | ||
"name": "Keebler LLC", | ||
"catchPhrase": "User-centric fault-tolerant solution", | ||
"bs": "revolutionize end-to-end systems" | ||
} | ||
}, | ||
{ | ||
"id": 6, | ||
"name": "Mrs. Dennis Schulist", | ||
"username": "Leopoldo_Corkery", | ||
"email": "Karley_Dach@jasper.info", | ||
"address": { | ||
"street": "Norberto Crossing", | ||
"suite": "Apt. 950", | ||
"city": "South Christy", | ||
"zipcode": "23505-1337", | ||
"geo": { | ||
"lat": "-71.4197", | ||
"lng": "71.7478" | ||
} | ||
}, | ||
"phone": "1-477-935-8478 x6430", | ||
"website": "ola.org", | ||
"company": { | ||
"name": "Considine-Lockman", | ||
"catchPhrase": "Synchronised bottom-line interface", | ||
"bs": "e-enable innovative applications" | ||
} | ||
}, | ||
{ | ||
"id": 7, | ||
"name": "Kurtis Weissnat", | ||
"username": "Elwyn.Skiles", | ||
"email": "Telly.Hoeger@billy.biz", | ||
"address": { | ||
"street": "Rex Trail", | ||
"suite": "Suite 280", | ||
"city": "Howemouth", | ||
"zipcode": "58804-1099", | ||
"geo": { | ||
"lat": "24.8918", | ||
"lng": "21.8984" | ||
} | ||
}, | ||
"phone": "210.067.6132", | ||
"website": "elvis.io", | ||
"company": { | ||
"name": "Johns Group", | ||
"catchPhrase": "Configurable multimedia task-force", | ||
"bs": "generate enterprise e-tailers" | ||
} | ||
}, | ||
{ | ||
"id": 8, | ||
"name": "Nicholas Runolfsdottir V", | ||
"username": "Maxime_Nienow", | ||
"email": "Sherwood@rosamond.me", | ||
"address": { | ||
"street": "Ellsworth Summit", | ||
"suite": "Suite 729", | ||
"city": "Aliyaview", | ||
"zipcode": "45169", | ||
"geo": { | ||
"lat": "-14.3990", | ||
"lng": "-120.7677" | ||
} | ||
}, | ||
"phone": "586.493.6943 x140", | ||
"website": "jacynthe.com", | ||
"company": { | ||
"name": "Abernathy Group", | ||
"catchPhrase": "Implemented secondary concept", | ||
"bs": "e-enable extensible e-tailers" | ||
} | ||
}, | ||
{ | ||
"id": 9, | ||
"name": "Glenna Reichert", | ||
"username": "Delphine", | ||
"email": "Chaim_McDermott@dana.io", | ||
"address": { | ||
"street": "Dayna Park", | ||
"suite": "Suite 449", | ||
"city": "Bartholomebury", | ||
"zipcode": "76495-3109", | ||
"geo": { | ||
"lat": "24.6463", | ||
"lng": "-168.8889" | ||
} | ||
}, | ||
"phone": "(775)976-6794 x41206", | ||
"website": "conrad.com", | ||
"company": { | ||
"name": "Yost and Sons", | ||
"catchPhrase": "Switchable contextually-based project", | ||
"bs": "aggregate real-time technologies" | ||
} | ||
}, | ||
{ | ||
"id": 10, | ||
"name": "Clementina DuBuque", | ||
"username": "Moriah.Stanton", | ||
"email": "Rey.Padberg@karina.biz", | ||
"address": { | ||
"street": "Kattie Turnpike", | ||
"suite": "Suite 198", | ||
"city": "Lebsackbury", | ||
"zipcode": "31428-2261", | ||
"geo": { | ||
"lat": "-38.2386", | ||
"lng": "57.2232" | ||
} | ||
}, | ||
"phone": "024-648-3804", | ||
"website": "ambrose.net", | ||
"company": { | ||
"name": "Hoeger LLC", | ||
"catchPhrase": "Centralized empowering task-force", | ||
"bs": "target end-to-end models" | ||
} | ||
} | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: eof should be line break |
Binary file added
BIN
+167 KB
frontend/cypress/screenshots/2-advanced-examples/misc.cy.js/my-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be tripping but I don't see this defined in
/package.json
?