Skip to content

Jest helper addNewDatagridRow never adds a row, so schema UI specs don't test new rows #10602

Closed

Description

@dpage

The Jest helper addNewDatagridRow in web/regression/javascript/genericFunctions.jsx (around lines 93-95) clicks [data-test="add-row"] button, but PgIconButton puts data-test on the <button> itself, so the descendant selector matches nothing and querySelector returns null. user.click(null) does not throw; user-event falls back to clicking document.body, so no row is ever added.

The helper is used at 13 call sites across 12 specs under regression/javascript/schema_ui_files/ (domain, foreign key, privilege, column, partition utils, variable, exclusion constraint, check constraint, membership, index, unique constraint and primary key). None of them asserts anything after the call, so they pass whilst never exercising the new-row and cell rendering paths they are meant to cover.

Suggested fix: use [data-test="add-row"] (as SchemaViewAllTypes.spec.js does), assert that the button exists and that the row count went up, and fix any specs that then fail.

Activity

  1. dpage commented on Oct 15, 2026

    @dpage
    ContributorAuthor

    Fixed in 1402f7d (#10624).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions