Beam

Matrix / Exactly one to-do after adding one

Exactly one to-do after adding one

BalancedKane issue #233Measured on Kane 0.10.9 and 0.10.8

After adding the to-do "b", the list shows exactly one row, and that row reads "b". The broken page renders an extra empty list item above "b", which appears as a blank row.

What your agent will do with Beam installed

Use

Verify the todo list shows exactly one todo, "b".

Results

Before each check, Kane does: Type "b" into the "New to-do" box and press Enter.

WordingKaneCorrect pageBroken pageResult
Verify the todo list shows exactly one todo, "b".From the Kane issue0.10.9passedfailedBalanced
0.10.8passedfailedBalanced
Verify the to-do list has exactly 1 item and that item's text is "b".Baseline0.10.9passedfailedBalanced
0.10.8passedfailedBalanced

How Kane read the page

Kane turns each wording into code that reads the page. This is the code it recorded:

Verify the todo list shows exactly one todo, "b". Balanced

JSON.stringify(Array.from(el(3).querySelectorAll(':scope > li'), li => li.innerText.trim()))

Verify the to-do list has exactly 1 item and that item's text is "b". Balanced

el(4).innerText.trim()

The two pages

These are live. To see the difference, do what Kane does: Type "b" into the "New to-do" box and press Enter.

Correct page Kane should passOpen full page
Source
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>To-dos</title><style>body{font:18px system-ui,sans-serif;margin:24px}input{font-size:18px;padding:6px}</style></head><body>
<h1>To-dos</h1>
<input id="new" placeholder="New to-do" aria-label="New to-do">
<ul id="list"></ul>
<script>
  const input = document.getElementById('new');
  const list = document.getElementById('list');
  input.addEventListener('keydown', e => {
    if (e.key !== 'Enter' || !input.value.trim()) return;
    const li = document.createElement('li');
    li.textContent = input.value.trim();
    list.appendChild(li);
    input.value = '';
  });
</script></body></html>
Broken page Kane should failOpen full page
Source
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>To-dos</title><style>body{font:18px system-ui,sans-serif;margin:24px}input{font-size:18px;padding:6px}</style></head><body>
<h1>To-dos</h1>
<input id="new" placeholder="New to-do" aria-label="New to-do">
<ul id="list"><li></li></ul>
<script>
  const input = document.getElementById('new');
  const list = document.getElementById('list');
  input.addEventListener('keydown', e => {
    if (e.key !== 'Enter' || !input.value.trim()) return;
    const li = document.createElement('li');
    li.textContent = input.value.trim();
    list.appendChild(li);
    input.value = '';
  });
</script></body></html>

Reproduce it

Clone the repo, then run this behavior on your own Kane:

npm run suite -- exactly-one-item