mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(browser): drive console.error through to a fired property
Claude-Session: https://claude.ai/code/session_01ShuAy8q8ZfPi8KHxwc8JpQ
This commit is contained in:
1 parent
3bab5c3f5c
commit
a6b3ccee58
3 files changed
+65
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>console-quiet</title>
|
||||
</head>
|
||||
<body>
|
||||
<button id="press" style="width:200px;height:80px">press</button>
|
||||
<div id="count">0</div>
|
||||
<script>
|
||||
// Noisy below the error level. A run that reports these as errors is
|
||||
// reporting a healthy page as broken.
|
||||
console.warn("a warning");
|
||||
console.log("a plain log");
|
||||
console.info("an info line");
|
||||
let presses = 0;
|
||||
document.getElementById("press").addEventListener("click", function () {
|
||||
presses += 1;
|
||||
document.getElementById("count").textContent = String(presses);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { always, extract, taps } from "@sanderling/spec";
|
||||
import { noLogcatErrors } from "@sanderling/spec/defaults/properties";
|
||||
|
||||
const presses = extract((s) => {
|
||||
const el = s.ax.find({ id: "count" });
|
||||
return el ? parseInt(el.text, 10) || 0 : 0;
|
||||
}).named("presses");
|
||||
|
||||
// The run has to actually be driving the page, or noLogcatErrors staying
|
||||
// satisfied says nothing about whether it can fire at all.
|
||||
const counterNeverMoves = always(() => presses.current === 0);
|
||||
|
||||
export const properties = { noLogcatErrors, counterNeverMoves };
|
||||
|
||||
export const actionsRoot = taps;
|
||||
Reference in new issue
Block a user