Then the "item" checkbox should be checked

This step asserts that a specific checkbox should be checked. The selector parameter is a CSS selector string - such as #privacy-policy, .terms, or [name=agree] - that identifies the checkbox on the page. Playwright's isChecked() method reads the actual state, and the step fails with a descriptive message if the checkbox is not checked.

This is the selector first, modal phrasing using should be checked. It is functionally identical to Then the "selector" checkbox is checked - both call the same underlying assertion. Use whichever wording matches the tone of the surrounding steps. In BDD suites where assertions are written as obligations ("the form should be valid"), the should be phrasing often feels more natural.

Accepted phrasings

Then the "<selector>" checkbox should be checked
And the "<selector>" checkbox should be checked
Then the "<selector>" checkbox should not be checked
And the "<selector>" checkbox should not be checked

Examples

Then the "#privacy-policy" checkbox should be checked
Then the "#newsletter" checkbox should not be checked
And the "#agree" checkbox should be checked
Then the ".terms" checkbox should not be checked

In a real scenario

Scenario: Verify role assignment defaults after saving configuration
  Given I am logged in as "admin@example.org"
    And I go to "/admin/people/roleassign"
    And wait
  Then I should see "Role assign"
    And the "#edit-editor" checkbox should be checked
    And the "#edit-content-admin" checkbox should be checked
    And the "#edit-site-admin" checkbox should be checked
    And the "#edit-guest" checkbox should not be checked

Related steps

Back to Field Steps