-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
45 additions
and
6 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,6 +1,15 @@ | ||
/// <reference types="cypress" /> | ||
describe('page', () => { | ||
it('works', () => { | ||
cy.visit('https://example.cypress.io') | ||
}) | ||
}) | ||
import LoginPage from '../pages/pageObject.cy.js'; | ||
|
||
describe('Login Flow', () => { | ||
it('should log in successfully', () => { | ||
const loginPage = new LoginPage(); | ||
const email = "[email protected]"; | ||
const password = "password"; | ||
|
||
loginPage.visitSignInPage(); | ||
loginPage.fillEmail(email); | ||
loginPage.fillPassword(password); | ||
loginPage.clickLoginButton(); | ||
loginPage.isSignedIn(); | ||
}); | ||
}); |
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,30 @@ | ||
const emailInput = 'input[name="email"]'; | ||
const passwordInput = 'input[type="password"]'; | ||
const loginButton = '._flexButton_2u3cq_1._blue_2u3cq_42._outline_2u3cq_20'; | ||
|
||
class LoginPage { | ||
visitSignInPage() { | ||
const signInPageUrl = 'http://app.yourdocket.com/signin'; | ||
cy.visit(signInPageUrl); | ||
cy.url().should('include', '/signin'); | ||
} | ||
|
||
fillEmail(email) { | ||
cy.get(emailInput).type(email); | ||
} | ||
|
||
fillPassword(password) { | ||
cy.get(passwordInput).type(password); | ||
} | ||
|
||
clickLoginButton() { | ||
cy.get(loginButton).first().click(); | ||
} | ||
|
||
isSignedIn() { | ||
cy.url().should('include', '/today'); | ||
} | ||
} | ||
|
||
export default LoginPage; | ||
|