# web-function-test

![Chinese](README_CN.md)
 
web-automation-testing tool run on Chromium, by using this tool , user only need to define business process and test data, no coding required.but XPATH is required.

##  申明
it wat developed based on [puppeteer](https://github.com/GoogleChrome/puppeteer)

## 前提
[Node.JS](https://nodejs.org/en/download/) enviroment is required

## quick start

install
```
npm install -g @cic-digital/web-function-test --unsafe-perm=true
```

optional install
```
npm install -g fx
```

open terminal , go to an empty folder , init it
```
wft init
```

init example
```
wft example
```
wft example command can not be used twice please empty your folder before you use it again.


```
wft run -p $(fx executeCaseList.json '.plan[0].id')
```
after run command，find your snapshot and report in ./output

please be noted , firefox is still still in experimental

## quick start using docker

[docker](https://www.docker.com/) enviroment is required

go to an empty folder and init it.

```
docker run -it --rm -v $(pwd):/usr/src k19810703/webfunctiontest bash /usr/local/bin/init.sh
```

run example
```
docker run -it --rm -v $(pwd):/usr/src k19810703/webfunctiontest wft run -p $(fx executeCaseList.json '.plan[0].id')
```

launch ui
```
docker run -it --rm -v $(pwd):/usr/src -p 3000:3000 k19810703/webfunctiontest wft ui
```

## SampleCase
参考 ./case.json ./component.json ./param.json
1.  基本操作sample(input, click, dropdown, radio)
2.  Frame操作sample(带有多个frame的操作)
3.  table验证sample(验证table内容和csv是否一致，csv参考./files/test.csv)
4.  文件上传sample(上传./files/test.csv)
5.  鼠标移动到页面元素sample
6.  拖动页面元素sample
7.  切换窗口sample

## what happened(WIP)

##  Basic Concept
![avatar](basicconcept.png)

## how to use it(WIP)
we will provide web user interface for edit all json file later.
```
wft ui
```
