Skip to content

Split bill - #30

Merged
paperplate merged 8 commits into
mainfrom
splitBill
Jun 8, 2026
Merged

Split bill#30
paperplate merged 8 commits into
mainfrom
splitBill

Conversation

@paperplate

@paperplate paperplate commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Automatic tag-driven split: transactions are allocated to participants by tag, with any unallocated remainder shown.
  • Improvements

    • Redesigned split-bill UI: tag selector for adding participants, clearer per-person difference display, and improved table alignment for readability.
    • Transactions list button text changed to “Reset selection.”
  • Documentation

    • Added a Background section describing project origin.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors split-bill from percentage/lock-based allocation to transaction-tag-based allocation. Transactions emit signed amounts and parsed tags in a new splitBillUpdate payload; the component matches transaction tags to people and evenly distributes matched amounts, rendering per-person allocations and an unallocated remainder row.

Changes

Split Bill Tag-Based Allocation

Layer / File(s) Summary
Type contracts and transaction event payload
static_src/js/split_bill.ts, static_src/js/transactions.ts, JustAnotherExpenseManager/static/js/transactions.js
SplitBillUpdateEvent now carries optional transactions array with signed amounts and tags. Transaction emitter parses checked/unchecked rows into per-row objects and dispatches splitBillUpdate.
Component initialization, tag loading, and state setup
JustAnotherExpenseManager/static/js/split_bill.js, static_src/js/split_bill.ts
Component fetches available tags before first render and normalizes persisted people into {id, name} with nextId recomputed from stored IDs.
Person add/remove and global event handling
JustAnotherExpenseManager/static/js/split_bill.js, static_src/js/split_bill.ts
addPerson enforces trimmed, lowercase, case-insensitive-unique names persisted to sessionStorage; splitBillUpdate handler parses transactions into component state and updates total before re-render.
Tag-based allocation calculation
JustAnotherExpenseManager/static/js/split_bill.js, static_src/js/split_bill.ts
New calculateSplits() matches transaction tags to person names (case-insensitive), evenly distributes matched amounts across matched people, and accumulates unmatched amounts into unallocatedAmount.
Table rendering with allocation amounts and diff
JustAnotherExpenseManager/static/js/split_bill.js, static_src/js/split_bill.ts
renderTotalAndTable() renders per-person currency amounts derived from tag allocation, computes diff versus an even-per-person baseline, and conditionally appends an “Unallocated” remainder row.
HTML template and table column styling
JustAnotherExpenseManager/templates/split_bill_component.html, JustAnotherExpenseManager/static/css/split_bill.css
Added complete split-bill template (card header, tag select, add-person button, table scaffold). CSS updated to center-align header, name, amount, and diff columns; minor responsive formatting tweak.
Template data flow and button label updates
JustAnotherExpenseManager/templates/transactions_list.html
Transaction template now passes trans.tags to the edit handler via data-tags; split-selection button text changed to “Reset selection”.
Event binding and UI interaction wiring
JustAnotherExpenseManager/static/js/split_bill.js, static_src/js/split_bill.ts
Switched person-name input to a tag <select> and simplified event binding: removed percentage/lock/even-split handlers, left remove-button handling and add via select.
Playwright page object updates
tests/pages/SplitBillComponent.ts, tests/pages/TransactionsPage.ts
Page object updated to use selectOption() for adding people, removed percentage/lock helpers, added resetSelection; TransactionsPage now exposes split component.
Split-bill test scenario rewrite
tests/11-split-bill.spec.ts
Test suite refactored around tag-driven auto-allocation and remainder display; removed manual percentage/lock/even-split coverage; selection-mode tests now use checkbox flows and resetSelection; persistence seeds include tags.
CI configuration and repository documentation
.github/workflows/playwright.yml, README.md
Playwright CI pinned Node.js and adjusted browser install step; README gained a Background section.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Split bill' is extremely vague and generic, failing to convey meaningful information about the substantial changes made throughout the codebase. Consider a more descriptive title such as 'Refactor split bill component to use tag-based transaction allocation' that better summarizes the main architectural change.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch splitBill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🧹 Nitpick comments (6)
test-split.spec.ts (1)

1-13: ⚡ Quick win

Consider removing one of the two exploratory files or marking it as skipped.

test-split.js and test-split.spec.ts overlap heavily and add duplicate coverage/noise in the E2E suite.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test-split.spec.ts` around lines 1 - 13, There are duplicate exploratory E2E
tests (test-split.spec.ts and test-split.js) creating noise; pick one to keep
and either delete the other file or mark it as skipped—e.g., in
test-split.spec.ts locate the test block named "test split bill" and change it
to a skipped test (use the test.skip variant) or remove the file entirely,
ensuring only one canonical test for the split-bill flow remains in the suite.
static_src/js/transactions.ts (1)

508-512: ⚡ Quick win

Use proper type instead of any[] for transaction arrays.

The checkedTx and uncheckedTx arrays hold SplitBillTransaction objects but are typed as any[], which loses type safety. Consider using the imported type or inline type.

♻️ Suggested type fix
-  const checkedTx: any[] = [];
-  const uncheckedTx: any[] = [];
+  const checkedTx: { amount: number; tags: string[] }[] = [];
+  const uncheckedTx: { amount: number; tags: string[] }[] = [];

Or import and use SplitBillTransaction from ./split_bill if it's exported.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@static_src/js/transactions.ts` around lines 508 - 512, The arrays checkedTx
and uncheckedTx are typed as any[] losing type safety; change their declarations
to use the proper SplitBillTransaction[] type (e.g., const checkedTx:
SplitBillTransaction[] = []; const uncheckedTx: SplitBillTransaction[] = []),
and if SplitBillTransaction is not in scope import or reference it from its
module (for example import { SplitBillTransaction } from './split_bill' or use
an inline type alias) so all usages of checkedTx/uncheckedTx are strongly typed.
JustAnotherExpenseManager/templates/transactions_list.html (1)

7-9: 💤 Low value

Button text "Reset selection" may confuse users.

The button toggles visibility of checkboxes and resets them when hiding. When checkboxes are hidden, clicking "Reset selection" actually shows them (not a reset action). Consider "Toggle selection" or separate show/reset controls for clarity.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@JustAnotherExpenseManager/templates/transactions_list.html` around lines 7 -
9, The button with id "split-select-toggle" in transactions_list.html has
misleading text; change its label to "Toggle selection" (or similar) to reflect
that it toggles visibility, or split into two controls: keep "Show/Hide
selection" toggle (id "split-select-toggle") to control checkbox visibility and
add a separate "Reset selection" button that clears all checkboxes when clicked;
ensure the toggle updates accessible state (e.g., aria-pressed) and the reset
button's handler explicitly unchecks inputs with the selection class.
JustAnotherExpenseManager/static/js/split_bill.js (1)

101-101: 🏗️ Heavy lift

Replace dynamic innerHTML rendering with DOM node creation.

These assignments are exactly where OSSAR is flagging unsafe DOM writes. Even with partial escaping, moving to createElement/textContent removes this class of issue and aligns with the security lint policy.

Also applies to: 106-106, 128-128, 142-142

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@JustAnotherExpenseManager/static/js/split_bill.js` at line 101, Replace
unsafe innerHTML assignments on the tableBody element with explicit DOM
creation: instead of setting tableBody.innerHTML to a string (e.g., the row with
class "split-empty" and other similar strings at the other flagged sites),
create the tr and td elements via document.createElement, set attributes/classes
(e.g., td.className = "split-empty"), set text via textContent, and append the
nodes to tableBody; update all occurrences where tableBody.innerHTML is used
(the current instance and the ones referenced at the other flagged locations)
and ensure colspan is set via setAttribute or td.colSpan so no raw HTML strings
are injected.
tests/11-split-bill.spec.ts (2)

127-127: ⚡ Quick win

Remove temporary console logging from the test path.

Line 127 adds ad-hoc debug output that can clutter CI logs and make failures harder to scan.

Suggested cleanup
-    transactionsPage.page.on('console', msg => console.log('PAGE LOG:', msg.text()));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/11-split-bill.spec.ts` at line 127, Remove the temporary ad-hoc console
logging added to the test by deleting the transactionsPage.page.on('console',
msg => console.log('PAGE LOG:', msg.text())); line; if you need console capture
for debugging keep it behind a configurable flag or use the test framework's
logging utilities instead so CI logs remain clean.

311-312: ⚡ Quick win

Avoid clicking Reset selection before any row is selected.

Line 311 is not needed for this test’s intent and can become flaky if the button is disabled/hidden in the initial state.

Suggested simplification
-    await transactionsPage.split.resetSelection.click();
     await transactionsPage.table.getByRole('row').filter({ hasText: 'Coffee' }).locator('.split-select-checkbox').check();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/11-split-bill.spec.ts` around lines 311 - 312, The test unnecessarily
clicks transactionsPage.split.resetSelection before any selection, which can be
flaky if that control is disabled/hidden; remove the await
transactionsPage.split.resetSelection.click() call and simply perform the
selection via transactionsPage.table.getByRole('row').filter({ hasText: 'Coffee'
}).locator('.split-select-checkbox').check() so the test directly selects the
intended row without interacting with the reset button.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@JustAnotherExpenseManager/static/js/split_bill.js`:
- Around line 45-49: The event handler for splitBillUpdate should normalize
incoming transactions so calculateSplits() never sees a missing/non-array tags;
when processing e.detail in the splitBillUpdate handler (where you set
this.total and this.transactions), coerce detail.transactions to an array
default and map each transaction to ensure a tags property that is an array
(e.g., if tx.tags is missing or not an array replace with []), then assign that
normalized array to this.transactions before calling this.renderTotalAndTable();
this prevents tx.tags.some(...) in calculateSplits() from throwing.
- Line 57: The duplicate-check when adding a person uses a case-sensitive
comparison (this.people.some((p) => p.name === name.trim())), causing "Alice"
and "alice" to both be added; update the check in the add-person logic to
normalize both sides (e.g., trim and toLowerCase) before comparing so it matches
the case-insensitive tag matching used elsewhere (also update the corresponding
tag-matching spot around the tag handling at the other check to use the same
normalization strategy) to prevent case-variant duplicates.
- Line 121: The remove button markup rendering the element with class
"split-remove-btn" and data attributes (data-action="remove", data-id="${p.id}")
currently omits an explicit button type, which can default to submit inside
forms; update the template/JS that returns this string (the code building the
`<button class="split-remove-btn" ...">×</button>` HTML) to include
type="button" on that element so clicks won't trigger form submission.

In `@JustAnotherExpenseManager/templates/split_bill_component.html`:
- Around line 13-15: The tag selector (<select> with class "split-name-input"
and data-action="name-input") lacks an accessible label; add a visible <label>
associated with the select (give the select an id and use <label
for="...">Tag</label>) or, if a visible label is not desired, provide an
aria-label or aria-labelledby that describes the control (e.g., "Tag selector")
so screen readers and keyboard users can identify the control.
- Around line 16-17: The Add Person button (class="btn btn-primary
split-add-btn", data-action="add") is missing an explicit type and will submit
any surrounding form; modify that button element to include type="button" to
prevent accidental form submission while keeping its click behavior for the add
action.

In `@test-split.js`:
- Line 3: Replace the hardcoded absolute URL in the test's call to page.goto
with a relative path that uses the Playwright-configured baseURL (i.e., change
the call to use '/transactions' instead of
'http://localhost:5000/transactions'); locate the page.goto invocation in
test-split.js and update it to use the relative route so the test respects
CI/baseURL configuration.
- Line 4: Replace the brittle fixed sleep (page.waitForTimeout(1000)) with a
deterministic wait for the UI change: locate where the table is populated and
use page.waitForSelector (e.g., wait for a table row selector like 'table tbody
tr' or a specific cell text) or page.waitForResponse (matching the fetch
endpoint that populates the table) instead of waitForTimeout; update the test to
await page.waitForSelector(...) or await page.waitForResponse(...) before
asserting table contents so the test only proceeds once the async fetch/render
completes.
- Around line 7-12: The test currently only logs tagsStr from page.evaluate and
has no assertion; replace the console.log with an assertion that verifies the
expected behavior: use the tagsStr result from the page.evaluate block (or
re-evaluate a query like document.querySelectorAll('.btn-edit[data-tags]')) and
assert either that tagsStr is not 'no button' / not empty (for the non-empty
case) or explicitly assert the empty-state behavior when no .btn-edit exists;
update the test to fail on regressions by asserting the presence (or explicit
absence) of a data-tags attribute instead of only logging it.

In `@test-split.spec.ts`:
- Line 3: Replace the hardcoded host in the Playwright navigation call: locate
the page.goto invocation (the await
page.goto('http://localhost:5000/transactions') call) and change it to use a
relative path so Playwright's baseURL/CI routing is honored (e.g., navigate to
'/transactions' instead of including 'http://localhost:5000'); ensure any
related tests rely on Playwright's configured baseURL rather than an absolute
URL.
- Line 4: Replace the fixed sleep (page.waitForTimeout) with an explicit DOM
wait: locate where page.waitForTimeout(1000) is used and instead wait for a
concrete selector or condition that indicates the transactions list is populated
(e.g. page.waitForSelector('[data-testid="transactions-list"]') or
page.waitForFunction(() =>
document.querySelectorAll('[data-testid="transaction-item"]').length > 0)); this
removes flakiness by waiting for the actual DOM state rather than a fixed
timeout.
- Around line 6-13: The test currently only logs the computed `results` from the
`page.evaluate` call (which selects rows via
`document.querySelectorAll('tr[data-amount]')` and maps each row's edit button
`data-tags`) and never asserts anything; replace the console.log with real
assertions that validate `results` (for example check expected array length,
that no entry equals 'NO_BTN' if every row should have an edit button, and/or
that specific expected tag strings are present). Update the test block that
defines `results` to use your test runner's assertion helpers (e.g.,
`expect(results).toEqual(...)`, `expect(results).not.toContain('NO_BTN')`, or
similar) so the spec fails when the DOM is incorrect.

---

Nitpick comments:
In `@JustAnotherExpenseManager/static/js/split_bill.js`:
- Line 101: Replace unsafe innerHTML assignments on the tableBody element with
explicit DOM creation: instead of setting tableBody.innerHTML to a string (e.g.,
the row with class "split-empty" and other similar strings at the other flagged
sites), create the tr and td elements via document.createElement, set
attributes/classes (e.g., td.className = "split-empty"), set text via
textContent, and append the nodes to tableBody; update all occurrences where
tableBody.innerHTML is used (the current instance and the ones referenced at the
other flagged locations) and ensure colspan is set via setAttribute or
td.colSpan so no raw HTML strings are injected.

In `@JustAnotherExpenseManager/templates/transactions_list.html`:
- Around line 7-9: The button with id "split-select-toggle" in
transactions_list.html has misleading text; change its label to "Toggle
selection" (or similar) to reflect that it toggles visibility, or split into two
controls: keep "Show/Hide selection" toggle (id "split-select-toggle") to
control checkbox visibility and add a separate "Reset selection" button that
clears all checkboxes when clicked; ensure the toggle updates accessible state
(e.g., aria-pressed) and the reset button's handler explicitly unchecks inputs
with the selection class.

In `@static_src/js/transactions.ts`:
- Around line 508-512: The arrays checkedTx and uncheckedTx are typed as any[]
losing type safety; change their declarations to use the proper
SplitBillTransaction[] type (e.g., const checkedTx: SplitBillTransaction[] = [];
const uncheckedTx: SplitBillTransaction[] = []), and if SplitBillTransaction is
not in scope import or reference it from its module (for example import {
SplitBillTransaction } from './split_bill' or use an inline type alias) so all
usages of checkedTx/uncheckedTx are strongly typed.

In `@test-split.spec.ts`:
- Around line 1-13: There are duplicate exploratory E2E tests
(test-split.spec.ts and test-split.js) creating noise; pick one to keep and
either delete the other file or mark it as skipped—e.g., in test-split.spec.ts
locate the test block named "test split bill" and change it to a skipped test
(use the test.skip variant) or remove the file entirely, ensuring only one
canonical test for the split-bill flow remains in the suite.

In `@tests/11-split-bill.spec.ts`:
- Line 127: Remove the temporary ad-hoc console logging added to the test by
deleting the transactionsPage.page.on('console', msg => console.log('PAGE LOG:',
msg.text())); line; if you need console capture for debugging keep it behind a
configurable flag or use the test framework's logging utilities instead so CI
logs remain clean.
- Around line 311-312: The test unnecessarily clicks
transactionsPage.split.resetSelection before any selection, which can be flaky
if that control is disabled/hidden; remove the await
transactionsPage.split.resetSelection.click() call and simply perform the
selection via transactionsPage.table.getByRole('row').filter({ hasText: 'Coffee'
}).locator('.split-select-checkbox').check() so the test directly selects the
intended row without interacting with the reset button.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d86a109b-a073-4f3e-9350-eee32f8e6802

📥 Commits

Reviewing files that changed from the base of the PR and between 1990768 and 5b30044.

📒 Files selected for processing (13)
  • JustAnotherExpenseManager/static/css/split_bill.css
  • JustAnotherExpenseManager/static/js/split_bill.js
  • JustAnotherExpenseManager/static/js/transactions.js
  • JustAnotherExpenseManager/templates/split_bill_component.html
  • JustAnotherExpenseManager/templates/transactions_list.html
  • README.md
  • static_src/js/split_bill.ts
  • static_src/js/transactions.ts
  • test-split.js
  • test-split.spec.ts
  • tests/11-split-bill.spec.ts
  • tests/pages/SplitBillComponent.ts
  • tests/pages/TransactionsPage.ts

Comment thread JustAnotherExpenseManager/static/js/split_bill.js Outdated
Comment thread JustAnotherExpenseManager/static/js/split_bill.js Outdated
Comment thread JustAnotherExpenseManager/static/js/split_bill.js Outdated
Comment thread JustAnotherExpenseManager/templates/split_bill_component.html Outdated
Comment thread JustAnotherExpenseManager/templates/split_bill_component.html Outdated
Comment thread test-split.js Outdated
Comment thread test-split.js Outdated
Comment on lines +7 to +12
const tagsStr = await page.evaluate(() => {
const editBtn = document.querySelector('.btn-edit');
return editBtn ? editBtn.getAttribute('data-tags') : 'no button';
});
console.log('tagsStr:', tagsStr);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

This test has no assertion, so it cannot fail on regressions.

Right now it only logs output; convert this into a real check (e.g., ensure at least one row has a data-tags attribute or explicitly assert empty-state behavior).

Suggested change
-  console.log('tagsStr:', tagsStr);
+  expect(tagsStr).not.toBe('no button');
+  expect(tagsStr).not.toBeNull();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const tagsStr = await page.evaluate(() => {
const editBtn = document.querySelector('.btn-edit');
return editBtn ? editBtn.getAttribute('data-tags') : 'no button';
});
console.log('tagsStr:', tagsStr);
});
const tagsStr = await page.evaluate(() => {
const editBtn = document.querySelector('.btn-edit');
return editBtn ? editBtn.getAttribute('data-tags') : 'no button';
});
expect(tagsStr).not.toBe('no button');
expect(tagsStr).not.toBeNull();
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test-split.js` around lines 7 - 12, The test currently only logs tagsStr from
page.evaluate and has no assertion; replace the console.log with an assertion
that verifies the expected behavior: use the tagsStr result from the
page.evaluate block (or re-evaluate a query like
document.querySelectorAll('.btn-edit[data-tags]')) and assert either that
tagsStr is not 'no button' / not empty (for the non-empty case) or explicitly
assert the empty-state behavior when no .btn-edit exists; update the test to
fail on regressions by asserting the presence (or explicit absence) of a
data-tags attribute instead of only logging it.

Comment thread test-split.spec.ts Outdated
Comment thread test-split.spec.ts Outdated
Comment thread test-split.spec.ts Outdated
Comment on lines +6 to +13
const results = await page.evaluate(() => {
return Array.from(document.querySelectorAll('tr[data-amount]')).map(row => {
const editBtn = row.querySelector('.btn-edit');
return editBtn ? editBtn.getAttribute('data-tags') : 'NO_BTN';
});
});
console.log('Results:', results);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add assertions; logging alone is not a test.

results is computed but never validated, so this test always passes unless it crashes.

Suggested change
   const results = await page.evaluate(() => {
     return Array.from(document.querySelectorAll('tr[data-amount]')).map(row => {
       const editBtn = row.querySelector('.btn-edit');
       return editBtn ? editBtn.getAttribute('data-tags') : 'NO_BTN';
     });
   });
-  console.log('Results:', results);
+  expect(results.length).toBeGreaterThan(0);
+  expect(results).not.toContain('NO_BTN');
+  expect(results.some(v => v !== null)).toBeTruthy();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const results = await page.evaluate(() => {
return Array.from(document.querySelectorAll('tr[data-amount]')).map(row => {
const editBtn = row.querySelector('.btn-edit');
return editBtn ? editBtn.getAttribute('data-tags') : 'NO_BTN';
});
});
console.log('Results:', results);
});
const results = await page.evaluate(() => {
return Array.from(document.querySelectorAll('tr[data-amount]')).map(row => {
const editBtn = row.querySelector('.btn-edit');
return editBtn ? editBtn.getAttribute('data-tags') : 'NO_BTN';
});
});
expect(results.length).toBeGreaterThan(0);
expect(results).not.toContain('NO_BTN');
expect(results.some(v => v !== null)).toBeTruthy();
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test-split.spec.ts` around lines 6 - 13, The test currently only logs the
computed `results` from the `page.evaluate` call (which selects rows via
`document.querySelectorAll('tr[data-amount]')` and maps each row's edit button
`data-tags`) and never asserts anything; replace the console.log with real
assertions that validate `results` (for example check expected array length,
that no entry equals 'NO_BTN' if every row should have an edit button, and/or
that specific expected tag strings are present). Update the test block that
defines `results` to use your test runner's assertion helpers (e.g.,
`expect(results).toEqual(...)`, `expect(results).not.toContain('NO_BTN')`, or
similar) so the spec fails when the DOM is incorrect.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/playwright.yml:
- Around line 53-56: The workflow run step currently calls "apt-get update" and
"apt-get upgrade -y ..." without sudo and uses upgrade which won't install
missing libraries; update the Playwright job's run block (the step that runs
"npx playwright install chromium" and the subsequent apt commands) to invoke
privileged commands and install the specific packages instead of upgrading —
call "sudo apt-get update" followed by "sudo apt-get install -y libnss3
libatk-bridge2.0-0 libdrm2 libxcomposite1 libxdamage1 libxrandr2 libgbm1" so the
runner can perform the actions and the required browser dependencies are
actually installed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9044ef45-8885-4262-9fe6-9501ff86f8a1

📥 Commits

Reviewing files that changed from the base of the PR and between 5b30044 and 4dc360f.

📒 Files selected for processing (1)
  • .github/workflows/playwright.yml

Comment thread .github/workflows/playwright.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/playwright.yml:
- Around line 52-54: The PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT environment
variable is set too low (1000) causing browser download failures; update the
workflow by either removing the PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT env entry
entirely so Playwright uses its default, or increase it to a much larger value
(e.g., 300000) near the env block that precedes the run step using "npx
playwright install chromium --with-deps" so downloads have sufficient time to
complete.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 829a18ec-23a0-4571-8f47-596960fa57b5

📥 Commits

Reviewing files that changed from the base of the PR and between ea26032 and 1f174f8.

📒 Files selected for processing (1)
  • .github/workflows/playwright.yml

Comment on lines +52 to +54
env:
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT: 1000
run: npx playwright install chromium --with-deps

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

The connection timeout is too short and will cause browser installation failures.

PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT: 1000 sets a 1-second connection timeout for downloading Playwright browser binaries, which are typically 100+ MB. This will cause frequent CI failures, especially on moderate or slower network connections where downloads routinely take 30-60+ seconds.

⏱️ Proposed fix

Either remove the timeout entirely to use Playwright's default, or set a much higher value:

       - name: Install Playwright browsers
-        env:
-          PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT: 1000
         run: npx playwright install chromium --with-deps

Or, if you need an explicit timeout, use at least 300 seconds (5 minutes):

       - name: Install Playwright browsers
         env:
-          PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT: 1000
+          PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT: 300000
         run: npx playwright install chromium --with-deps
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env:
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT: 1000
run: npx playwright install chromium --with-deps
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/playwright.yml around lines 52 - 54, The
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT environment variable is set too low
(1000) causing browser download failures; update the workflow by either removing
the PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT env entry entirely so Playwright uses
its default, or increase it to a much larger value (e.g., 300000) near the env
block that precedes the run step using "npx playwright install chromium
--with-deps" so downloads have sufficient time to complete.

@paperplate
paperplate merged commit 940b14b into main Jun 8, 2026
8 checks passed
@paperplate
paperplate deleted the splitBill branch June 8, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant