Skip to content

Commit

Permalink
test: 짝수 아이템은 다른 짝수 아이템 앞으로 이동 금지 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
suMin-97 committed Aug 5, 2024
1 parent 0c3a5fc commit 77ffe02
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions cypress/e2e/dnd.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,99 @@ describe('DnD 구현 과제 요구사항 테스트', () => {
cy.get('#Column-1').should('contain', 'item 2');
cy.get('#Column-1').should('contain', 'item 6');
});

it('같은 Column 내에서 짝수 위치 아이템을 짝수 위치 아이템 앞 이동 금지', () => {
cy.get('#item-1')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-0').next().should('contain', 'item 1');
});

it('다른 Column으로 이동 시 짝수 위치 아이템을 짝수 위치 아이템 앞 이동 금지', () => {
cy.get('#item-0')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-1')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-2')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-3')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-5')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#Column-2').should('not.contain', 'item 5');
cy.get('#Column-1').should('contain', 'item 5');
});

it('짝수 위치 아이템을 짝수 위치의 마지막 요소로 이동 가능', () => {
cy.get('#item-0')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-1')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-2')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#item-4')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#Column-1').should('not.contain', 'item 4');
cy.get('#Column-2').should('contain', 'item 4');
});

it('짝수 위치 아이템을 Drag해서 원래 위치로 Drop 가능', () => {
cy.get('#item-1')
.trigger('keydown', { keyCode: keyCodes.space })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowRight, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowLeft, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowLeft, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowLeft, force: true })
.trigger('keydown', { keyCode: keyCodes.arrowDown, force: true })
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

cy.get('#Column-1').should('contain', 'item 1');
});
});

0 comments on commit 77ffe02

Please sign in to comment.