w-puppeteer-uitest
Version:
A uitest package for web developer.
3,391 lines (1,011 loc) • 59.6 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>w-puppeteer-uitest - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="w-puppeteer-uitest.html">w-puppeteer-uitest</a><ul class='methods'><li data-type='method'><a href="w-puppeteer-uitest.html#.build">build</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.compareB64">compareB64</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.expBuild">expBuild</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.expTest">expTest</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.getB64">getB64</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.getFiles">getFiles</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.readJson">readJson</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.test">test</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">w-puppeteer-uitest</h1>
<section>
<header>
<h2>
w-puppeteer-uitest
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="w-puppeteer-uitest"><span class="type-signature"></span>new w-puppeteer-uitest<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="-_class.mjs.html">_class.mjs</a>, <a href="-_class.mjs.html#line1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".build"><span class="type-signature type-signature-async, static">(async, static) </span>build<span class="signature">(fd_html, fd_action, fd_out, optExp<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>批次建置測試範例之正確版快照(screenshot)</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="exp.mjs.html">exp.mjs</a>, <a href="exp.mjs.html#line24">line 24</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fd_html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入html檔案所在資料夾字串</p></td>
</tr>
<tr>
<td class="name"><code>fd_action</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入html檔案所需測試動作json檔案所在資料夾字串,為函數時將於產生items時呼叫,針對各item需回傳操作actions物件陣列</p></td>
</tr>
<tr>
<td class="name"><code>fd_out</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入快照資料儲存之資料夾字串</p></td>
</tr>
<tr>
<td class="name"><code>optExp</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{}</code>
</td>
<td class="description last"><p>輸入設定物件,預設為{}</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>htmlFilter</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>null</code>
</td>
<td class="description last"><p>輸入讀取html檔案過濾函數,可再用以過濾讀取fd_html內html檔案,預設為null</p></td>
</tr>
<tr>
<td class="name"><code>headless</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>true</code>
</td>
<td class="description last"><p>輸入是否以無頭方式開啟網頁,預設為true</p></td>
</tr>
<tr>
<td class="name"><code>viewport</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{ width: 800, height: 600 }</code>
</td>
<td class="description last"><p>輸入網頁開啟後之viewport,預設為{ width: 800, height: 600 }</p></td>
</tr>
<tr>
<td class="name"><code>num_web</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>10</code>
</td>
<td class="description last"><p>輸入平行啟動瀏覽器之數量,預設為10</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳Promise,resolve為建置成功,reject為建置失敗item名稱</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id=".compareB64"><span class="type-signature type-signature-async, static">(async, static) </span>compareB64<span class="signature">(b64_a, b64_b)</span><span class="type-signature"> → {Promise}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>2張圖片base64比對</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="compareB64.mjs.html">compareB64.mjs</a>, <a href="compareB64.mjs.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>b64_a</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>輸入圖片a的base64格式字串</p></td>
</tr>
<tr>
<td class="name"><code>b64_b</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>輸入圖片b的base64格式字串</p></td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳Promise,resolve為相似度0~1,reject為處理失敗</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id=".expBuild"><span class="type-signature type-signature-async, static">(async, static) </span>expBuild<span class="signature">(items, optExp<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>建置測試範例之正確版快照(screenshot)</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="expBuild.mjs.html">expBuild.mjs</a>, <a href="expBuild.mjs.html#line25">line 25</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>items</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入html範例所在之資料夾字串</p></td>
</tr>
<tr>
<td class="name"><code>item.name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item名稱字串</p></td>
</tr>
<tr>
<td class="name"><code>item.url</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item所需瀏覽範例位置字串</p></td>
</tr>
<tr>
<td class="name"><code>item.actions</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item所需執行自動化操作動作陣列</p></td>
</tr>
<tr>
<td class="name"><code>item.fn_png</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item儲存png圖之路徑字串</p></td>
</tr>
<tr>
<td class="name"><code>item.fn_base64</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item儲存圖base64資料之路徑字串</p></td>
</tr>
<tr>
<td class="name"><code>optExp</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{}</code>
</td>
<td class="description last"><p>輸入設定物件,預設為{}</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>headless</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>true</code>
</td>
<td class="description last"><p>輸入是否以無頭方式開啟網頁,預設為true</p></td>
</tr>
<tr>
<td class="name"><code>viewport</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{ width: 800, height: 600 }</code>
</td>
<td class="description last"><p>輸入網頁開啟後之viewport,預設為{ width: 800, height: 600 }</p></td>
</tr>
<tr>
<td class="name"><code>num_web</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>10</code>
</td>
<td class="description last"><p>輸入平行啟動瀏覽器之數量,預設為10</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳Promise,resolve為建置成功,reject為建置失敗item名稱</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id=".expTest"><span class="type-signature type-signature-async, static">(async, static) </span>expTest<span class="signature">(items, optExp<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>測試範例之快照(screenshot)是否與正確版相同</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="expTest.mjs.html">expTest.mjs</a>, <a href="expTest.mjs.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>items</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入html範例所在之資料夾字串</p></td>
</tr>
<tr>
<td class="name"><code>item.name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item名稱字串</p></td>
</tr>
<tr>
<td class="name"><code>item.url</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item所需瀏覽範例位置字串</p></td>
</tr>
<tr>
<td class="name"><code>item.actions</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item所需執行自動化操作動作陣列</p></td>
</tr>
<tr>
<td class="name"><code>item.fn_base64</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入item儲存圖base64資料之路徑字串</p></td>
</tr>
<tr>
<td class="name"><code>optExp</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{}</code>
</td>
<td class="description last"><p>輸入設定物件,預設為{}</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>headless</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>true</code>
</td>
<td class="description last"><p>輸入是否以無頭方式開啟網頁,預設為true</p></td>
</tr>
<tr>
<td class="name"><code>viewport</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{ width: 800, height: 600 }</code>
</td>
<td class="description last"><p>輸入網頁開啟後之viewport,預設為{ width: 800, height: 600 }</p></td>
</tr>
<tr>
<td class="name"><code>num_web</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>10</code>
</td>
<td class="description last"><p>輸入平行啟動瀏覽器之數量,預設為10</p></td>
</tr>
<tr>
<td class="name"><code>ratio_similar</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>1</code>
</td>
<td class="description last"><p>輸入偵測圖片相近度,預設為1,也就是完全相似</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳Promise,resolve為建置成功,reject為建置失敗item名稱</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id=".getB64"><span class="type-signature type-signature-async, static">(async, static) </span>getB64<span class="signature">(url, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {String}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>瀏覽網址並用screenshot取得圖片base64資料</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="getB64.mjs.html">getB64.mjs</a>, <a href="getB64.mjs.html#line42">line 42</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入瀏覽網址,可為本機檔案絕對或相對位置</p></td>
</tr>
<tr>
<td class="name"><code>opt</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{}</code>
</td>
<td class="description last"><p>輸入設定檔,預設為{}</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>headless</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>true</code>
</td>
<td class="description last"><p>輸入是否以無頭方式開啟網頁,預設為true</p></td>
</tr>
<tr>
<td class="name"><code>viewport</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>{ width: 800, height: 600 }</code>
</td>
<td class="description last"><p>輸入網頁開啟後之viewport,預設為{ width: 800, height: 600 }</p></td>
</tr>
<tr>
<td class="name"><code>actions</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>[]</code>
</td>
<td class="description last"><p>輸入網頁開啟後之操作動作,預設為[]</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>輸入action動作物件</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>mode</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>動作模式字串,可選'wait','move','elemove','elehover',drag','eledrag','click','eleclick','dbclick','eledbclick','type','eletype'</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'wait',需再輸入{time},單位為毫秒</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'resize',需再輸入{width,height},為網頁可視區域(viewport)的長寬,單位為整數</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'move',需再輸入{x1,y1},為相對網頁內容左上角位置,單位為px</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'elemove',需再輸入{selector,nth(可選)},selector為css選擇器,nth為陣列結果取第nth個dom元素,預設為0,負值代表由最末往前選(-nth)個dom元素</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'elehover',需再輸入{selector},selector為css選擇器,若有超過1個結果則取第1個dom元素</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'drag',需再輸入{x1,y1,x2,y2},由(x1,y1)拖曳至(x2,y2),為相對網頁內容左上角位置,單位為px</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'eledrag',需再輸入{selector,nth(可選),shiftx,shifty},由元素中心拖曳平移(shiftx,shifty),selector為css選擇器,nth為陣列結果取第nth個dom元素,預設為0,負值代表由最末往前選(-nth)個dom元素,shiftx,shifty單位為px</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'click',需再輸入{x1,y1},為相對網頁內容左上角位置,單位為px</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'eleclick',需再輸入{selector,nth(可選)},selector為css選擇器,nth為陣列結果取第nth個dom元素,預設為0,負值代表由最末往前選(-nth)個dom元素</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'dbclick',需再輸入{x1,y1},為相對網頁內容左上角位置,單位為px</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'eledbclick',需再輸入{selector,nth(可選)},selector為css選擇器,nth為陣列結果取第nth個dom元素,預設為0,負值代表由最末往前選(-nth)個dom元素</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'type',需再輸入{str,noEnter(可選)},為由當前焦點輸入文字str,noEnter為輸入文字結尾不再輸入enter,預設為true</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'eletype',需再輸入{selector,nth(可選),str,noEnter(可選)},selector為css選擇器,nth為陣列結果取第nth個dom元素,預設為0,負值代表由最末往前選(-nth)個dom元素,通過click該dom元素作為焦點輸入文字str,noEnter為輸入文字結尾不再輸入enter,預設為true</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'keypress',需再輸入{key,count(可選)},為由當前焦點輸入鍵盤key值,key可用'Backspace', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'或其他keycode,count為觸發次數,預設為1次,keypress可用key詳見[https://github.com/GoogleChrome/puppeteer/blob/v1.19.0/lib/USKeyboardLayout.js]</p></td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>若action.mode使用'elefocus',需再輸入{selector,nth(可選),str},selector為css選擇器,nth為陣列結果取第nth個dom元素,預設為0,負值代表由最末往前選(-nth)個dom元素,設定dom元素為當前焦點
keypress</p></td>
</tr>
<tr>
<td class="name"><code>waitsec</code></td>
<td class="type">
<span class="param-type">Integer</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>5</code>
</td>
<td class="description last"><p>輸入開啟網頁後之等待時間,單位為秒,預設為5</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳screenshot圖片轉base64資料</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id=".getFiles"><span class="type-signature type-signature-async, static">(async, static) </span>getFiles<span class="signature">(fd)</span><span class="type-signature"> → {Array}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>取得資料夾內檔案,可使用havsStr過濾檔名含有之字串</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="getFiles.mjs.html">getFiles.mjs</a>, <a href="getFiles.mjs.html#line11">line 11</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fd</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳檔案名稱字串陣列</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id=".readJson"><span class="type-signature type-signature-static">(static) </span>readJson<span class="signature">(fn)</span><span class="type-signature"> → {*}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>讀取json檔數據</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="readJson.mjs.html">readJson.mjs</a>, <a href="readJson.mjs.html#line12">line 12</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fn</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>輸入json檔案路徑字串</p></td>
</tr>
</tbody>
</table>
<h5 class="h5-returns">Returns:</h5>
<div class="param-desc">
<p>回傳數據</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".test"><span class="type-signature type-signature-async, static">(async, static) </span>test<span class="signature">(fd_html, fd_action, fd_base64, optExp<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
<dl class="details">
<dt class="tag-description">Description:</dt>
<dd class="tag-description"><ul class="dummy"><li><p>批次測試範例之快照(screenshot)是否與正確版相同</p></li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="exp.mjs.html">exp.mjs</a>, <a href="exp.mjs.html#line91">line 91</a>
</li></ul></dd>
</dl>
<h5 class="h5-parameters">Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fd_html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>