-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from alexlee-dev/v1.1.0
📦 v1.1.0
- Loading branch information
Showing
56 changed files
with
4,539 additions
and
285 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules/ | |
build/ | ||
dist/ | ||
cypress/screenshots/ | ||
cypress/videos/ | ||
cypress/videos/ | ||
.env-cmdrc.json |
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
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,8 @@ | ||
{ | ||
"_id": "12345", | ||
"email": "[email protected]", | ||
"name": "Bob Test", | ||
"createdAt": "2020-07-20T21:09:00.323Z", | ||
"updatedAt": "2020-07-20T21:12:01.627Z", | ||
"__v": 1 | ||
} |
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,8 @@ | ||
{ | ||
"_id": "12345", | ||
"email": "[email protected]", | ||
"name": "Bob Test", | ||
"createdAt": "2020-07-20T21:09:00.323Z", | ||
"updatedAt": "2020-07-20T21:12:01.627Z", | ||
"__v": 1 | ||
} |
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,71 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context("Login - Success", () => { | ||
beforeEach(() => { | ||
cy.fixture("jobs50").then((jobsJson) => { | ||
cy.fixture("login").then((loginJson) => { | ||
cy.server(); | ||
cy.route({ | ||
method: "GET", | ||
url: "/jobs", | ||
status: 200, | ||
response: jobsJson, | ||
delay: 1000, | ||
}); | ||
cy.route({ | ||
method: "POST", | ||
url: "/user/login", | ||
status: 200, | ||
response: loginJson, | ||
delay: 1000, | ||
}); | ||
}); | ||
}); | ||
cy.visit("http://localhost:3000"); | ||
cy.wait(1000); | ||
cy.get("#nav-login").click(); | ||
cy.get("h1").should("have.text", "Login"); | ||
}); | ||
|
||
it("Should be able to log in with existing account", () => { | ||
cy.get("#email").type("[email protected]"); | ||
cy.get("#password").type("Red123456!!!"); | ||
cy.get("#log-in").click(); | ||
cy.wait(1500); | ||
|
||
cy.get("#nav-login").should("not.exist"); | ||
cy.get("#search").should("be.visible"); | ||
}); | ||
|
||
it("Should be able to get to Signup from Login page", () => { | ||
cy.get("#create-an-account").click(); | ||
cy.get("h1").should("have.text", "Create Account"); | ||
}); | ||
}); | ||
|
||
context("Login - Error", () => { | ||
beforeEach(() => { | ||
cy.fixture("jobs50").then((jobsJson) => { | ||
cy.server(); | ||
cy.route({ | ||
method: "GET", | ||
url: "/jobs", | ||
status: 200, | ||
response: jobsJson, | ||
delay: 1000, | ||
}); | ||
}); | ||
cy.visit("http://localhost:3000"); | ||
cy.wait(1000); | ||
cy.get("#nav-login").click(); | ||
cy.get("h1").should("have.text", "Login"); | ||
}); | ||
|
||
it("Should not allow to login with invalid credentials", () => { | ||
cy.get("#email").type("[email protected]"); | ||
cy.get("#password").type("Red123456!!!"); | ||
cy.get("#log-in").click(); | ||
cy.wait(500); | ||
cy.get("#notification-text").should("have.text", "Invalid credentials."); | ||
}); | ||
}); |
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,95 @@ | ||
/// <reference types="cypress" /> | ||
|
||
context("Notification", () => { | ||
beforeEach(() => { | ||
cy.fixture("jobs50").then((jobsJson) => { | ||
cy.server(); | ||
cy.route({ | ||
method: "GET", | ||
url: "/jobs", | ||
status: 200, | ||
response: jobsJson, | ||
delay: 1000, | ||
}); | ||
}); | ||
cy.visit("http://localhost:3000"); | ||
cy.wait(1000); | ||
}); | ||
|
||
it("Should reset the notification on initial load", () => { | ||
cy.get("#nav-login").click(); | ||
cy.get("h1").should("have.text", "Login"); | ||
cy.get("#email").type("[email protected]"); | ||
cy.get("#password").type("Red123456!!!"); | ||
cy.get("#log-in").click(); | ||
cy.wait(1500); | ||
cy.get("#nav-login").should("not.exist"); | ||
cy.get("#search").should("be.visible"); | ||
cy.get("#nav-profile").click(); | ||
cy.get("#edit").click(); | ||
cy.get("h1").should("have.text", "Edit Profile"); | ||
cy.get("#edit-name").clear(); | ||
cy.get("#edit-name").type("Cool Bob"); | ||
cy.get("#edit-confirm").click(); | ||
|
||
cy.wait(1500); | ||
|
||
cy.get("h1").should("have.text", "Profile"); | ||
cy.get("#notification-text").should( | ||
"have.text", | ||
"Profile information updated successfully." | ||
); | ||
|
||
cy.reload(); | ||
cy.get("#nav-profile").click(); | ||
cy.get("#notification-text").should("not.exist"); | ||
|
||
// * Reset to normal data (Cleanup) | ||
cy.get("#edit").click(); | ||
cy.get("#notification-text").should("not.exist"); | ||
cy.get("#edit-name").clear(); | ||
cy.get("#edit-name").type("Bob Test"); | ||
cy.get("#edit-confirm").click(); | ||
cy.wait(1500); | ||
cy.get("h1").should("have.text", "Profile"); | ||
cy.get("#name").should("have.value", "Bob Test"); | ||
cy.get("#email").should("have.value", "[email protected]"); | ||
}); | ||
|
||
it("Should disappear after 5 seconds", () => { | ||
cy.get("#nav-login").click(); | ||
cy.get("h1").should("have.text", "Login"); | ||
cy.get("#email").type("[email protected]"); | ||
cy.get("#password").type("Red123456!!!"); | ||
cy.get("#log-in").click(); | ||
cy.wait(1500); | ||
cy.get("#nav-login").should("not.exist"); | ||
cy.get("#search").should("be.visible"); | ||
cy.get("#nav-profile").click(); | ||
cy.get("#edit").click(); | ||
cy.get("h1").should("have.text", "Edit Profile"); | ||
cy.get("#edit-name").clear(); | ||
cy.get("#edit-name").type("Cool Bob"); | ||
cy.get("#edit-confirm").click(); | ||
|
||
cy.wait(1500); | ||
|
||
cy.get("h1").should("have.text", "Profile"); | ||
cy.get("#notification-text").should( | ||
"have.text", | ||
"Profile information updated successfully." | ||
); | ||
cy.wait(5000); | ||
cy.get("#notification-text").should("not.exist"); | ||
|
||
// * Reset to normal data (Cleanup) | ||
cy.get("#edit").click(); | ||
cy.get("#edit-name").clear(); | ||
cy.get("#edit-name").type("Bob Test"); | ||
cy.get("#edit-confirm").click(); | ||
cy.wait(1500); | ||
cy.get("h1").should("have.text", "Profile"); | ||
cy.get("#name").should("have.value", "Bob Test"); | ||
cy.get("#email").should("have.value", "[email protected]"); | ||
}); | ||
}); |
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
Oops, something went wrong.