用Docker跑Cypress
執行這些步驟之前,你必須要先有cypress的測試目錄喔。 或是可以從這裡抓我做的專案
安裝 (for Windows)
- 點兩下安裝
- 安裝完畢後會自動執行,或是請你重新啟動電腦
- 安裝docker成功!
抓cypress/included的映像檔(image)
cypress/included 我是抓6.1.0這個版本
$ docker pull cypress/included:6.1.0
在你的測試目錄裡執行測試
# 這是linux指令
$ docker run -it -v $PWD:/e2e -w /e2e cypress/included:6.1.0
# 這是windows power shell指令
$ docker run -it -v ${PWD}:/e2e -w /e2e cypress/included:6.1.0
# 這是windows commader指令
$ docker run -it -v %cd%:/e2e -w /e2e cypress/included:6.1.0
最後,在你的cypress資料夾裡面會有screenshot跟video的目錄,可以看到紀錄!
參考: Install Docker Desktop on Windows Run Cypress with a single Docker command Cypress Docker Images