-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
1 changed file
with
31 additions
and
3 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,5 +1,33 @@ | ||
describe('template spec', () => { | ||
it('passes', () => { | ||
cy.visit('http://localhost:3000/sign'); | ||
//test1 : 로그인과정 테스트 | ||
|
||
describe('Signin Form Test', () => { | ||
// 로그인 api 검증 | ||
beforeEach(() => { | ||
cy.request({ | ||
method: 'POST', | ||
url: 'https://joo-api.store/login', | ||
body: { | ||
email: '[email protected]', | ||
password: 'qwer1234!' | ||
} | ||
}).then((resp) => { | ||
const token = resp.body.data.accessToken; | ||
if (typeof token === 'string' && token.length > 0) { | ||
cy.setCookie('token', token); | ||
} else { | ||
throw new Error('Token is not a valid string.'); | ||
} | ||
}); | ||
cy.visit('http://localhost:3000/signin'); | ||
}); | ||
|
||
// 로그인 및 리다이렉션 검증 | ||
it('successfully logs in', () => { | ||
cy.visit('http://localhost:3000/signin'); | ||
cy.get('input[id="email"]').type('[email protected]'); | ||
cy.get('input[id="password"]').type('qwer1234!'); | ||
cy.get('form').submit(); | ||
cy.url().should('include', '/'); | ||
cy.visit('http://localhost:3000/'); | ||
}); | ||
}); |