diff --git a/.github/workflows/fe-pull-request.yml b/.github/workflows/fe-pull-request.yml index 25e16481..69d681f0 100644 --- a/.github/workflows/fe-pull-request.yml +++ b/.github/workflows/fe-pull-request.yml @@ -1,13 +1,15 @@ name: Frontend CI For Test Validation -# 어떤 이벤트가 발생하면 실행할지 결정 + on: - #pull request open과 reopen 시 실행한다. + # pull request open과 reopen 시 실행한다. pull_request: branches: [main, develop] paths: frontend/** + defaults: run: working-directory: ./frontend + jobs: jest: runs-on: ubuntu-22.04 @@ -19,10 +21,18 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v2 with: - node-version: "18" + node-version: '18' - name: Install node modules run: npm install - name: Run Jest test run: npm run test + + - name: Start npm + run: npm run dev + + - name: Run Cypress + uses: cypress-io/github-action@v5 + with: + start: npm run cypress diff --git a/frontend/cypress/e2e/mapbefine.cy.ts b/frontend/cypress/e2e/mapbefine.cy.ts index cb5a7452..f24052ad 100644 --- a/frontend/cypress/e2e/mapbefine.cy.ts +++ b/frontend/cypress/e2e/mapbefine.cy.ts @@ -69,12 +69,30 @@ describe('토픽 상세 페이지', () => { if (index === 0) $el.click(); }); - cy.get('li') + cy.wait(1000); + + cy.get('span').each(($el, index) => { + if (index === 6) $el.click(); + }); + + cy.contains('내 지도에 저장하기').should('be.visible'); + }); + + it('핀 상세 페이지에서 내 지도에 저장하기 버튼 누르면 토스트 메시지가 나온다.', () => { + cy.get('[data-cy="topic-card"]') .children() .each(($el, index) => { if (index === 0) $el.click(); }); - cy.contains('내 지도에 저장하기').should('be.visible'); + cy.wait(1000); + + cy.get('span').each(($el, index) => { + if (index === 6) $el.click(); + }); + + cy.contains('내 지도에 저장하기').click(); + + cy.contains('로그인 후 사용해주세요.').should('be.visible'); }); });