Skip to content

Latest commit

 

History

History
123 lines (85 loc) · 2.2 KB

README.md

File metadata and controls

123 lines (85 loc) · 2.2 KB

wdio-demo

以 WebDriverIO 前端測試框架實際運行的範例

目錄

技術架構

前端測試框架

WebDriverIO

Styles

  • BDD Styles

斷言函式庫

測試碼設計樣式

Within your web app’s UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place.

簡單來說就是降低重複程式碼,當 UI 變動時,只需要修改一個地方

專案結構

.
├── ...
└── test
    ├── pageobjects
    └── specs

系統需求

  • node 8
  • npm 5 (or yarn 1)
  • docker 17
  • docker-compose 1.18.0
  • Chrome Browser (dev environment)
  • Firefox Browser (dev environment)
  • webdriver-manager (dev environment)

安裝

$ npm i

or

$ yarn

開發環境安裝

selenium server in local:

$ npm install webdriver-manager chimp -g
$ webdriver-manager update

測試

selenium server in local

$ webdriver-manager start
$ npm run dev-test

即時監聽 (需要加入 @watch 才會被監聽):

$ npm run watch-test

selenium server in drone

How to install the Drone CLI

$ npm run test-with-drone

報表 (需搭配 drone cli)

$ npm run test-with-drone
$ npm run gen-report
$ npm run open-report

參考資料