Skip to content

636 — should auto-fill rate from matched priority in new-time-record modal

Description

End-to-end UI check that the hourly-rate priority drives the New time record modal's auto-filled Rate and Price. After seeding one billable rate per dimension with distinct values, opening the modal and selecting Client + Project + Task + Label should:

  • show the "Rate and price updated based on matched hourly rate" snackbar,
  • set Rate and Price to the dimension currently at the top of the priority list, and
  • highlight both inputs with the warning (yellow) border colour.

After re-ordering the priority (User → first) via the dialog, repeating the flow should resolve to the User rate instead.

Preconditions

  • Signed-in tenant owner with a fresh organization.
  • Priority is at the server default.
  • The Finance Settings → Hourly rates page is open.

Steps

  1. Seed a client, project (in the client), task (in the project, assignee = owner), team (owner added), and one label via API. Expected: all entities are created and return non-null payloads.
  2. Create six billable rates with distinct values, each scoped to exactly one dimension (Task=1001, Tags=1002, Project=1003, Client=1004, Team=1005, User=1006). Expected: all six createBillableRate mutations return non-null billableRate.id.
  3. Click the + shortcut in the header and choose Time record. Expected: the New time record modal opens.
  4. Pick the seeded Client, Project and Task inside the modal (labels are intentionally skipped in this flow — the time-record label combo is scoped to AvailableTimeTrackingTags and a generic tag isn't surfaced; tag matching is already covered by the API test). Expected: the "Rate and price updated based on matched hourly rate" snackbar appears, Rate = 1001, Price = 1001, both inputs render with data-input-border-color="warning" (yellow border).
  5. Click Create. Expected: a "Created" snackbar confirms the record was persisted at the auto-filled rate.
  6. Navigate to Finance Settings → Hourly rates, open the Change priority dialog, drag User to the top, and Save. Expected: "Updated" snackbar shown; dialog closes.
  7. Open the +Time record modal again and pick Client + Project + Task. Expected: Rate = 1006, Price = 1006 (the User rate now wins under the new priority). The "Rate and price updated" snackbar and yellow border are not asserted here — the form auto-fills user = owner on open, so the initial matching query already returns the User rate, and the warning UI only fires on a value change.
  8. Re-query billableRatePriority via API. Expected: the persisted order has User at index 0.
  • Spec: playwright/tests/integration/hourlyRate.spec.ts
  • GraphQL: matchingBillableRate, billableRatePriority, updateBillableRatePriority, createBillableRate, createTimeRecord
  • UI testids (added in this change): timeRecordFormRateValueInput, timeRecordFormPriceValueInput, data-input-border-color on InputBorder