From 33b7ff31136a6e4f43d45b56ca386391ac0b64b6 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Tue, 10 Oct 2023 15:28:59 -0700 Subject: [PATCH 1/2] VACMS-10089: Revert Outreach cal work for now --- ...entity_form_display.node.event.default.yml | 35 ++-- ...entity_view_display.node.event.default.yml | 35 +--- ....entity_view_display.node.event.teaser.yml | 15 -- config/sync/feature_toggle.features.yml | 1 - ...de.event.field_publish_to_outreach_cal.yml | 28 --- .../sync/field.storage.node.field_listing.yml | 2 +- ...age.node.field_publish_to_outreach_cal.yml | 18 -- .../EventSubscriber/EntityEventSubscriber.php | 168 +----------------- .../va_gov_events/va_gov_events.services.yml | 2 +- .../assets/scss/components/_fields.scss | 8 - .../features/content_type/event.feature | 70 ++++++-- .../features/platform/file_upload.feature | 11 ++ .../common/i_create_a_node.js | 2 - .../common/i_set_a_feature_toggle.js | 14 -- 14 files changed, 99 insertions(+), 310 deletions(-) delete mode 100644 config/sync/field.field.node.event.field_publish_to_outreach_cal.yml delete mode 100644 config/sync/field.storage.node.field_publish_to_outreach_cal.yml create mode 100644 tests/cypress/integration/features/platform/file_upload.feature delete mode 100644 tests/cypress/integration/step_definitions/common/i_set_a_feature_toggle.js diff --git a/config/sync/core.entity_form_display.node.event.default.yml b/config/sync/core.entity_form_display.node.event.default.yml index 7fbdfbd4b7..8c99f87f35 100644 --- a/config/sync/core.entity_form_display.node.event.default.yml +++ b/config/sync/core.entity_form_display.node.event.default.yml @@ -23,7 +23,6 @@ dependencies: - field.field.node.event.field_media - field.field.node.event.field_meta_tags - field.field.node.event.field_order - - field.field.node.event.field_publish_to_outreach_cal - field.field.node.event.field_url_of_an_online_event - node.type.event - workflows.workflow.editorial @@ -47,7 +46,7 @@ third_party_settings: label: 'Section settings' region: content parent_name: '' - weight: 9 + weight: 8 format_type: details_sidebar format_settings: classes: '' @@ -65,7 +64,7 @@ third_party_settings: label: Location region: content parent_name: '' - weight: 8 + weight: 7 format_type: details format_settings: classes: '' @@ -82,7 +81,7 @@ third_party_settings: label: Registration region: content parent_name: '' - weight: 7 + weight: 6 format_type: fieldset format_settings: classes: '' @@ -143,7 +142,7 @@ third_party_settings: label: 'Meta Tags' region: content parent_name: '' - weight: 6 + weight: 5 format_type: fieldset format_settings: classes: '' @@ -174,7 +173,7 @@ third_party_settings: label: Free region: content parent_name: group_all_events_are_free - weight: 32 + weight: 15 format_type: html_element format_settings: classes: '' @@ -201,7 +200,7 @@ content: third_party_settings: { } field_additional_information_abo: type: text_textarea - weight: 32 + weight: 31 region: content settings: rows: 5 @@ -221,7 +220,7 @@ content: third_party_settings: { } field_body: type: text_textarea - weight: 5 + weight: 4 region: content settings: rows: 5 @@ -259,10 +258,7 @@ content: custom show_extra: true hide_date: false - separator: to add_abbreviations: '' - allday: true - remove_seconds: false third_party_settings: smart_date_recur: modal: true @@ -322,7 +318,7 @@ content: third_party_settings: { } field_last_saved_by_an_editor: type: datetime_timestamp - weight: 16 + weight: 44 region: content settings: { } third_party_settings: { } @@ -341,11 +337,7 @@ content: weight: 2 region: content settings: { } - third_party_settings: - limited_field_widgets: - limit_values: '1' - change_labels: - add_another: '' + third_party_settings: { } field_location_humanreadable: type: string_textfield weight: 16 @@ -362,7 +354,7 @@ content: third_party_settings: { } field_media: type: media_library_widget - weight: 4 + weight: 3 region: content settings: media_types: { } @@ -373,13 +365,6 @@ content: region: content settings: { } third_party_settings: { } - field_publish_to_outreach_cal: - type: boolean_checkbox - weight: 3 - region: content - settings: - display_label: true - third_party_settings: { } field_url_of_an_online_event: type: linkit weight: 15 diff --git a/config/sync/core.entity_view_display.node.event.default.yml b/config/sync/core.entity_view_display.node.event.default.yml index 936ca6c291..c765795f38 100644 --- a/config/sync/core.entity_view_display.node.event.default.yml +++ b/config/sync/core.entity_view_display.node.event.default.yml @@ -23,7 +23,6 @@ dependencies: - field.field.node.event.field_media - field.field.node.event.field_meta_tags - field.field.node.event.field_order - - field.field.node.event.field_publish_to_outreach_cal - field.field.node.event.field_url_of_an_online_event - node.type.event module: @@ -51,7 +50,6 @@ third_party_settings: group_c: children: - field_datetime_range_timezone - - field_listing - field_media - field_body - field_url_of_an_online_event @@ -76,7 +74,7 @@ third_party_settings: label: Location-related parent_name: group_c region: content - weight: 7 + weight: 28 format_type: fieldset format_settings: classes: '' @@ -91,7 +89,7 @@ third_party_settings: label: 'Registration related' parent_name: group_c region: content - weight: 8 + weight: 29 format_type: fieldset format_settings: classes: '' @@ -136,7 +134,7 @@ content: label: above settings: { } third_party_settings: { } - weight: 4 + weight: 25 region: content field_datetime_range_timezone: type: smartdate_default @@ -148,17 +146,8 @@ content: force_chronological: false add_classes: false time_wrapper: true - localize: false - parts: - - start - - end - duration: - separator: ' | ' - unit: '' - decimals: 2 - suffix: h third_party_settings: { } - weight: 1 + weight: 23 region: content field_description: type: string @@ -181,7 +170,7 @@ content: label: above settings: { } third_party_settings: { } - weight: 6 + weight: 27 region: content field_event_registrationrequired: type: boolean @@ -233,14 +222,6 @@ content: third_party_settings: { } weight: 17 region: content - field_listing: - type: entity_reference_label - label: above - settings: - link: true - third_party_settings: { } - weight: 2 - region: content field_location_humanreadable: type: string label: above @@ -263,7 +244,7 @@ content: view_mode: default link: false third_party_settings: { } - weight: 3 + weight: 24 region: content field_order: type: list_default @@ -282,15 +263,15 @@ content: rel: '' target: '' third_party_settings: { } - weight: 5 + weight: 26 region: content hidden: breadcrumbs: true content_moderation_control: true field_administration: true field_last_saved_by_an_editor: true + field_listing: true field_meta_tags: true - field_publish_to_outreach_cal: true langcode: true links: true search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.node.event.teaser.yml b/config/sync/core.entity_view_display.node.event.teaser.yml index 6cc0f1310e..b2e2adfdd9 100644 --- a/config/sync/core.entity_view_display.node.event.teaser.yml +++ b/config/sync/core.entity_view_display.node.event.teaser.yml @@ -24,11 +24,9 @@ dependencies: - field.field.node.event.field_media - field.field.node.event.field_meta_tags - field.field.node.event.field_order - - field.field.node.event.field_publish_to_outreach_cal - field.field.node.event.field_url_of_an_online_event - node.type.event module: - - link - smart_date - text - user @@ -37,18 +35,6 @@ targetEntityType: node bundle: event mode: teaser content: - breadcrumbs: - type: link - label: hidden - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - weight: -5 - region: content field_body: type: text_default label: hidden @@ -87,7 +73,6 @@ hidden: field_media: true field_meta_tags: true field_order: true - field_publish_to_outreach_cal: true field_url_of_an_online_event: true langcode: true links: true diff --git a/config/sync/feature_toggle.features.yml b/config/sync/feature_toggle.features.yml index 500db73770..3c70f0d3ef 100644 --- a/config/sync/feature_toggle.features.yml +++ b/config/sync/feature_toggle.features.yml @@ -5,4 +5,3 @@ features: feature_single_value_field_link: FEATURE_SINGLE_VALUE_FIELD_LINK feature_health_connect_number: FEATURE_HEALTH_CONNECT_NUMBER feature_mobile_app_promo: FEATURE_MOBILE_APP_PROMO - feature_event_outreach_checkbox: FEATURE_EVENT_OUTREACH_CHECKBOX diff --git a/config/sync/field.field.node.event.field_publish_to_outreach_cal.yml b/config/sync/field.field.node.event.field_publish_to_outreach_cal.yml deleted file mode 100644 index 297adec89e..0000000000 --- a/config/sync/field.field.node.event.field_publish_to_outreach_cal.yml +++ /dev/null @@ -1,28 +0,0 @@ -uuid: ba2d9d43-c4b9-4bfd-831a-9ef7544d43f8 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_publish_to_outreach_cal - - node.type.event - module: - - tmgmt_content -third_party_settings: - tmgmt_content: - excluded: false -id: node.event.field_publish_to_outreach_cal -field_name: field_publish_to_outreach_cal -entity_type: node -bundle: event -label: 'Publish to the National Outreach Calendar' -description: '' -required: false -translatable: false -default_value: - - - value: 0 -default_value_callback: '' -settings: - on_label: 'Yes' - off_label: 'No' -field_type: boolean diff --git a/config/sync/field.storage.node.field_listing.yml b/config/sync/field.storage.node.field_listing.yml index 9cdedd46e6..bebbf9f95d 100644 --- a/config/sync/field.storage.node.field_listing.yml +++ b/config/sync/field.storage.node.field_listing.yml @@ -12,7 +12,7 @@ settings: target_type: node module: core locked: false -cardinality: -1 +cardinality: 1 translatable: true indexes: { } persist_with_no_fields: false diff --git a/config/sync/field.storage.node.field_publish_to_outreach_cal.yml b/config/sync/field.storage.node.field_publish_to_outreach_cal.yml deleted file mode 100644 index 760a11b0f3..0000000000 --- a/config/sync/field.storage.node.field_publish_to_outreach_cal.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: ad80a854-7f29-45c1-871a-2d087663f64a -langcode: en -status: true -dependencies: - module: - - node -id: node.field_publish_to_outreach_cal -field_name: field_publish_to_outreach_cal -entity_type: node -type: boolean -settings: { } -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php index bd3c4f98d7..b3a543ceed 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -2,15 +2,9 @@ namespace Drupal\va_gov_events\EventSubscriber; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Session\AccountProxy; use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\core_event_dispatcher\EntityHookEvents; -use Drupal\core_event_dispatcher\Event\Entity\EntityPresaveEvent; +use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent; -use Drupal\feature_toggle\FeatureStatus; -use Drupal\node\NodeInterface; -use Drupal\va_gov_user\Service\UserPermsService; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -20,66 +14,14 @@ class EntityEventSubscriber implements EventSubscriberInterface { use StringTranslationTrait; - /** - * The 'publish to the national outreach calendar' field name. - */ - const PUBLISH_TO_OUTREACH_CAL_FIELD = 'field_publish_to_outreach_cal'; - - /** - * The 'field_listing' field name. - */ - const LISTING_FIELD = 'field_listing'; - - /** - * The National Outreach Calendar node id. - */ - const OUTREACH_CAL_NID = 736; - - /** - * The 'Outreach Hub' Section term id. - */ - const OUTREACH_HUB_TID = 7; - - /** - * The Feature toggle name for outreach checkbox. - */ - const OUTREACH_CHECKBOX_FEATURE_NAME = 'feature_event_outreach_checkbox'; - - /** - * The User Perms Service. - * - * @var \Drupal\va_gov_user\Service\UserPermsService - */ - protected UserPermsService $userPermsService; - - /** - * The current user. - * - * @var \Drupal\Core\Session\AccountInterface - */ - protected AccountInterface $currentUser; - - /** - * TRUE if the outreach checkbox feature toggle is enabled. - * - * @var bool - */ - private bool $outreachCheckboxEnabled; - /** * Constructs the EventSubscriber object. * - * @param \Drupal\va_gov_user\Service\UserPermsService $user_perms_service - * The current user perms service. - * @param \Drupal\Core\Session\AccountProxy $account_proxy - * The account proxy service. - * @param \Drupal\feature_toggle\FeatureStatus $feature_status - * The feature status service. + * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation + * The string translation service. */ - public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $feature_status) { - $this->userPermsService = $user_perms_service; - $this->currentUser = $account_proxy->getAccount(); - $this->outreachCheckboxEnabled = $feature_status->getStatus(self::OUTREACH_CHECKBOX_FEATURE_NAME); + public function __construct(TranslationInterface $string_translation) { + $this->stringTranslation = $string_translation; } /** @@ -89,41 +31,11 @@ public static function getSubscribedEvents(): array { return [ 'hook_event_dispatcher.form_node_event_form.alter' => 'alterEventNodeForm', 'hook_event_dispatcher.form_node_event_edit_form.alter' => 'alterEventNodeForm', - EntityHookEvents::ENTITY_PRE_SAVE => 'entityPresave', ]; } /** - * Determines if the current user is an 'Outreach Hub' only user. - * - * @return bool - * TRUE if the current user only has the 'Outreach Hub' section. - */ - protected function outreachHubOnlyUser(): bool { - $sections = $this->userPermsService->getSections($this->currentUser); - if (count($sections) === 1 && array_key_first($sections) === self::OUTREACH_HUB_TID) { - return TRUE; - } - return FALSE; - } - - /** - * Entity presave Event call. - * - * @param \Drupal\core_event_dispatcher\Event\Entity\EntityPresaveEvent $event - * The event. - * - * @throws \Drupal\Core\TypedData\Exception\MissingDataException - */ - public function entityPresave(EntityPresaveEvent $event): void { - $entity = $event->getEntity(); - if ($entity instanceof NodeInterface) { - $this->addToNationalOutreachCalendar($entity); - } - } - - /** - * Form alterations for event content type. + * Form alterations for eventcontent type. * * @param \Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent $event * The event. @@ -133,68 +45,6 @@ public function alterEventNodeForm(FormIdAlterEvent $event): void { $this->addDisplayManagementToEventFields($form); $this->modifyFormFieldsetElements($form); $this->modifyRecurringEventsWidgetFieldPresentation($form); - $this->modifyAddToOutreachCalendarElements($form); - } - - /** - * Adds the event to the National Outreach Calendar (event_listing). - * - * The purpose of this method is to add the current node event to the National - * Outreach Calendar (an event listing node) if the $listingField - * checkbox/boolean has been set, or if the current user is an Outreach Hub - * user. - * - * @param \Drupal\node\NodeInterface $node - * The node to be modified. - * - * @throws \Drupal\Core\TypedData\Exception\MissingDataException - */ - public function addToNationalOutreachCalendar(NodeInterface $node): void { - if ($node->hasField(self::LISTING_FIELD) && $node->hasField(self::PUBLISH_TO_OUTREACH_CAL_FIELD) && $this->outreachCheckboxEnabled) { - $addToCalValue = $node->get(self::PUBLISH_TO_OUTREACH_CAL_FIELD)->first()->getValue(); - if (isset($addToCalValue['value'])) { - $listings = $node->get(self::LISTING_FIELD)->getValue(); - if ($addToCalValue['value'] === 1 || $this->outreachHubOnlyUser()) { - // Add to Outreach calendar selected, or user is Outreach Hub only - // user. - if (!in_array(self::OUTREACH_CAL_NID, array_column($listings, 'target_id'))) { - $listings[] = [ - 'target_id' => self::OUTREACH_CAL_NID, - ]; - } - } - $node->set(self::LISTING_FIELD, $listings); - } - } - } - - /** - * Form changes for 'Publish to National Outreach Calendar' related elements. - * - * @param array $form - * The form array. - */ - public function modifyAddToOutreachCalendarElements(array &$form) :void { - if ($this->outreachHubOnlyUser() && $this->outreachCheckboxEnabled) { - // Disable the checkbox. - $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE; - // Set the default value of the checkbox. - $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['widget']['value']['#default_value'] = TRUE; - // Override the field label for the checkbox. - $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['widget']['value']['#title'] = $this->t('This event will automatically be published to the National Outreach Calendar'); - // Set the default value to the Outreach cal on the dropdown if is not - // already set. - if (empty($form[self::LISTING_FIELD]['widget']['#default_value'])) { - $form[self::LISTING_FIELD]['widget']['#default_value'] = self::OUTREACH_CAL_NID; - } - } - // Add the '- Select a value -' option (_none) since it was removed by - // the Limited Widgets for Unlimited Field module. - if (isset($form[self::LISTING_FIELD]['widget']['#options']) && !array_key_exists('_none', $form[self::LISTING_FIELD]['widget']['#options'])) { - $form[self::LISTING_FIELD]['widget']['#options'] = ['_none' => '- Select a value -'] + $form[self::LISTING_FIELD]['widget']['#options']; - } - // Disable the checkbox element until the feature toggle is on. - $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = $this->outreachCheckboxEnabled; } /** @@ -203,7 +53,7 @@ public function modifyAddToOutreachCalendarElements(array &$form) :void { * @param array $form * The form. */ - public function modifyRecurringEventsWidgetFieldPresentation(array &$form): void { + public function modifyRecurringEventsWidgetFieldPresentation(array &$form) { // Add our js for toggling items depending on duration choices. $form['#attached']['library'][] = 'va_gov_events/recurring_dates'; @@ -276,7 +126,7 @@ public function modifyRecurringEventsWidgetFieldPresentation(array &$form): void * @param array $form * The form. */ - public function addDisplayManagementToEventFields(array &$form): void { + public function addDisplayManagementToEventFields(array &$form) { $form['#attached']['library'][] = 'va_gov_events/event_form_states_helpers'; } @@ -290,7 +140,7 @@ public function addDisplayManagementToEventFields(array &$form): void { * @param array $form * The form. */ - public function modifyFormFieldSetElements(array &$form): void { + public function modifyFormFieldSetElements(array &$form) { // Remove the wrap and title around address widget. $form['field_address']['widget'][0]['#type'] = 'div'; unset($form['field_address']['widget'][0]['#title']); diff --git a/docroot/modules/custom/va_gov_events/va_gov_events.services.yml b/docroot/modules/custom/va_gov_events/va_gov_events.services.yml index 57e983a823..df7b43518a 100644 --- a/docroot/modules/custom/va_gov_events/va_gov_events.services.yml +++ b/docroot/modules/custom/va_gov_events/va_gov_events.services.yml @@ -1,7 +1,7 @@ services: va_gov_events.entity_event_subscriber: class: Drupal\va_gov_events\EventSubscriber\EntityEventSubscriber - arguments: ['@va_gov_user.user_perms', '@current_user', '@feature_toggle.feature_status'] + arguments: ['@string_translation'] tags: - { name: event_subscriber } va_gov_events.route_subscriber: diff --git a/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss b/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss index 7bfefb1ef9..d3ee628d2f 100644 --- a/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss +++ b/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss @@ -226,11 +226,3 @@ body:not(.role-admin) { .magichead .fieldset__wrapper { margin-left: var(--spacing-xl); } - -#edit-field-publish-to-outreach-cal-wrapper div.form-item--field-publish-to-outreach-cal-value { - margin-left: auto; -} - -#edit-field-publish-to-outreach-cal-wrapper label { - margin-left: var(--spacing-xs); -} diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index e229f0d88c..6920dce76b 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -2,11 +2,8 @@ Feature: Content Type: Event Scenario: Log in and create an event. - Given I am logged in as a user with the "administrator" role - When I set the "feature_event_outreach_checkbox" feature toggle to "on" - And I log out Given I am logged in as a user with the "content_admin" role - And I create a "event" node + Then I create a "event" node Scenario: Confirm that event form conditional fields are cleared out if parent options change Given I am logged in as a user with the "content_admin" role @@ -36,12 +33,63 @@ Feature: Content Type: Event And the option "- None -" from dropdown "State" should be selected When I select the "Online" radio button Then an element with the selector "#edit-field-url-of-an-online-event-0-uri" should be empty + # EVENT FORM SPECS - Scenario: Users who can only publish to National Outreach Calendar do not see the "Publish to the National Outreach Calendar" checkbox - Given I am logged in as a user with the "administrator" role - When I set the "feature_event_outreach_checkbox" feature toggle to "on" - And I log out - Given I am logged in as a user with the roles "office_content_creator, content_publisher" - And my workbench access sections are set to "7" + Scenario: Confirm that the default time zone when creating an event is set explicitly to Eastern. + Given I am logged in as a user with the "content_admin" role + When I am at "node/add/event" + Then the element with selector "#edit-field-datetime-range-timezone-0-timezone" should contain "New York" + + Scenario: Confirm that the event form conditional elements are shown or hidden appropriately + Given I am logged in as a user with the "content_admin" role And I am at "node/add/event" - Then I should see "This event will automatically be published to the National Outreach Calendar" + + And I select the "At a VA facility" radio button + Then I should see "Facility location" + And I should see "Building, floor, or room" + And I should not see "Street address" + And I should not see an element with the selector "#edit-field-address-0-address-locality" + And I should not see an element with the selector "#edit-field-address-0-address-administrative-area" + And I should not see "Country" + And I should not see an element with the selector "#edit-field-url-of-an-online-event-0-uri" + + When I select the "At a non-VA location" radio button + Then I should not see "Facility location" + And I should see "Building, floor, or room" + And I should see "Street address" + And I should see an element with the selector "#edit-field-address-0-address-locality" + And I should see an element with the selector "#edit-field-address-0-address-administrative-area" + And I should see "Country" + And I should not see an element with the selector "#edit-field-url-of-an-online-event-0-uri" + + When I select the "Online" radio button + Then I should not see "Facility location" + And I should not see "Building, floor, or room" + And I should not see "Street address" + And I should not see an element with the selector "#edit-field-address-0-address-locality" + And I should not see an element with the selector "#edit-field-address-0-address-administrative-area" + And I should not see "Country" + And I should see an element with the selector "#edit-field-url-of-an-online-event-0-uri" + + # Registration checkbox reveals conditional form elements + When I check the "Include registration information" checkbox + Then "Cost" should be visible + And I should see "Registration is required for this event" + And "Call to action" should be visible + + When I select option "Register" from dropdown "Call to action" + Then I should see an element with the selector "#edit-field-link-0-uri" + And I select option "Apply" from dropdown "Call to action" + Then I should see an element with the selector "#edit-field-link-0-uri" + And I select option "RSVP" from dropdown "Call to action" + Then I should see an element with the selector "#edit-field-link-0-uri" + And I select option "More Details" from dropdown "Call to action" + Then I should see an element with the selector "#edit-field-link-0-uri" + And I select option "- None -" from dropdown "Call to action" + Then I should not see an element with the selector "#edit-field-link-0-uri" + + When I uncheck the "Include registration information" checkbox + Then I should not see "Cost" + And I should not see "Registration is required for this event" + And I should not see "Call to action" + And I should not see an element with the selector "#edit-field-link-0-uri" diff --git a/tests/cypress/integration/features/platform/file_upload.feature b/tests/cypress/integration/features/platform/file_upload.feature new file mode 100644 index 0000000000..e3e3cc71a6 --- /dev/null +++ b/tests/cypress/integration/features/platform/file_upload.feature @@ -0,0 +1,11 @@ +@file_upload +Feature: Files can be uploaded and attached to nodes successfully + In order to reliably and predictably create content + As anybody involved in the project + I need to be able to upload and attach files to nodes. + + Scenario: We should be able to attach files to event nodes. + Given I am logged in as a user with the "content_admin" role + When I create a "event" node + Then "polygon_image.png" should exist + And an image with the selector 'div.field--name-image a img' should exist diff --git a/tests/cypress/integration/step_definitions/common/i_create_a_node.js b/tests/cypress/integration/step_definitions/common/i_create_a_node.js index ff6578e57a..d3535e4114 100644 --- a/tests/cypress/integration/step_definitions/common/i_create_a_node.js +++ b/tests/cypress/integration/step_definitions/common/i_create_a_node.js @@ -244,7 +244,6 @@ const creators = { "VA Alaska health care: Events", { force: true } ); - cy.get("#edit-field-publish-to-outreach-cal-value").check(); cy.findAllByLabelText("Street address").type( faker.address.streetAddress(), { force: true } @@ -280,7 +279,6 @@ const creators = { ).should("exist"); cy.get("form.node-form").find("input#edit-submit").click(); cy.get(".node__content").contains("Sun, Nov 5 2023, 10:00am - 11:00am MST"); - cy.get(".node__content").contains("Outreach events"); cy.scrollTo("top", { ensureScrollable: false }); cy.get(".tabs__tab a").contains("Edit").click({ force: true }); cy.get("#edit-field-datetime-range-timezone-0-manage-instances").click(); diff --git a/tests/cypress/integration/step_definitions/common/i_set_a_feature_toggle.js b/tests/cypress/integration/step_definitions/common/i_set_a_feature_toggle.js deleted file mode 100644 index 3cc671bc62..0000000000 --- a/tests/cypress/integration/step_definitions/common/i_set_a_feature_toggle.js +++ /dev/null @@ -1,14 +0,0 @@ -import { When } from "@badeball/cypress-cucumber-preprocessor"; - -When("I set the {string} feature toggle to {string}", (featureToggleMachineName, value) => { - let featureToggleAdminUrl = '/admin/config/system/feature_toggle'; - cy.visit(featureToggleAdminUrl); - // check or uncheck the box based on the value of "value". - if (value === "on") { - cy.get(`input[name=${featureToggleMachineName}]`).check({force: true}); - } - if (value === "off") { - cy.get(`input[name=${featureToggleMachineName}]`).uncheck({force: true}); - } - cy.get('#edit-submit').click(); -}); From 4ed47ae3801ffdd091e7134b427bd55bc551c68f Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Tue, 10 Oct 2023 16:26:58 -0700 Subject: [PATCH 2/2] VACMS-10089: Additional cypress event test stuff --- .../features/content_type/event.feature | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index 6fe13a5d4a..6920dce76b 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -93,61 +93,3 @@ Feature: Content Type: Event And I should not see "Registration is required for this event" And I should not see "Call to action" And I should not see an element with the selector "#edit-field-link-0-uri" - - Scenario: Users who can only publish to National Outreach Calendar do not see the "Publish to the National Outreach Calendar" checkbox - Given I am logged in as a user with the "administrator" role - When I set the "feature_event_outreach_checkbox" feature toggle to "on" - And I log out - Given I am logged in as a user with the roles "office_content_creator, content_publisher" - And my workbench access sections are set to "7" - And I am at "node/add/event" - - And I select the "At a VA facility" radio button - Then I should see "Facility location" - And I should see "Building, floor, or room" - And I should not see "Street address" - And I should not see an element with the selector "#edit-field-address-0-address-locality" - And I should not see an element with the selector "#edit-field-address-0-address-administrative-area" - And I should not see "Country" - And I should not see an element with the selector "#edit-field-url-of-an-online-event-0-uri" - - When I select the "At a non-VA location" radio button - Then I should not see "Facility location" - And I should see "Building, floor, or room" - And I should see "Street address" - And I should see an element with the selector "#edit-field-address-0-address-locality" - And I should see an element with the selector "#edit-field-address-0-address-administrative-area" - And I should see "Country" - And I should not see an element with the selector "#edit-field-url-of-an-online-event-0-uri" - - When I select the "Online" radio button - Then I should not see "Facility location" - And I should not see "Building, floor, or room" - And I should not see "Street address" - And I should not see an element with the selector "#edit-field-address-0-address-locality" - And I should not see an element with the selector "#edit-field-address-0-address-administrative-area" - And I should not see "Country" - And I should see an element with the selector "#edit-field-url-of-an-online-event-0-uri" - - # Registration checkbox reveals conditional form elements - When I check the "Include registration information" checkbox - Then "Cost" should be visible - And I should see "Registration is required for this event" - And "Call to action" should be visible - - When I select option "Register" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - And I select option "Apply" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - And I select option "RSVP" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - And I select option "More Details" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - And I select option "- None -" from dropdown "Call to action" - Then I should not see an element with the selector "#edit-field-link-0-uri" - - When I uncheck the "Include registration information" checkbox - Then I should not see "Cost" - And I should not see "Registration is required for this event" - And I should not see "Call to action" - And I should not see an element with the selector "#edit-field-link-0-uri"