Continuous Integration with Cypress

코드위의승부사·2020년 8월 24일
0

$cypress open

  • Runs one or all specs
  • File watcher
  • Dom snapshots and time-traveling debugger

$cypress run

  • Runs single spec at a time
  • No file watchign
  • No Dom snapshots
  • automatic screenshot on failure
  • automatic video

CI should test every commit

# work locally
git add.
git commit -m 'feature A + tests'
git push
# CI runs all tests on each commit
cypress run

CI without test is like never changing the oil in your car. It is just a matter of time before it blows up.

having actual human users find the bugs it's the most expensive things.

Team Responsibillity

  • merge frequently
  • master branch is always deployable
  • only commit working and tested code
  • only merge when build is passing
  • Don't leave right after merging until builds passes

npx cypress verify
'cypress run' calls 'verify' when it runs for the very first time on the machine.

checkout

  • restore_cache:
    keys: -cache-{{checksum "package.json"}}
  • run: npm ci
  • run: npx cypress verify
  • save_cache:
    key:cache-{{checksum "package.json"}}
    paths:
    • ~/.npm
    • ~/.cache

Parallel Runs
npm install
cypress run --record --parallel
load balancing spec files
Cypress Dashboard

CI process
1. Build Code in production Mode
2. Start Web server
3. Wait for Web Server to Responde
4. Run Cypress Tests
5. Stop Web Server

npx start-server-and-test ci:start-server 3000 cy:run

Travis / TeamCity / CircleCI

profile
함께 성장하는 개발자가 되고 싶습니다.

0개의 댓글