test: 新增网页元素演练场页面与三项网页自动化测试任务
This commit is contained in:
parent
a5d9f0bfee
commit
67a418129b
44
resources/fixture/components.html
Normal file
44
resources/fixture/components.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head><meta charset="utf-8"><title>网页元素演练场</title>
|
||||
<style>
|
||||
body { font-family: "Microsoft YaHei", sans-serif; margin: 24px; color: #1f2937; }
|
||||
.card { border: 2px solid #2563eb; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
|
||||
#result { margin-top: 12px; padding: 12px; background: #f0fdf4; border-radius: 6px; min-height: 24px; }
|
||||
#hover-area { width: 240px; height: 60px; background: #e5e7eb; line-height: 60px; text-align: center; border-radius: 6px; }
|
||||
#hover-area:hover { background: #fde68a; }
|
||||
#spacer { height: 1600px; background: linear-gradient(#ffffff, #dbeafe); }
|
||||
#bottom-area { padding: 20px; background: #fee2e2; border-radius: 8px; }
|
||||
label { margin-right: 16px; }
|
||||
button { padding: 6px 16px; }
|
||||
button:disabled { color: #9ca3af; }
|
||||
</style></head>
|
||||
<body>
|
||||
<h1>网页元素演练场</h1>
|
||||
<div class="card" id="card">
|
||||
<h2>基础表单</h2>
|
||||
<label>名称 <input id="inp-name" placeholder="请输入名称" /></label><br/><br/>
|
||||
<label>密码 <input id="inp-pass" type="password" /></label><br/><br/>
|
||||
<label>城市
|
||||
<select id="sel-city">
|
||||
<option value="bj">北京</option>
|
||||
<option value="sh">上海</option>
|
||||
<option value="gz">广州</option>
|
||||
</select>
|
||||
</label><br/><br/>
|
||||
<label><input type="checkbox" id="chk-agree" /> 同意条款</label>
|
||||
<label><input type="radio" name="plan" id="rd-basic" checked /> 基础版</label>
|
||||
<label><input type="radio" name="plan" id="rd-pro" /> 专业版</label><br/><br/>
|
||||
<button id="btn-submit" onclick="document.getElementById('result').textContent = '已提交:' + document.getElementById('inp-name').value + ' / 城市:' + document.getElementById('sel-city').value + ' / 同意:' + document.getElementById('chk-agree').checked">提交</button>
|
||||
<button id="btn-disabled" disabled>禁用按钮</button>
|
||||
<div id="result">等待提交…</div>
|
||||
</div>
|
||||
<div class="card" id="attr-card">
|
||||
<h2>属性测试</h2>
|
||||
<div id="attr-target" data-info="hello-rpa" title="属性目标">属性目标元素</div><br/>
|
||||
<input type="file" id="file-input" />
|
||||
</div>
|
||||
<div id="hover-area">悬停我变色</div>
|
||||
<div id="spacer"></div>
|
||||
<div id="bottom-area" class="card">页底区域(滚动测试目标)</div>
|
||||
</body></html>
|
||||
@ -28,6 +28,13 @@ export async function startFixtureServer(preferredPort = 17863): Promise<string>
|
||||
return;
|
||||
}
|
||||
if (url.pathname !== "/" && url.pathname !== "/index.html") {
|
||||
const safe = path.basename(url.pathname);
|
||||
const file = path.join(root, safe);
|
||||
if (/\.(html|css|js|png|jpg|svg)$/i.test(safe) && fs.existsSync(file)) {
|
||||
response.writeHead(200, { "Content-Type": safe.endsWith(".html") ? "text/html; charset=utf-8" : "application/octet-stream", "Cache-Control": "no-store" });
|
||||
fs.createReadStream(file).pipe(response);
|
||||
return;
|
||||
}
|
||||
response.writeHead(404).end("Not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user