This step asserts that a specific radio button is or is not selected. The selector parameter is a CSS selector string - typically an ID like #plan-monthly, a class like .option-premium, or an attribute selector like [data-testid=annual] - that identifies the radio input element. The step uses Playwright's isChecked() method to read the actual state and fails with a descriptive message if it does not match the expected result.
This is the selector first, present tense radio button phrasing: the selector appears in quotes before the words radio button, and the assertion uses is selected or is not selected. It is the present-tense counterpart to the should be selected form. Use this phrasing when asserting the result of an interaction in immediate past context, such as right after choosing a radio option. The optional leading the is accepted and ignored.
Accepted phrasings
Then the "<selector>" radio button is selected
Then the "<selector>" radio button is not selected
And the "<selector>" radio button is selected
And the "<selector>" radio button is not selected
Examples
Then the "#gender-male" radio button is selected
Then the "#gender-female" radio button is not selected
And the "#plan-premium" radio button is selected
Then the ".option-1" radio button is not selected
In a real scenario
Scenario: Verify account status is set to Blocked after saving
Given I am logged in as "admin@example.org"
And I go to "/admin/users/42/edit"
And wait
Then I should see "Normal user"
When I choose the radio button "#edit-status-blocked"
And I press "Save"
And wait
Then I should see "The changes have been saved."
And the "#edit-status-blocked" radio button is selected
And the "#edit-status-active" radio button is not selected