Skip to content

Commit

Permalink
feat: add test cases
Browse files Browse the repository at this point in the history
- check modal
- check reset
  • Loading branch information
goni-ssi committed Feb 26, 2021
1 parent 189f2c7 commit fec9c70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
- [x] 적절한 당첨 번호를 입력 받는다.
- [x] 중복된 숫자를 입력받지 않는다.
- [x] 1 ~ 45의 숫자를 입력 받는다.
- [ ] 결과 확인하기 버튼을 누르면 모달을 확인할 수 있다.
- [x] 결과 확인하기 버튼을 누르면 모달을 확인할 수 있다.
- [ ] 당첨 통계가 정확한지 확인한다. (TDD)
- [ ] 다시 시작하기 버튼을 누르면 초기화 된다.
- [x] 다시 시작하기 버튼을 누르면 초기화 된다.
12 changes: 10 additions & 2 deletions cypress/integration/lotto.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testInputValue, checkAlert } from '../utils/index.js';
import { testInputValue } from '../utils/index.js';
import {
MSG_INVALID_PURCHASE_AMOUNT,
MSG_OVERLAPPED_LOTTO_NUMBERS,
Expand Down Expand Up @@ -58,8 +58,9 @@ describe('Lotto test', () => {
testWinnigNumbers(['1', '2', '3', '', '5', '6', '45'], MSG_BLANK_INPUT);
});

it('적절한 당첨 번호를 입력 받는다.', () => {
it('적절한 당첨 번호를 입력 받아 결과를 모달창으로 띄운다.', () => {
testWinnigNumbers(['1', '2', '3', '4', '5', '6', '45']);
cy.get('#modal').should('be.visible');
});

function testWinnigNumbers(numbers, alertMessage = '') {
Expand All @@ -68,4 +69,11 @@ describe('Lotto test', () => {
});
testInputValue('#result-submit', alertMessage);
}

it('다시 시작하기 버튼을 누르면 초기화 된다.', () => {
cy.get('#reset-button').click();
typeInputValue('#purchase-amount-input', '5000');
testInputValue('#purchase-amount-submit');
testWinnigNumbers(['1', '2', '3', '4', '5', '6', '45']);
});
});

0 comments on commit fec9c70

Please sign in to comment.