-
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 branch 'main' of github.com:turingschool/tracker-crm-fe into st…
…yling/applications-index Updating branch with most current main.
- Loading branch information
Showing
15 changed files
with
237 additions
and
95 deletions.
There are no files selected for viewing
Binary file not shown.
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,5 +1,4 @@ | ||
import {mockCompanies} from "../fixtures/mockCompanies"; | ||
describe('Dash Board after loggging in', () => { | ||
describe('Dash Board after loggging in with recent jobs, contacts and companies', () => { | ||
beforeEach(()=>{ | ||
cy.intercept("POST", "http://localhost:3001/api/v1/sessions", { | ||
statusCode: 200, | ||
|
@@ -32,15 +31,15 @@ describe('Dash Board after loggging in', () => { | |
}) | ||
|
||
it("Should have a header with the users name once data is loaded", () => { | ||
cy.get("h1").should("have.text", "Welcome,Danny DeVito"); | ||
cy.get("h1").should("have.text", "Welcome, Danny DeVito"); | ||
}); | ||
|
||
it("Should show how many job applications where submitted in the week", () => { | ||
it("Should show how many job applications were submitted in the week", () => { | ||
cy.get('.ml-2 > :nth-child(1)').should("exist") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(1)').should("exist") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(1)').should("have.text","Jobs") | ||
cy.get('[data-cy="dashJobNum"]').should("exist") | ||
cy.get('[data-cy="dashJobNum"]').should("have.text",2) | ||
cy.get('[data-cy="dashNum"]').should("exist") | ||
cy.get('[data-cy="dashNum"]').should("have.text",222) | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(3)').should("exist") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(3)').should("have.text","Apps submitted this week") | ||
}); | ||
|
@@ -49,26 +48,97 @@ describe('Dash Board after loggging in', () => { | |
cy.get('.m-24').should("exist") | ||
cy.get('.m-24 > .mt-2').should("exist") | ||
cy.get('.m-24 > .mt-2').should("have.text","Contacts") | ||
cy.get('[data-cy="dashConNum"]').should("exist") | ||
cy.get('[data-cy="dashConNum"]').should("have.text",2) | ||
cy.get('[data-cy="conLabel"]').should("exist") | ||
cy.get('[data-cy="conLabel"]').should("have.text","New connections this week") | ||
cy.get('[data-cy="dashNum"]').should("exist") | ||
cy.get('[data-cy="dashNum"]').should("have.text",222) | ||
cy.get('.ml-2 > :nth-child(2) > :nth-child(3)').should("exist") | ||
cy.get('.ml-2 > :nth-child(2) > :nth-child(3)').should("have.text","New connections this week") | ||
}); | ||
|
||
it("Should show how many companies where submitted in the week", () => { | ||
cy.get('.ml-2 > :nth-child(3)').should("exist") | ||
cy.get(':nth-child(3) > .mt-2').should("exist") | ||
cy.get(':nth-child(3) > .mt-2').should("have.text","Companies") | ||
cy.get('[data-cy="dashCompNum"]').should("exist") | ||
cy.get('[data-cy="dashCompNum"]').should("have.text",2) | ||
cy.get(':nth-child(3) > .bg-cyan-600').should("exist") | ||
cy.get(':nth-child(3) > .bg-cyan-600').should("have.text","Add new company") | ||
cy.get('[data-cy="dashNum"]').should("exist") | ||
cy.get('[data-cy="dashNum"]').should("have.text",222) | ||
cy.get('.ml-2 > :nth-child(3) > :nth-child(3)').should("exist") | ||
cy.get('.ml-2 > :nth-child(3) > :nth-child(3)').should("have.text","New companies this week") | ||
}); | ||
}) | ||
|
||
describe('Dash Board after loggging in with zero recent jobs, contacts and companies', () => { | ||
beforeEach(()=>{ | ||
cy.intercept("POST", "http://localhost:3001/api/v1/sessions", { | ||
statusCode: 200, | ||
body: { | ||
token: 'fake-token', | ||
user: { | ||
data: { | ||
id: 1, | ||
type: 'user', | ||
attributes: { | ||
name: 'Danny DeVito', | ||
email: '[email protected]', | ||
companies: [] | ||
} | ||
} | ||
} | ||
} | ||
}).as("mockSession2"); | ||
|
||
cy.intercept( | ||
'GET', | ||
'http://localhost:3001/api/v1/users/1/dashboard', | ||
{ statusCode: 200, fixture: 'mockDashBoardNoJobsContactsOrCompanies' } | ||
); | ||
|
||
cy.visit("http://localhost:3000/"); | ||
cy.get("#email").type("[email protected]") | ||
cy.get("#password").type("jerseyMikesRox7") | ||
cy.get('[data-testid="login-button"]').click(); | ||
}) | ||
|
||
it("Should show how many job applications were submitted in the week", () => { | ||
cy.get('.ml-2 > :nth-child(1)').should("exist") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(1)').should("exist") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(1)').should("have.text","Jobs") | ||
cy.get('[data-cy="dashNum"]').should("exist") | ||
cy.get('[data-cy="dashNum"]').should("have.text","000") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(3)').should("exist") | ||
cy.get('.ml-2 > :nth-child(1) > :nth-child(3)').should("have.text","Add new job application") | ||
}); | ||
|
||
it("Should show how many connections were submitted in the week", () => { | ||
cy.get('.m-24').should("exist") | ||
cy.get('.m-24 > .mt-2').should("exist") | ||
cy.get('.m-24 > .mt-2').should("have.text","Contacts") | ||
cy.get('[data-cy="dashNum"]').should("exist") | ||
cy.get('[data-cy="dashNum"]').should("have.text","000") | ||
cy.get('.ml-2 > :nth-child(2) > :nth-child(3)').should("exist") | ||
cy.get('.ml-2 > :nth-child(2) > :nth-child(3)').should("have.text","Add new contact") | ||
}); | ||
|
||
it("Should show how many companies were submitted in the week", () => { | ||
cy.get('.ml-2 > :nth-child(3)').should("exist") | ||
cy.get(':nth-child(3) > .mt-2').should("exist") | ||
cy.get(':nth-child(3) > .mt-2').should("have.text","Companies") | ||
cy.get('[data-cy="dashNum"]').should("exist") | ||
cy.get('[data-cy="dashNum"]').should("have.text","000") | ||
cy.get('.ml-2 > :nth-child(3) > :nth-child(3)').should("exist") | ||
cy.get('.ml-2 > :nth-child(3) > :nth-child(3)').should("have.text","Add new company") | ||
}); | ||
|
||
it("Should have a clickable button to route you to add a new job application", () => { | ||
cy.get(':nth-child(1) > .bg-cyan-600').click(); | ||
cy.url().should('include', 'http://localhost:3000/jobapplications/new'); | ||
}); | ||
|
||
it("Should have a clickable button to route you to add a new contact", () => { | ||
cy.get(':nth-child(2) > .bg-cyan-600').click(); | ||
cy.url().should('include', 'http://localhost:3000/contacts/new'); | ||
}); | ||
|
||
it("Should have a clickable button to route you to add a new company", () => { | ||
cy.get(':nth-child(3) > .bg-cyan-600').click(); | ||
cy.url().should('include', 'http://localhost:3000/companies/new'); | ||
}); | ||
|
||
|
||
}) |
File renamed without changes.
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 |
---|---|---|
|
@@ -679,14 +679,6 @@ describe("Editability of specific job application fields", () => { | |
"Talked with recruiter, sounds like a great opportunity to learn new things" | ||
); | ||
cy.get('[data-testid="edit-modal-form-submit-button"]').click(); | ||
|
||
cy.reload(); | ||
cy.get("#email").type("[email protected]"); | ||
cy.get("#password").type("jerseyMikesRox7"); | ||
cy.get('[data-testid="login-button"]').click(); | ||
cy.get('[data-testid="applications-iconD"]').click(); | ||
cy.get("tbody > tr").contains("Creative").click(); | ||
|
||
cy.wait("@updateJobApp"); | ||
|
||
cy.get('[data-testid="job-Title"]').should("contain", "Frontend Developer"); | ||
|
@@ -729,13 +721,6 @@ describe("Editability of specific job application fields", () => { | |
cy.get('[data-testid="edit-modal-form-submit-button"]').click(); | ||
cy.wait("@showSingleJobAppEmptyFields"); | ||
|
||
cy.reload(); | ||
cy.get("#email").type("[email protected]"); | ||
cy.get("#password").type("jerseyMikesRox7"); | ||
cy.get('[data-testid="login-button"]').click(); | ||
cy.get('[data-testid="applications-iconD"]').click(); | ||
cy.get("tbody > tr").contains("Creative").click(); | ||
|
||
cy.wait("@getJobApplications"); | ||
cy.wait("@showSingleJobApp"); | ||
|
||
|
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 |
---|---|---|
|
@@ -66,4 +66,38 @@ describe('testing for Login page', () => { | |
.get('.login-form-wrap > .form-inputs > .failed-login').should('be.visible') | ||
.get('.login-form-wrap > .form-inputs > .failed-login').should('contain', 'Error in Login: Invalid login credentials') | ||
}); | ||
|
||
it('persists login after a refresh', () => { | ||
cy.intercept("POST", "http://localhost:3001/api/v1/sessions", { | ||
statusCode: 200, | ||
body: { | ||
token: 'fake-token', | ||
user: { | ||
data: { | ||
id: 1, | ||
type: 'user', | ||
attributes: { | ||
name: 'Danny DeVito', | ||
email: '[email protected]', | ||
companies: [] | ||
} | ||
} | ||
} | ||
} | ||
}).as("mockSession"); | ||
|
||
cy.intercept( | ||
'GET', | ||
'http://localhost:3001/api/v1/users/1/dashboard', | ||
{ statusCode: 200, fixture: 'mockDashBoard' } | ||
); | ||
|
||
cy.visit("http://localhost:3000/"); | ||
cy.get("#email").type("[email protected]") | ||
cy.get("#password").type("jerseyMikesRox7") | ||
cy.get('[data-testid="login-button"]').click(); | ||
cy.get("h1").should("have.text", "Welcome,Danny DeVito"); | ||
cy.reload(); | ||
cy.get("h1").should("have.text", "Welcome,Danny DeVito"); | ||
}) | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
cypress/fixtures/mockDashBoardNoJobsContactsOrCompanies.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"data": { | ||
"id": "1", | ||
"type": "dashboard", | ||
"attributes": { | ||
"id": 1, | ||
"name": "Danny DeVito", | ||
"email": "[email protected]", | ||
"dashboard": { | ||
"weekly_summary": { | ||
"job_applications": [ | ||
], | ||
"contacts": [ | ||
], | ||
"companies": [ | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.