-
Notifications
You must be signed in to change notification settings - Fork 521
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 #7 from wexnox/workflow_End-to-End-Testing
Workflow end to end testing
- Loading branch information
Showing
12 changed files
with
1,895 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"/Users/lasseronningen/Sites/WorkflowCA/src/js/api/auth/login.js":"1","/Users/lasseronningen/Sites/WorkflowCA/src/js/api/auth/login.test.js":"2","/Users/lasseronningen/Sites/WorkflowCA/src/js/api/auth/logout.test.js":"3","/Users/lasseronningen/Sites/WorkflowCA/src/js/storage/index.js":"4","/Users/lasseronningen/Sites/WorkflowCA/src/js/storage/localStorageMock.js":"5","/Users/lasseronningen/Sites/WorkflowCA/cypress/e2e/createPost.cy.js":"6","/Users/lasseronningen/Sites/WorkflowCA/cypress/e2e/login.cy.js":"7","/Users/lasseronningen/Sites/WorkflowCA/cypress/e2e/logout.cy.js":"8"},{"size":593,"mtime":1692549155944,"results":"9","hashOfConfig":"10"},{"size":1556,"mtime":1692551277305,"results":"11","hashOfConfig":"10"},{"size":629,"mtime":1692551512666,"results":"12","hashOfConfig":"10"},{"size":83,"mtime":1692549155942,"results":"13","hashOfConfig":"10"},{"size":292,"mtime":1692551746655,"results":"14","hashOfConfig":"10"},{"size":1535,"mtime":1692560463222,"results":"15","hashOfConfig":"16"},{"size":2390,"mtime":1692560338617,"results":"17","hashOfConfig":"16"},{"size":1003,"mtime":1692560187159,"results":"18","hashOfConfig":"16"},{"filePath":"19","messages":"20","suppressedMessages":"21","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1jrrb2y",{"filePath":"22","messages":"23","suppressedMessages":"24","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","suppressedMessages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","suppressedMessages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","suppressedMessages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"oqzilt",{"filePath":"37","messages":"38","suppressedMessages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","suppressedMessages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/lasseronningen/Sites/WorkflowCA/src/js/api/auth/login.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/src/js/api/auth/login.test.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/src/js/api/auth/logout.test.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/src/js/storage/index.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/src/js/storage/localStorageMock.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/cypress/e2e/createPost.cy.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/cypress/e2e/login.cy.js",[],[],"/Users/lasseronningen/Sites/WorkflowCA/cypress/e2e/logout.cy.js",[],[]] |
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.
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,4 +1,8 @@ | ||
/node_modules | ||
/dist/* | ||
.env | ||
#**/*.config.js | ||
|
||
/cypress/screenshots | ||
/cypress/support | ||
/cypress/videos | ||
/.eslintcache |
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,9 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
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,51 @@ | ||
describe("Login and validate user input", () => { | ||
beforeEach(() => { | ||
cy.clearLocalStorage(); | ||
cy.visit("http://127.0.0.1:5555/"); | ||
|
||
cy.wait(800); | ||
cy.get(".btn-close:visible").click({ force: true }); | ||
cy.get("button[data-auth='login']:visible").click({ force: true }); | ||
|
||
cy.wait(800); | ||
cy.get("input[type='email']:visible") | ||
.should("exist") | ||
.type("bobbyfrida@stud.noroff.no"); | ||
|
||
cy.get("input[type='password']:visible") | ||
.should("exist") | ||
.type("bobbyfrida@stud.noroff.no"); | ||
cy.get(".btn-success:visible").click({ force: true }); | ||
|
||
cy.wait(800); | ||
cy.then(() => expect(window.localStorage.getItem("token")).to.not.be.null); | ||
cy.then( | ||
() => expect(window.localStorage.getItem("profile")).to.not.be.null, | ||
); | ||
cy.url().should("include", "profile"); | ||
}); | ||
|
||
it("It validates post title input", () => { | ||
cy.get("footer [data-visible='loggedIn']:visible") | ||
.contains("New Post") | ||
.click(); | ||
|
||
cy.get("#postTitle:visible").should("exist"); | ||
|
||
cy.get("#postTitle:visible").type("New blog post title"); | ||
|
||
cy.get("#postTitle:visible").should("have.value", "New blog post title"); | ||
|
||
cy.get("#postTags:visible").should("exist").type("Bob is your uncle"); | ||
|
||
cy.get("#postMedia:visible") | ||
.should("exist") | ||
.type("https://picsum.photos/200/300"); | ||
|
||
cy.get("#postBody:visible").should("exist").type("m0000"); | ||
|
||
cy.get("span[data-action='publish']:visible").should("exist").click(); | ||
|
||
cy.url().should("include", "post"); | ||
}); | ||
}); |
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,77 @@ | ||
describe("Login to app", () => { | ||
beforeEach(() => { | ||
cy.visit("http://127.0.0.1:5555/"); | ||
cy.clearLocalStorage(); | ||
}); | ||
|
||
it("It can login successfully", () => { | ||
cy.visit("http://127.0.0.1:5555/"); | ||
|
||
cy.wait(800); | ||
cy.get(".btn-close:visible").click({ force: true }); | ||
cy.get("button[data-auth='login']:visible").click({ force: true }); | ||
|
||
cy.wait(2000); | ||
cy.get("input[type='email']:visible") | ||
.should("exist") | ||
.type("bobbyfrida@stud.noroff.no"); | ||
|
||
cy.get("input[type='password']:visible") | ||
.should("exist") | ||
.type("bobbyfrida@stud.noroff.no"); | ||
cy.get(".btn-success:visible").click({ force: true }); | ||
|
||
cy.wait(600); | ||
cy.then( | ||
() => expect(window.localStorage.getItem("profile")).to.not.be.null, | ||
); | ||
cy.then(() => expect(window.localStorage.getItem("token")).to.not.be.null); | ||
cy.url().should("include", "profile"); | ||
}); | ||
|
||
it("It tries to validates fake email input", () => { | ||
cy.visit("http://127.0.0.1:5555/"); | ||
|
||
cy.wait(800); | ||
cy.get(".btn-close:visible").click({ force: true }); | ||
cy.get("button[data-auth='login']:visible").click({ force: true }); | ||
|
||
cy.wait(2000); | ||
cy.get("input[type='email']:visible") | ||
.should("exist") | ||
.type("faketrude@fakeemail.com"); | ||
|
||
cy.get("input[type='password']:visible") | ||
.should("exist") | ||
.type("trudesfakepassword"); | ||
cy.get(".btn-success:visible").click({ force: true }); | ||
|
||
cy.wait(2000); | ||
cy.then(() => expect(window.localStorage.getItem("token")).to.be.null); | ||
cy.then(() => expect(window.localStorage.getItem("profile")).to.be.null); | ||
cy.url().should("not.include", "profile"); | ||
}); | ||
|
||
it("It validates password", () => { | ||
cy.visit("http://127.0.0.1:5555/"); | ||
|
||
cy.wait(800); | ||
cy.get(".btn-close:visible").click(); | ||
cy.get("button[data-auth='login']:visible").click({ force: true }); | ||
|
||
cy.wait(2000); | ||
cy.get("input[type='email']:visible") | ||
.should("exist") | ||
.type("bobbyfrida@stud.noroff.no"); | ||
|
||
cy.get("input[type='password']:visible") | ||
.should("exist") | ||
.type("bobbyfrida@stud.noroff.no"); | ||
cy.get(".btn-success:visible").click({ force: true }); | ||
|
||
cy.wait(2000); | ||
cy.then(() => expect(window.localStorage.getItem("token")).to.exist); | ||
cy.then(() => expect(window.localStorage.getItem("profile")).to.exist); | ||
cy.url().should("include", "profile"); | ||
}); | ||
}); |
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,38 @@ | ||
describe("Logout of App", () => { | ||
beforeEach(() => { | ||
cy.visit("http://127.0.0.1:5555/"); | ||
cy.clearLocalStorage(); | ||
}); | ||
|
||
it("It can logout the current user", () => { | ||
cy.get("#registerModalLabel") | ||
.should("have.text", "Create Profile") | ||
.should("be.visible"); | ||
|
||
cy.wait(800); | ||
cy.get("#registerForm") | ||
.find(".btn-outline-success") | ||
.should("be.visible") | ||
.click({ force: true }); | ||
cy.get("#loginModalLabel") | ||
.should("have.text", "Login") | ||
.should("be.visible"); | ||
|
||
cy.wait(800); | ||
cy.get("#loginEmail").type("bobbyfrida@stud.noroff.no"); | ||
cy.get("#loginPassword").type("bobbyfrida@stud.noroff.no"); | ||
|
||
cy.wait(800); | ||
cy.get("#loginForm .btn-success") | ||
.should("be.visible") | ||
.click({ force: true }); | ||
|
||
cy.wait(800); | ||
cy.get("button[data-auth='logout']") | ||
.should("be.visible") | ||
.click({ force: true }); | ||
cy.then(() => { | ||
expect(window.localStorage.getItem("token")).to.be.null; | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.