-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: e2e 테스트 수정 및 ci설정 (#408) * refactor: custom commands 추가 및 네이밍 수정 (#404) * chore: cypress open script 명령어 생성 (#404) * test: 테스트 코드 수정 (#404) * fix: 지도 랜드마크 마커 비활성화 (#404) * feat: e2e 테스트 workflow 작성 (#404) * bug: 데모데이간 나왔던 버그 수정 (#406) * refactor: 검색창에 검색어 입력 후 재입력할 때 전부 지워지도록 수정 (#403) * refactor: 상세 페이지 헤더에 searchBar가 나오지 않도록 수정 (#403) * refactor: 상세 페이지 헤더에 searchBar가 나오지 않도록 수정 (#403) * refactor: 좋아요 표시한 카머의 좋아요 마크 수정 (#403) * chore: defaultTimeout 설정 추가 * fix: yarn install 추가 * fix: workflow step 분리 * fix: workflow 환경변수 설정 * fix: defaultTimeOut 기본 값으로 설정 * fix: defaultTimeOut 10초로 설정 --------- Co-authored-by: Minjae Kim <[email protected]>
- Loading branch information
1 parent
4644f15
commit c1ec179
Showing
13 changed files
with
80 additions
and
96 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 🍔 E2E 테스트 🍔 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
name: E2E Test 딱 대라! | ||
env: | ||
working-directory: ./frontend | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🍔 yarn install | ||
run: yarn install | ||
working-directory: ${{ env.working-directory }} | ||
|
||
- name: 🍔 E2E 테스트 | ||
uses: cypress-io/github-action@v5 | ||
with: | ||
working-directory: ${{ env.working-directory }} | ||
start: yarn start | ||
browser: chrome | ||
env: | ||
BASE_URL: ${{secrets.DEV_BASE_URL}} |
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 was deleted.
Oops, something went wrong.
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,55 +1,33 @@ | ||
describe('음식점 리스트 상호작용 테스트', () => { | ||
it('현재 지도 바운더리 내의 음식점이 리스트에 생성된다.', () => { | ||
const restaurantNames = [ | ||
'바이킹스워프', | ||
'소피텔', | ||
'몽드샬롯', | ||
'대성연탄갈비', | ||
'미타우동', | ||
'형제상회 가락몰지점', | ||
'그랜드 워커힐 서울 더파빌리온', | ||
'산과바다', | ||
it('선택한 카테고리에 해당하는 음식점이 리스트에 그려지고, 음식점이 존재하지 않는 경우 "일치하는 음식점이 없어요."라는 문구를 가진 화면을 보여준다.', () => { | ||
const categories = [ | ||
'일식당', | ||
'한식', | ||
'와인', | ||
'초밥,롤', | ||
'생선회', | ||
'양식', | ||
'와인', | ||
'육류,고기요리', | ||
'이자카야', | ||
'돼지고기구이', | ||
'요리주점', | ||
]; | ||
|
||
cy.intercept( | ||
'GET', | ||
`${Cypress.env( | ||
'apiUrl', | ||
)}/api/restaurants?lowLatitude=37.4526109976426&highLatitude=37.57787843528734&lowLongitude=127.04205511118164&highLongitude=127.16393468881836`, | ||
{ fixture: 'restaurants' }, | ||
); | ||
cy.visit(Cypress.config().baseUrl); | ||
cy.shouldBeList(restaurantNames); | ||
}); | ||
|
||
it('선택한 카테고리에 해당하는 음식점이 리스트에 생성된다.', () => { | ||
const categoryToExpectedRestaurants = [ | ||
[ | ||
'일식당', | ||
['동양', '냠냠물고기 2호점', '스시이도 오코노미', '스시아오마츠', '텐지몽', '숙성회장', '스시한다', '스시렌'], | ||
], | ||
['한식', ['식도원', '맛좋은순대국', '고흥선어회맛집', '7th Door', '산과바다']], | ||
['와인', ['우오보 파스타 바']], | ||
]; | ||
|
||
cy.visit(Cypress.config().baseUrl); | ||
cy.wrap(categoryToExpectedRestaurants).each((item: [string, string[]]) => { | ||
cy.get(`[data-label='${item[0]}']`).click(); | ||
cy.shouldBeList(item[1]); | ||
}); | ||
}); | ||
|
||
it('검색창에 주소 입력시 해당 주소를 중심좌표로 리스트가 생성된다.', () => { | ||
const addressToExpectedRestaurants = [ | ||
['대구', ['오늘도한우']], | ||
['분당', ['종로영풍갈비', '스시야']], | ||
['경주', ['영양숯불갈비']], | ||
]; | ||
|
||
cy.wrap(addressToExpectedRestaurants).each((item: [string, string[]]) => { | ||
cy.visit(Cypress.config().baseUrl); | ||
cy.getBySel('지역 검색').type(item[0]).wait(1000).type('{enter}'); | ||
cy.shouldBeList(item[1]); | ||
cy.wrap(categories).each((category: string) => { | ||
cy.get(`[data-label='${category}']`).click(); | ||
cy.getByCy('음식점 리스트').then($restaurantList => { | ||
if ($restaurantList.find('[data-cy="음식점 카드"]').length) { | ||
cy.getByCy('음식점 카드') | ||
.should('exist') | ||
.each(restaurantCard => { | ||
expect(restaurantCard.text()).to.include(category); | ||
}); | ||
} else { | ||
cy.getByCy('음식점 리스트').should('contain.text', '일치하는 음식점이 없어요.'); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |
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,7 +1,8 @@ | ||
Cypress.Commands.add('getBySel', (selector, ...args) => cy.get(`[data-cy='${selector}']`, ...args)); | ||
Cypress.Commands.add('getByCy', (selector, ...args) => cy.get(`[data-cy='${selector}']`, ...args)); | ||
Cypress.Commands.add('getByAriaLabel', (selector, ...args) => cy.get(`[aria-label='${selector}']`, ...args)); | ||
|
||
Cypress.Commands.add('shouldBeList', restaurantNames => { | ||
restaurantNames.forEach(name => { | ||
cy.getBySel('음식점 리스트').find(`[data-cy="${name} 카드"]`).should('exist'); | ||
cy.getByAriaLabel('음식점 리스트').find(`[data-cy="${name} 카드"]`).should('exist'); | ||
}); | ||
}); |
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,7 @@ | ||
declare namespace Cypress { | ||
interface Chainable { | ||
getBySel(selector: string, ...args): Chainable; | ||
getByCy(selector: string, ...args): Chainable; | ||
getByAriaLabel(selector: string, ...args): Chainable; | ||
shouldBeList(restaurantNames: string[]): Chainable; | ||
} | ||
} |
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
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