new w-puppeteer-uitest()
- Source:
Methods
(async, static) build(fd_html, fd_action, fd_out, optExpopt) → {Promise}
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fd_html |
String | 輸入html檔案所在資料夾字串 |
|||||||||||||||||||||||||||
fd_action |
String | function | 輸入html檔案所需測試動作json檔案所在資料夾字串,為函數時將於產生items時呼叫,針對各item需回傳操作actions物件陣列 |
|||||||||||||||||||||||||||
fd_out |
String | 輸入快照資料儲存之資料夾字串 |
|||||||||||||||||||||||||||
optExp |
Object |
<optional> |
{}
|
輸入設定物件,預設為{} Properties
|
Returns:
回傳Promise,resolve為建置成功,reject為建置失敗item名稱
- Type
- Promise
(async, static) compareB64(b64_a, b64_b) → {Promise}
- Description:
2張圖片base64比對
- Source:
Parameters:
Name | Type | Description |
---|---|---|
b64_a |
String | 輸入圖片a的base64格式字串 |
b64_b |
String | 輸入圖片b的base64格式字串 |
Returns:
回傳Promise,resolve為相似度0~1,reject為處理失敗
- Type
- Promise
(async, static) expBuild(items, optExpopt) → {Promise}
- Description:
建置測試範例之正確版快照(screenshot)
- Source:
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
items |
Array | 輸入html範例所在之資料夾字串 |
||||||||||||||||||||||
item.name |
String | 輸入item名稱字串 |
||||||||||||||||||||||
item.url |
String | 輸入item所需瀏覽範例位置字串 |
||||||||||||||||||||||
item.actions |
Array | 輸入item所需執行自動化操作動作陣列 |
||||||||||||||||||||||
item.fn_png |
String | 輸入item儲存png圖之路徑字串 |
||||||||||||||||||||||
item.fn_base64 |
String | 輸入item儲存圖base64資料之路徑字串 |
||||||||||||||||||||||
optExp |
Object |
<optional> |
{}
|
輸入設定物件,預設為{} Properties
|
Returns:
回傳Promise,resolve為建置成功,reject為建置失敗item名稱
- Type
- Promise
(async, static) expTest(items, optExpopt) → {Promise}
- Description:
測試範例之快照(screenshot)是否與正確版相同
- Source:
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
items |
Array | 輸入html範例所在之資料夾字串 |
|||||||||||||||||||||||||||
item.name |
String | 輸入item名稱字串 |
|||||||||||||||||||||||||||
item.url |
String | 輸入item所需瀏覽範例位置字串 |
|||||||||||||||||||||||||||
item.actions |
Array | 輸入item所需執行自動化操作動作陣列 |
|||||||||||||||||||||||||||
item.fn_base64 |
String | 輸入item儲存圖base64資料之路徑字串 |
|||||||||||||||||||||||||||
optExp |
Object |
<optional> |
{}
|
輸入設定物件,預設為{} Properties
|
Returns:
回傳Promise,resolve為建置成功,reject為建置失敗item名稱
- Type
- Promise
(async, static) getB64(url, optopt) → {String}
- Description:
瀏覽網址並用screenshot取得圖片base64資料
- Source:
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String | 輸入瀏覽網址,可為本機檔案絕對或相對位置 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opt |
Object |
<optional> |
{}
|
輸入設定檔,預設為{} Properties
|
Returns:
回傳screenshot圖片轉base64資料
- Type
- String
(async, static) getFiles(fd) → {Array}
- Description:
取得資料夾內檔案,可使用havsStr過濾檔名含有之字串
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fd |
String |
Returns:
回傳檔案名稱字串陣列
- Type
- Array
(static) readJson(fn) → {*}
- Description:
讀取json檔數據
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fn |
String | 輸入json檔案路徑字串 |
Returns:
回傳數據
- Type
- *
(async, static) test(fd_html, fd_action, fd_base64, optExpopt) → {Promise}
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fd_html |
String | 輸入html檔案所在資料夾字串 |
||||||||||||||||||||||||||||||||
fd_action |
String | function | 輸入html檔案所需測試動作json檔案所在資料夾字串,為函數時將於產生items時呼叫,針對各item需回傳操作actions物件陣列 |
||||||||||||||||||||||||||||||||
fd_base64 |
String | 輸入快照資料儲存之資料夾字串 |
||||||||||||||||||||||||||||||||
optExp |
Object |
<optional> |
{}
|
輸入設定物件,預設為{} Properties
|
Returns:
回傳Promise,resolve為建置成功,reject為建置失敗item名稱
- Type
- Promise