Skip to content

Implemented comments #93

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

Open
wants to merge 75 commits into
base: main
Choose a base branch
from
Open
Changes from 5 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
e2a4d61
create homepage route and basic navbar
edwardfgt Mar 7, 2023
80ed053
add logic for navbar updating when user signsout
edwardfgt Mar 7, 2023
456eaef
Created CreatePost.js
forreya Mar 7, 2023
3c6d319
add logic for signin, move setToken method and logout method to app.js
edwardfgt Mar 7, 2023
bb20c6c
remove redundant home button
edwardfgt Mar 7, 2023
c22269b
create e2e tests for navbar
edwardfgt Mar 7, 2023
77adfaa
Merge pull request #1 from edwardfgt/create-post
edwardfgt Mar 7, 2023
7c8a17c
update test naming
edwardfgt Mar 7, 2023
7bac5f6
merge new code into navbar branch
edwardfgt Mar 7, 2023
8f9e754
revert to c22269b to continue working without errors
edwardfgt Mar 8, 2023
b68065a
add comments on reasoning for navbar logic
edwardfgt Mar 8, 2023
ff88ac6
update UserSchema to include firstName & lastName
edwardfgt Mar 8, 2023
e4d8c77
update signup form and post request to include new user information
edwardfgt Mar 8, 2023
eb97fa2
update all API tests to include new signup fields
edwardfgt Mar 8, 2023
04e49ff
update frontend signup tests to include new fields
edwardfgt Mar 8, 2023
e162453
add bootstrap stling to login and signup page
edwardfgt Mar 8, 2023
1cafc5d
add error message for incorrect login details
edwardfgt Mar 8, 2023
254f66d
Fixed minor bug
forreya Mar 8, 2023
84a0086
Merge pull request #2 from edwardfgt/create-post
edwardfgt Mar 8, 2023
96e4321
test storing email in localstorage
edwardfgt Mar 8, 2023
0da6b81
merged from main
edwardfgt Mar 8, 2023
907e5f1
add createPost and feed components onto the homepage
edwardfgt Mar 8, 2023
07ec948
fix CreatePost.js
edwardfgt Mar 9, 2023
5188935
feed auto refereshes when new post is made
edwardfgt Mar 9, 2023
dee5ead
start creating tests for createPost.js but commented out for the time…
edwardfgt Mar 9, 2023
e979744
Merge pull request #3 from edwardfgt/navbar
edwardfgt Mar 9, 2023
511dcaf
merge fix with main
edwardfgt Mar 9, 2023
3bc86d0
Merge pull request #4 from edwardfgt/createPostFix
edwardfgt Mar 9, 2023
1f3cbf3
Branch Update
MaxAllan-Smith Mar 9, 2023
89ef879
?
MaxAllan-Smith Mar 9, 2023
cfa740a
Update
MaxAllan-Smith Mar 9, 2023
3669d32
Updated the nav bar with some design and functionality. Logout handle…
MaxAllan-Smith Mar 9, 2023
c9ec8f8
Updated index.js to run bootsrap
MaxAllan-Smith Mar 9, 2023
7fed13b
Merge branch 'Basic-Design' into Basic-Posts-Design
MaxAllan-Smith Mar 9, 2023
cea6ffe
Updated index.js, removed import for bootstrap
MaxAllan-Smith Mar 9, 2023
97a1074
Completed the final BASIC design for feed page.
MaxAllan-Smith Mar 9, 2023
3323aa7
Merge pull request #5 from edwardfgt/Basic-Design
edwardfgt Mar 9, 2023
b4276bf
Merge pull request #6 from edwardfgt/Basic-Posts-Design
edwardfgt Mar 9, 2023
31c0159
Fixed refresh bug, added UserContext, system now stores user info in …
forreya Mar 9, 2023
44fdc1e
Merge branch 'main' into add-features
forreya Mar 9, 2023
57d43dd
Merge pull request #7 from edwardfgt/add-features
edwardfgt Mar 10, 2023
e72fdfe
Added some basic CSS for the homepage. Functionality still needs to b…
MaxAllan-Smith Mar 10, 2023
3c6c1ea
fix token.spec.js broken test
edwardfgt Mar 11, 2023
e658192
fix current frontend e2e tests
edwardfgt Mar 11, 2023
e93c79a
create e2e test for creating a new post (with refresh) and add extra …
edwardfgt Mar 11, 2023
b953786
add date & time to posts and update post.cy.js component test
edwardfgt Mar 11, 2023
4e0d03a
update e2e tests with extra condition
edwardfgt Mar 11, 2023
cb2bd06
update post schema, post controller and post component so poster firs…
edwardfgt Mar 11, 2023
b04b82f
create model, crontroller and route for liking a post
edwardfgt Mar 12, 2023
852aba8
implement like button and handleLike method to Post.js component
edwardfgt Mar 12, 2023
fdd2289
display number of likes by each post, add logic to display unlike but…
edwardfgt Mar 12, 2023
2a5128f
create unlike controller and handleUnlike method
edwardfgt Mar 12, 2023
c21018c
update controllers to stop user liking or unliking more than once
edwardfgt Mar 12, 2023
07ca613
posts auto update when liked or unliked
edwardfgt Mar 12, 2023
9ab138f
fix bug on homepage
edwardfgt Mar 12, 2023
0a577b1
Merge pull request #8 from edwardfgt/Design-Homepage
edwardfgt Mar 12, 2023
1df746c
merge Max css with weekendChanges
edwardfgt Mar 12, 2023
b3d2722
fix class naming issue
edwardfgt Mar 12, 2023
36abc91
Merge pull request #9 from edwardfgt/weekendChanges
edwardfgt Mar 13, 2023
47dbcac
Implemeneted basi CSS design to the login form
MaxAllan-Smith Mar 13, 2023
bd8bc49
Added a flashing message to the screen when log in details are eneter…
MaxAllan-Smith Mar 13, 2023
49665da
create comment model, create controller and route
edwardfgt Mar 13, 2023
1c73dd0
Added video to homepage. Design
MaxAllan-Smith Mar 13, 2023
a7c994a
display number of comments under each post
edwardfgt Mar 13, 2023
909dd02
Added a forgotten-password page
MaxAllan-Smith Mar 13, 2023
d2c4f8c
Updated branch
MaxAllan-Smith Mar 13, 2023
811d02c
update bug in comment controller, create basic create comment form
edwardfgt Mar 13, 2023
41b8d14
Created Forgotten Password page. Not functional.
MaxAllan-Smith Mar 13, 2023
ff73f44
work to fix comment feature
edwardfgt Mar 13, 2023
04095a5
small changes to comment controller and post.js
edwardfgt Mar 14, 2023
1bdfc4c
small changes to post component so that create comment works
edwardfgt Mar 14, 2023
89a1112
comment count loads on feed refresh and increments on creation of new…
edwardfgt Mar 14, 2023
b32e60d
Merge pull request #10 from edwardfgt/Design-Login-Page
edwardfgt Mar 14, 2023
31c73e9
Merge pull request #11 from edwardfgt/Forgotten-Password-Page
edwardfgt Mar 14, 2023
c91b1e6
merge Max design pull requests into branch, link signup button with s…
edwardfgt Mar 14, 2023
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
7 changes: 7 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
};
143 changes: 143 additions & 0 deletions cypress/e2e/1-getting-started/todo.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/// <reference types="cypress" />

// Welcome to Cypress!
//
// This spec file contains a variety of sample tests
// for a todo list app that are designed to demonstrate
// the power of writing tests in Cypress.
//
// To learn more about how Cypress works and
// what makes it such an awesome testing tool,
// please read our getting started guide:
// https://on.cypress.io/introduction-to-cypress

describe('example to-do app', () => {
beforeEach(() => {
// Cypress starts out with a blank slate for each test
// so we must tell it to visit our website with the `cy.visit()` command.
// Since we want to visit the same URL at the start of all our tests,
// we include it in our beforeEach function so that it runs before each test
cy.visit('https://example.cypress.io/todo')
})

it('displays two todo items by default', () => {
// We use the `cy.get()` command to get all elements that match the selector.
// Then, we use `should` to assert that there are two matched items,
// which are the two default items.
cy.get('.todo-list li').should('have.length', 2)

// We can go even further and check that the default todos each contain
// the correct text. We use the `first` and `last` functions
// to get just the first and last matched elements individually,
// and then perform an assertion with `should`.
cy.get('.todo-list li').first().should('have.text', 'Pay electric bill')
cy.get('.todo-list li').last().should('have.text', 'Walk the dog')
})

it('can add new todo items', () => {
// We'll store our item text in a variable so we can reuse it
const newItem = 'Feed the cat'

// Let's get the input element and use the `type` command to
// input our new list item. After typing the content of our item,
// we need to type the enter key as well in order to submit the input.
// This input has a data-test attribute so we'll use that to select the
// element in accordance with best practices:
// https://on.cypress.io/selecting-elements
cy.get('[data-test=new-todo]').type(`${newItem}{enter}`)

// Now that we've typed our new item, let's check that it actually was added to the list.
// Since it's the newest item, it should exist as the last element in the list.
// In addition, with the two default items, we should have a total of 3 elements in the list.
// Since assertions yield the element that was asserted on,
// we can chain both of these assertions together into a single statement.
cy.get('.todo-list li')
.should('have.length', 3)
.last()
.should('have.text', newItem)
})

it('can check off an item as completed', () => {
// In addition to using the `get` command to get an element by selector,
// we can also use the `contains` command to get an element by its contents.
// However, this will yield the <label>, which is lowest-level element that contains the text.
// In order to check the item, we'll find the <input> element for this <label>
// by traversing up the dom to the parent element. From there, we can `find`
// the child checkbox <input> element and use the `check` command to check it.
cy.contains('Pay electric bill')
.parent()
.find('input[type=checkbox]')
.check()

// Now that we've checked the button, we can go ahead and make sure
// that the list element is now marked as completed.
// Again we'll use `contains` to find the <label> element and then use the `parents` command
// to traverse multiple levels up the dom until we find the corresponding <li> element.
// Once we get that element, we can assert that it has the completed class.
cy.contains('Pay electric bill')
.parents('li')
.should('have.class', 'completed')
})

context('with a checked task', () => {
beforeEach(() => {
// We'll take the command we used above to check off an element
// Since we want to perform multiple tests that start with checking
// one element, we put it in the beforeEach hook
// so that it runs at the start of every test.
cy.contains('Pay electric bill')
.parent()
.find('input[type=checkbox]')
.check()
})

it('can filter for uncompleted tasks', () => {
// We'll click on the "active" button in order to
// display only incomplete items
cy.contains('Active').click()

// After filtering, we can assert that there is only the one
// incomplete item in the list.
cy.get('.todo-list li')
.should('have.length', 1)
.first()
.should('have.text', 'Walk the dog')

// For good measure, let's also assert that the task we checked off
// does not exist on the page.
cy.contains('Pay electric bill').should('not.exist')
})

it('can filter for completed tasks', () => {
// We can perform similar steps as the test above to ensure
// that only completed tasks are shown
cy.contains('Completed').click()

cy.get('.todo-list li')
.should('have.length', 1)
.first()
.should('have.text', 'Pay electric bill')

cy.contains('Walk the dog').should('not.exist')
})

it('can delete all completed tasks', () => {
// First, let's click the "Clear completed" button
// `contains` is actually serving two purposes here.
// First, it's ensuring that the button exists within the dom.
// This button only appears when at least one task is checked
// so this command is implicitly verifying that it does exist.
// Second, it selects the button so we can click it.
cy.contains('Clear completed').click()

// Then we can make sure that there is only one element
// in the list and our element does not exist
cy.get('.todo-list li')
.should('have.length', 1)
.should('not.have.text', 'Pay electric bill')

// Finally, make sure that the clear button no longer exists.
cy.contains('Clear completed').should('not.exist')
})
})
})
Loading