-
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 #130 from turingschool/bug/persist-context-on-refresh
Bug/persist context on refresh
- Loading branch information
Showing
6 changed files
with
105 additions
and
68 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 |
---|---|---|
|
@@ -681,14 +681,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"); | ||
|
@@ -731,13 +723,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"); | ||
}) | ||
}); |
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