-
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.
- Loading branch information
1 parent
8d6495d
commit 24d8632
Showing
8 changed files
with
73 additions
and
31 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 |
---|---|---|
@@ -1,8 +1,32 @@ | ||
/** What authentication rules should the webapp have? */ | ||
/** | ||
* Login | ||
* Should sign user in, then route to /home | ||
* Failed login should present the reason and give user another chance (unlimited) | ||
*/ | ||
|
||
// Question :: is it possible to get a list of test descriptions to document what this feature does | ||
|
||
describe('Login', () => { | ||
const homePage = '/home'; | ||
const loginPage = '/auth/login'; | ||
const loginUrl = 'http://localhost:8010/auth/login'; | ||
|
||
// Question :: is it possible to get a list of test descriptions to document what this feature does | ||
|
||
beforeEach(() => { | ||
cy.intercept('POST', loginUrl, { fixture: 'auth/unsigned-token-with-max-expiry' }); | ||
|
||
cy.visit(loginPage); | ||
}); | ||
|
||
it('should sign user in when valid credentials are used', () => { | ||
/** When: */ | ||
cy.get('#username').type('[email protected]'); | ||
cy.get('#password').type('password'); | ||
cy.get('#login-btn').click(); | ||
|
||
/** Then: user is routed to home page */ | ||
cy.location('pathname').should('eq', homePage); | ||
|
||
}); | ||
|
||
it('should reject login when invalid credentials are used', () => { | ||
// TODO | ||
|
||
/** Then: user is presented with failure reason and given another change to login */ | ||
}); | ||
|
||
}); |
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,3 @@ | ||
{ | ||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjk5OTk5OTk5OTk5OX0.RAXPOm19cHn5mG7fSyo1K6wamKUX8XXzKsLKpz_Lb3I" | ||
} |
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
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 |
---|---|---|
|
@@ -21,8 +21,14 @@ export class LoginComponent { | |
constructor(private router: Router, private auth: AuthenticationService) { } | ||
|
||
login() { | ||
this.auth.login().then(); // TODO | ||
this.router.navigate(['/home']); | ||
const credentials = { | ||
email: '[email protected]', | ||
password: 'test' | ||
} | ||
|
||
this.auth.login(credentials).then( | ||
() => console.log('User has been logged in...') // TODO :: log.TRACE | ||
); | ||
} | ||
|
||
} |