Skip to content

Commit

Permalink
Added tests for form elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Jun 28, 2024
1 parent 02e3eff commit 4fe0306
Show file tree
Hide file tree
Showing 8 changed files with 953 additions and 0 deletions.
96 changes: 96 additions & 0 deletions tests/behat/features/form_civictheme_checkbox.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
@civictheme @styleguide
Feature: Test Drupal checkbox form element integration with CivicTheme & UIkit.

Background:
Given I am logged in as a user with the "Administrator" role
When I go to "admin/appearance/styleguide"

@api
Scenario: Label visible, no default value, no message, no error
Then I should see an ".checkbox-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox.form-checkbox[type='checkbox']" element

Then the "edit-checkbox-label-visible-no-default-value-no-message-no-error" checkbox should not be checked

Then I should see an ".checkbox-label-visible-no-default-value-no-message-no-error label.ct-label" element

Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error.ct-field.ct-field--required.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error input.ct-field__control.required[required]" element

Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error.ct-field.ct-field--disabled.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error input.ct-field__control[disabled]" element

Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error.ct-field.ct-field--invalid.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox--is-invalid" element
Then I should not see an ".checkbox-label-visible-no-default-value-no-message-no-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label visible, default value, no message, no error
Then I should see an ".checkbox-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox.form-checkbox[type='checkbox']" element

Then the "edit-checkbox-label-visible-default-value-no-message-no-error" checkbox should be checked

Then I should see an ".checkbox-label-visible-default-value-no-message-no-error label.ct-label" element

Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error.ct-field.ct-field--required.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error input.ct-field__control.required[required]" element

Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error.ct-field.ct-field--disabled.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error input.ct-field__control[disabled]" element

Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error.ct-field.ct-field--invalid.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox--is-invalid" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-no-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label visually hidden, default value, message, no error
Then I should see an ".checkbox-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox.form-checkbox[type='checkbox']" element

Then the "edit-checkbox-label-visually-hidden-default-value-message-no-error" checkbox should be checked

Then I should see an ".checkbox-label-visually-hidden-default-value-message-no-error label.ct-label.ct-visually-hidden" element

Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error.ct-field.ct-field--required.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error input.ct-field__control.required[required]" element

Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error.ct-field.ct-field--disabled.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error input.ct-field__control[disabled]" element

Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error.ct-field.ct-field--invalid.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox--is-invalid" element
Then I should not see an ".checkbox-label-visually-hidden-default-value-message-no-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label hidden, default value, message, required, error
Then I should see an ".checkbox-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox.form-checkbox[type='checkbox']" element

Then the "edit-checkbox-label-hidden-default-value-message-required-error" checkbox should be checked

Then I should not see an ".checkbox-label-hidden-default-value-message-required-error label.ct-label" element

Then I should see an ".checkbox-label-hidden-default-value-message-required-error.ct-field.ct-field--required.ct-field--checkbox" element
Then I should see an ".checkbox-label-hidden-default-value-message-required-error input.ct-field__control.required[required]" element

Then I should not see an ".checkbox-label-hidden-default-value-message-required-error.ct-field.ct-field--disabled.ct-field--checkbox" element
Then I should not see an ".checkbox-label-hidden-default-value-message-required-error input.ct-field__control[disabled]" element

Then I should see an ".checkbox-label-hidden-default-value-message-required-error.ct-field.ct-field--invalid.ct-field--checkbox" element
Then I should see an ".checkbox-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox--is-invalid" element
Then I should see an ".checkbox-label-hidden-default-value-message-required-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label visible, default value, no message, disabled
Then I should see an ".checkbox-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox.form-checkbox[type='checkbox']" element

Then the "edit-checkbox-label-visible-default-value-no-message-disabled" checkbox should be checked

Then I should see an ".checkbox-label-visible-default-value-no-message-disabled label.ct-label" element

Then I should not see an ".checkbox-label-visible-default-value-no-message-disabled.ct-field.ct-field--required.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-disabled input.ct-field__control.required[required]" element

Then I should see an ".checkbox-label-visible-default-value-no-message-disabled.ct-field.ct-field--disabled.ct-field--checkbox" element
Then I should see an ".checkbox-label-visible-default-value-no-message-disabled input.ct-field__control[disabled]" element

Then I should not see an ".checkbox-label-visible-default-value-no-message-disabled.ct-field.ct-field--invalid.ct-field--checkbox" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox--is-invalid" element
Then I should not see an ".checkbox-label-visible-default-value-no-message-disabled .ct-field__message.ct-field-message--error" element
111 changes: 111 additions & 0 deletions tests/behat/features/form_civictheme_checkboxes.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
@civictheme @styleguide
Feature: Test Drupal checkboxes form element integration with CivicTheme & UIkit.

Background:
Given I am logged in as a user with the "Administrator" role
When I go to "admin/appearance/styleguide"

@api
Scenario: Label visible, no default value, no message, no error
Then I should see an ".checkboxes-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2']" element

Then the "edit-checkboxes-label-visible-no-default-value-no-message-no-error-option-1" checkbox should not be checked
Then the "edit-checkboxes-label-visible-no-default-value-no-message-no-error-option-2" checkbox should not be checked

Then I should see an ".checkboxes-label-visible-no-default-value-no-message-no-error label.ct-label" element

Then I should not see an ".checkboxes-label-visible-no-default-value-no-message-no-error.ct-field.ct-field--required.ct-field--checkboxes" element

Then I should not see an ".checkboxes-label-visible-no-default-value-no-message-no-error.ct-field.ct-field--disabled.ct-field--checkboxes" element
Then I should not see an ".checkboxes-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1'][disabled]" element
Then I should not see an ".checkboxes-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2'][disabled]" element

Then I should not see an ".checkboxes-label-visible-no-default-value-no-message-no-error.ct-field.ct-field--invalid.ct-field--checkboxes" element
Then I should see an ".checkboxes-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visible-no-default-value-no-message-no-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_2']" element
Then I should not see an ".checkboxes-label-visible-no-default-value-no-message-no-error .ct-field__message.ct-field-message--error" element

@api @skipped
Scenario: Label visible, default value, no message, no error
Then I should see an ".checkboxes-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2']" element

Then the "edit-checkboxes-label-visible-default-value-no-message-no-error-option-1" checkbox should not be checked
Then the "edit-checkboxes-label-visible-default-value-no-message-no-error-option-2" checkbox should be checked

Then I should see an ".checkboxes-label-visible-default-value-no-message-no-error label.ct-label" element

Then I should not see an ".checkboxes-label-visible-default-value-no-message-no-error.ct-field.ct-field--required.ct-field--checkboxes" element

Then I should not see an ".checkboxes-label-visible-default-value-no-message-no-error.ct-field.ct-field--disabled.ct-field--checkboxes" element
Then I should not see an ".checkboxes-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1'][disabled]" element
Then I should not see an ".checkboxes-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2'][disabled]" element

Then I should not see an ".checkboxes-label-visible-default-value-no-message-no-error.ct-field.ct-field--invalid.ct-field--checkboxes" element
Then I should see an ".checkboxes-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visible-default-value-no-message-no-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_2']" element
Then I should not see an ".checkboxes-label-visible-default-value-no-message-no-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label visually hidden, default value, message, no error
Then I should see an ".checkboxes-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2']" element

Then the "edit-checkboxes-label-visually-hidden-default-value-message-no-error-option-1" checkbox should not be checked
Then the "edit-checkboxes-label-visually-hidden-default-value-message-no-error-option-2" checkbox should be checked

Then I should see an ".checkboxes-label-visually-hidden-default-value-message-no-error label.ct-label.ct-visually-hidden" element

Then I should not see an ".checkboxes-label-visually-hidden-default-value-message-no-error.ct-field.ct-field--required.ct-field--checkboxes" element

Then I should not see an ".checkboxes-label-visually-hidden-default-value-message-no-error.ct-field.ct-field--disabled.ct-field--checkboxes" element
Then I should not see an ".checkboxes-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1'][disabled]" element
Then I should not see an ".checkboxes-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2'][disabled]" element

Then I should not see an ".checkboxes-label-visually-hidden-default-value-message-no-error.ct-field.ct-field--invalid.ct-field--checkboxes" element
Then I should see an ".checkboxes-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visually-hidden-default-value-message-no-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_2']" element
Then I should not see an ".checkboxes-label-visually-hidden-default-value-message-no-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label hidden, default value, message, required, error
Then I should see an ".checkboxes-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2']" element

Then the "edit-checkboxes-label-hidden-default-value-message-required-error-option-1" checkbox should not be checked
Then the "edit-checkboxes-label-hidden-default-value-message-required-error-option-2" checkbox should be checked

Then I should not see an ".checkboxes-label-hidden-default-value-message-required-error label.ct-label" element

Then I should see an ".checkboxes-label-hidden-default-value-message-required-error.ct-field.ct-field--required.ct-field--checkboxes" element

Then I should not see an ".checkboxes-label-hidden-default-value-message-required-error.ct-field.ct-field--disabled.ct-field--checkboxes" element
Then I should not see an ".checkboxes-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1'][disabled]" element
Then I should not see an ".checkboxes-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2'][disabled]" element

Then I should see an ".checkboxes-label-hidden-default-value-message-required-error.ct-field.ct-field--invalid.ct-field--checkboxes" element
Then I should see an ".checkboxes-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-hidden-default-value-message-required-error input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_2']" element
Then I should see an ".checkboxes-label-hidden-default-value-message-required-error .ct-field__message.ct-field-message--error" element

@api
Scenario: Label visible, default value, no message, disabled
Then I should see an ".checkboxes-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1']" element
Then I should see an ".checkboxes-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2']" element

Then the "edit-checkboxes-label-visible-default-value-no-message-disabled-option-1" checkbox should not be checked
Then the "edit-checkboxes-label-visible-default-value-no-message-disabled-option-2" checkbox should be checked

Then I should see an ".checkboxes-label-visible-default-value-no-message-disabled label.ct-label" element

Then I should not see an ".checkboxes-label-visible-default-value-no-message-disabled.ct-field.ct-field--required.ct-field--checkboxes" element

Then I should see an ".checkboxes-label-visible-default-value-no-message-disabled.ct-field.ct-field--disabled.ct-field--checkboxes" element
Then I should see an ".checkboxes-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox[type='checkbox'][value='option_1'][disabled]" element
Then I should see an ".checkboxes-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox[type='checkbox'][value='option_2'][disabled]" element

Then I should not see an ".checkboxes-label-visible-default-value-no-message-disabled.ct-field.ct-field--invalid.ct-field--checkboxes" element
Then I should not see an ".checkboxes-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_1']" element
Then I should not see an ".checkboxes-label-visible-default-value-no-message-disabled input.ct-field__control.ct-checkbox--is-invalid[type='checkbox'][value='option_2']" element
Then I should not see an ".checkboxes-label-visible-default-value-no-message-disabled .ct-field__message.ct-field-message--error" element
Loading

0 comments on commit 4fe0306

Please sign in to comment.