From 422537e386265eb761550e4b353ea22c7024937d Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Thu, 28 Sep 2023 13:16:15 -0700 Subject: [PATCH 01/23] VACMS-10086: Storing temp hacks for checkbox. --- .../src/EventSubscriber/EntityEventSubscriber.php | 8 ++++++++ .../src/EventSubscriber/FormEventSubscriber.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php b/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php index fce02f96da..8d98f85df9 100644 --- a/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php @@ -75,6 +75,14 @@ public static function getSubscribedEvents(): array { public function entityPresave(EntityPresaveEvent $event): void { $entity = $event->getEntity(); if ($entity instanceof NodeInterface) { + if ($entity->hasField('field_listing')) { + $field_listings = $entity->get('field_listing')->getValue(); + $field_listings[] = [ + 'target_id' => 736, + ]; + $entity->set('field_listing', $field_listings); + } + $this->trimNodeTitleWhitespace($entity); } } diff --git a/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php b/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php index 3fdc8946a3..51b658ba0e 100644 --- a/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php +++ b/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php @@ -61,6 +61,8 @@ public function formAlter(FormAlterEvent $event): void { if (in_array($formId, $this->menus) && !$admin) { $form['description']['#access'] = FALSE; } + $form["field_add_to_outreach_calendar"]["widget"]["value"]["#title"] = "Your event will automatically be added to the Outreach Events calendar."; + $form["field_add_to_outreach_calendar"]["#disabled"] = TRUE; } } From b4a56000649a28b00703770375321770e5c1fe26 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Thu, 28 Sep 2023 16:42:30 -0700 Subject: [PATCH 02/23] VACMS-10089: Get rid of temp hacks. --- .../src/EventSubscriber/EntityEventSubscriber.php | 8 -------- .../src/EventSubscriber/FormEventSubscriber.php | 2 -- 2 files changed, 10 deletions(-) diff --git a/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php b/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php index 8d98f85df9..fce02f96da 100644 --- a/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_backend/src/EventSubscriber/EntityEventSubscriber.php @@ -75,14 +75,6 @@ public static function getSubscribedEvents(): array { public function entityPresave(EntityPresaveEvent $event): void { $entity = $event->getEntity(); if ($entity instanceof NodeInterface) { - if ($entity->hasField('field_listing')) { - $field_listings = $entity->get('field_listing')->getValue(); - $field_listings[] = [ - 'target_id' => 736, - ]; - $entity->set('field_listing', $field_listings); - } - $this->trimNodeTitleWhitespace($entity); } } diff --git a/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php b/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php index 51b658ba0e..3fdc8946a3 100644 --- a/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php +++ b/docroot/modules/custom/va_gov_header_footer/src/EventSubscriber/FormEventSubscriber.php @@ -61,8 +61,6 @@ public function formAlter(FormAlterEvent $event): void { if (in_array($formId, $this->menus) && !$admin) { $form['description']['#access'] = FALSE; } - $form["field_add_to_outreach_calendar"]["widget"]["value"]["#title"] = "Your event will automatically be added to the Outreach Events calendar."; - $form["field_add_to_outreach_calendar"]["#disabled"] = TRUE; } } From 4d4dfd26d4e1acea9e69f6bcbbc7701834e3b07d Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Thu, 28 Sep 2023 16:47:15 -0700 Subject: [PATCH 03/23] VACMS-10089: Add to outreach calendar checkbox now sets the correct value in listing_field - Disable the checkbox if it needs to be. --- .../EventSubscriber/EntityEventSubscriber.php | 106 +++++++++++++++++- .../va_gov_events/va_gov_events.services.yml | 2 +- 2 files changed, 102 insertions(+), 6 deletions(-) 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 b3a543ceed..b8b26a8666 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -2,9 +2,14 @@ namespace Drupal\va_gov_events\EventSubscriber; +use Drupal\Core\Session\AccountInterface; +use Drupal\Core\Session\AccountProxy; use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\Core\StringTranslation\TranslationInterface; +use Drupal\core_event_dispatcher\EntityHookEvents; +use Drupal\core_event_dispatcher\Event\Entity\EntityPresaveEvent; use Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent; +use Drupal\node\NodeInterface; +use Drupal\va_gov_user\Service\UserPermsService; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -14,14 +19,52 @@ class EntityEventSubscriber implements EventSubscriberInterface { use StringTranslationTrait; + /** + * The User Perms Service. + * + * @var \Drupal\va_gov_user\Service\UserPermsService + */ + protected $userPermsService; + + /** + * The 'publish to the national outreach calendar' field name. + * + * @var string + */ + protected string $publishToOutreachCalField = 'field_publish_to_outreach_cal'; + + /** + * The 'field_listing' field anem. + * + * @var string + */ + protected string $listingField = 'field_listing'; + + /** + * The National Outreach Calendar node id. + * + * @var int + */ + protected int $outreachCalendarNid = 736; + + /** + * The current user. + * + * @var \Drupal\Core\Session\AccountInterface + */ + protected AccountInterface $currentUser; + /** * Constructs the EventSubscriber object. * - * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation - * The string translation service. + * @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. */ - public function __construct(TranslationInterface $string_translation) { - $this->stringTranslation = $string_translation; + public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy) { + $this->userPermsService = $user_perms_service; + $this->currentUser = $account_proxy->getAccount(); } /** @@ -31,9 +74,23 @@ 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', ]; } + /** + * Entity presave Event call. + * + * @param \Drupal\core_event_dispatcher\Event\Entity\EntityPresaveEvent $event + * The event. + */ + public function entityPresave(EntityPresaveEvent $event): void { + $entity = $event->getEntity(); + if ($entity instanceof NodeInterface) { + $this->addToNationalOutreachCalendar($entity); + } + } + /** * Form alterations for eventcontent type. * @@ -45,6 +102,45 @@ public function alterEventNodeForm(FormIdAlterEvent $event): void { $this->addDisplayManagementToEventFields($form); $this->modifyFormFieldsetElements($form); $this->modifyRecurringEventsWidgetFieldPresentation($form); + $this->modifyAddToOutreachCalendarElement($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. + * + * @param \Drupal\node\NodeInterface $node + * The node to be modified. + */ + public function addToNationalOutreachCalendar(NodeInterface $node) { + if ($node->hasField($this->listingField) && $node->hasField($this->publishToOutreachCalField)) { + $addToCalValue = $node->get($this->publishToOutreachCalField)->first()->getValue(); + if (isset($addToCalValue['value']) && $addToCalValue['value'] === 1) { + $listings = $node->get($this->listingField)->getValue(); + // @todo check if the field already has teh Outreach cal sselected. + $listings[] = [ + 'target_id' => $this->outreachCalendarNid, + ]; + $node->set($this->listingField, $listings); + } + } + } + + /** + * Modify the 'Publish to National Outreach Calendar' field element. + * + * @param array $form + * The form array. + */ + public function modifyAddToOutreachCalendarElement(array &$form) :void { + // If the user has only the 'Outreach Hub' section, disable the checkbox. + $sections = $this->userPermsService->getSections($this->currentUser); + if (count($sections) === 1 && array_key_first($sections) === 7) { + $form[$this->publishToOutreachCalField]['#disabled'] = TRUE; + } } /** 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 df7b43518a..61828c54e3 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: ['@string_translation'] + arguments: ['@va_gov_user.user_perms', '@current_user'] tags: - { name: event_subscriber } va_gov_events.route_subscriber: From de70309db5fed2dd6313e84a4741cc99981a7165 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Thu, 28 Sep 2023 16:58:12 -0700 Subject: [PATCH 04/23] VACMS-10089: Adds new 'add to outrech calendar' field. --- ...entity_form_display.node.event.default.yml | 36 +++++++++++++------ ...entity_view_display.node.event.default.yml | 11 ++++++ ....entity_view_display.node.event.teaser.yml | 15 ++++++++ ...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 ++++++++++ 6 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 config/sync/field.field.node.event.field_publish_to_outreach_cal.yml create mode 100644 config/sync/field.storage.node.field_publish_to_outreach_cal.yml 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 8c99f87f35..0e4ca13d55 100644 --- a/config/sync/core.entity_form_display.node.event.default.yml +++ b/config/sync/core.entity_form_display.node.event.default.yml @@ -23,6 +23,7 @@ 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 @@ -46,7 +47,7 @@ third_party_settings: label: 'Section settings' region: content parent_name: '' - weight: 8 + weight: 9 format_type: details_sidebar format_settings: classes: '' @@ -64,7 +65,7 @@ third_party_settings: label: Location region: content parent_name: '' - weight: 7 + weight: 8 format_type: details format_settings: classes: '' @@ -81,7 +82,7 @@ third_party_settings: label: Registration region: content parent_name: '' - weight: 6 + weight: 7 format_type: fieldset format_settings: classes: '' @@ -93,7 +94,6 @@ third_party_settings: group_editorial_workflow: children: - moderation_state - - revision_log label: 'Editorial Workflow' region: content parent_name: '' @@ -142,7 +142,7 @@ third_party_settings: label: 'Meta Tags' region: content parent_name: '' - weight: 5 + weight: 6 format_type: fieldset format_settings: classes: '' @@ -173,7 +173,7 @@ third_party_settings: label: Free region: content parent_name: group_all_events_are_free - weight: 15 + weight: 32 format_type: html_element format_settings: classes: '' @@ -200,7 +200,7 @@ content: third_party_settings: { } field_additional_information_abo: type: text_textarea - weight: 31 + weight: 32 region: content settings: rows: 5 @@ -220,7 +220,7 @@ content: third_party_settings: { } field_body: type: text_textarea - weight: 4 + weight: 5 region: content settings: rows: 5 @@ -258,7 +258,10 @@ 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 @@ -318,7 +321,7 @@ content: third_party_settings: { } field_last_saved_by_an_editor: type: datetime_timestamp - weight: 44 + weight: 16 region: content settings: { } third_party_settings: { } @@ -337,7 +340,11 @@ content: weight: 2 region: content settings: { } - third_party_settings: { } + third_party_settings: + limited_field_widgets: + limit_values: '1' + change_labels: + add_another: '' field_location_humanreadable: type: string_textfield weight: 16 @@ -354,7 +361,7 @@ content: third_party_settings: { } field_media: type: media_library_widget - weight: 3 + weight: 4 region: content settings: media_types: { } @@ -365,6 +372,13 @@ 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 c765795f38..add74e4c05 100644 --- a/config/sync/core.entity_view_display.node.event.default.yml +++ b/config/sync/core.entity_view_display.node.event.default.yml @@ -23,6 +23,7 @@ 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: @@ -146,6 +147,15 @@ 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: 23 region: content @@ -272,6 +282,7 @@ hidden: 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 b2e2adfdd9..6cc0f1310e 100644 --- a/config/sync/core.entity_view_display.node.event.teaser.yml +++ b/config/sync/core.entity_view_display.node.event.teaser.yml @@ -24,9 +24,11 @@ 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 @@ -35,6 +37,18 @@ 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 @@ -73,6 +87,7 @@ 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/field.field.node.event.field_publish_to_outreach_cal.yml b/config/sync/field.field.node.event.field_publish_to_outreach_cal.yml new file mode 100644 index 0000000000..297adec89e --- /dev/null +++ b/config/sync/field.field.node.event.field_publish_to_outreach_cal.yml @@ -0,0 +1,28 @@ +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 bebbf9f95d..9cdedd46e6 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 new file mode 100644 index 0000000000..760a11b0f3 --- /dev/null +++ b/config/sync/field.storage.node.field_publish_to_outreach_cal.yml @@ -0,0 +1,18 @@ +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 From e4fa0d0f68638edf8eda53f4f156908461cba6f6 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 29 Sep 2023 14:47:08 -0700 Subject: [PATCH 05/23] VACMS-10089: Moves properties to constants. - Adds the calendar to the event if the user is a hub only user. --- .../EventSubscriber/EntityEventSubscriber.php | 81 ++++++++++++------- 1 file changed, 51 insertions(+), 30 deletions(-) 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 b8b26a8666..1cefb5fb84 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -20,32 +20,31 @@ class EntityEventSubscriber implements EventSubscriberInterface { use StringTranslationTrait; /** - * The User Perms Service. - * - * @var \Drupal\va_gov_user\Service\UserPermsService + * The 'publish to the national outreach calendar' field name. */ - protected $userPermsService; + const PUBLISH_TO_OUTREACH_CAL_FIELD = 'field_publish_to_outreach_cal'; /** - * The 'publish to the national outreach calendar' field name. - * - * @var string + * The 'field_listing' field name. */ - protected string $publishToOutreachCalField = 'field_publish_to_outreach_cal'; + const LISTING_FIELD = 'field_listing'; /** - * The 'field_listing' field anem. - * - * @var string + * The National Outreach Calendar node id. */ - protected string $listingField = 'field_listing'; + const OUTREACH_CAL_NID = 736; /** - * The National Outreach Calendar node id. + * The 'Outreach Hub' Section term id. + */ + const OUTREACH_HUB_TID = 7; + + /** + * The User Perms Service. * - * @var int + * @var \Drupal\va_gov_user\Service\UserPermsService */ - protected int $outreachCalendarNid = 736; + protected $userPermsService; /** * The current user. @@ -78,6 +77,21 @@ public static function getSubscribedEvents(): array { ]; } + /** + * 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() { + // If the user has only the 'Outreach Hub' section, remove the checkbox. + $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. * @@ -92,7 +106,7 @@ public function entityPresave(EntityPresaveEvent $event): void { } /** - * Form alterations for eventcontent type. + * Form alterations for event content type. * * @param \Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent $event * The event. @@ -110,21 +124,29 @@ public function alterEventNodeForm(FormIdAlterEvent $event): void { * * 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. + * 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) { - if ($node->hasField($this->listingField) && $node->hasField($this->publishToOutreachCalField)) { - $addToCalValue = $node->get($this->publishToOutreachCalField)->first()->getValue(); - if (isset($addToCalValue['value']) && $addToCalValue['value'] === 1) { - $listings = $node->get($this->listingField)->getValue(); - // @todo check if the field already has teh Outreach cal sselected. - $listings[] = [ - 'target_id' => $this->outreachCalendarNid, - ]; - $node->set($this->listingField, $listings); + if ($node->hasField(self::LISTING_FIELD) && $node->hasField(self::PUBLISH_TO_OUTREACH_CAL_FIELD)) { + $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); } } } @@ -136,10 +158,9 @@ public function addToNationalOutreachCalendar(NodeInterface $node) { * The form array. */ public function modifyAddToOutreachCalendarElement(array &$form) :void { - // If the user has only the 'Outreach Hub' section, disable the checkbox. - $sections = $this->userPermsService->getSections($this->currentUser); - if (count($sections) === 1 && array_key_first($sections) === 7) { - $form[$this->publishToOutreachCalField]['#disabled'] = TRUE; + // If the user has only the 'Outreach Hub' section, remove the checkbox. + if ($this->outreachHubOnlyUser()) { + $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE; } } From 95483737517604c9b4121f46696d769526aa1ae3 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 29 Sep 2023 14:48:21 -0700 Subject: [PATCH 06/23] VACMS-10089: Restore revision log to the proper location. --- config/sync/core.entity_form_display.node.event.default.yml | 1 + 1 file changed, 1 insertion(+) 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 0e4ca13d55..7fbdfbd4b7 100644 --- a/config/sync/core.entity_form_display.node.event.default.yml +++ b/config/sync/core.entity_form_display.node.event.default.yml @@ -94,6 +94,7 @@ third_party_settings: group_editorial_workflow: children: - moderation_state + - revision_log label: 'Editorial Workflow' region: content parent_name: '' From 6073acd85a39f5078c3ad2a757823425d97ca14c Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 29 Sep 2023 15:18:50 -0700 Subject: [PATCH 07/23] VACMS-10089: Updates style of checkbox and label. --- .../custom/vagovclaro/assets/scss/components/_fields.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss b/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss index d3ee628d2f..7bfefb1ef9 100644 --- a/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss +++ b/docroot/themes/custom/vagovclaro/assets/scss/components/_fields.scss @@ -226,3 +226,11 @@ 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); +} From 0e33790b15b4990fc4b9fb7eff43ba1388901c0f Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Mon, 2 Oct 2023 11:44:08 -0700 Subject: [PATCH 08/23] VACMS-10089: Sets default value and modifies the title of the 'add to national outreach calendar' field. --- .../src/EventSubscriber/EntityEventSubscriber.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 1cefb5fb84..58dba2f351 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -160,7 +160,9 @@ public function addToNationalOutreachCalendar(NodeInterface $node) { public function modifyAddToOutreachCalendarElement(array &$form) :void { // If the user has only the 'Outreach Hub' section, remove the checkbox. if ($this->outreachHubOnlyUser()) { - $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE; + $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE; + $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['widget']['value']['#default_value'] = TRUE; + $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['widget']['value']['#title'] = $this->t('This event will automatically be published to the National Outreach Calendar'); } } From 3cac1dff2b6daa82a0a1104aa04f170b33892dcc Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Mon, 2 Oct 2023 11:48:04 -0700 Subject: [PATCH 09/23] VACMS-10089: Adds missing function return types. --- .../src/EventSubscriber/EntityEventSubscriber.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 58dba2f351..2734142c05 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -83,8 +83,7 @@ public static function getSubscribedEvents(): array { * @return bool * TRUE if the current user only has the 'Outreach Hub' section. */ - protected function outreachHubOnlyUser() { - // If the user has only the 'Outreach Hub' section, remove the checkbox. + protected function outreachHubOnlyUser(): bool { $sections = $this->userPermsService->getSections($this->currentUser); if (count($sections) === 1 && array_key_first($sections) === self::OUTREACH_HUB_TID) { return TRUE; @@ -97,6 +96,8 @@ protected function outreachHubOnlyUser() { * * @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(); @@ -132,7 +133,7 @@ public function alterEventNodeForm(FormIdAlterEvent $event): void { * * @throws \Drupal\Core\TypedData\Exception\MissingDataException */ - public function addToNationalOutreachCalendar(NodeInterface $node) { + public function addToNationalOutreachCalendar(NodeInterface $node): void { if ($node->hasField(self::LISTING_FIELD) && $node->hasField(self::PUBLISH_TO_OUTREACH_CAL_FIELD)) { $addToCalValue = $node->get(self::PUBLISH_TO_OUTREACH_CAL_FIELD)->first()->getValue(); if (isset($addToCalValue['value'])) { @@ -172,7 +173,7 @@ public function modifyAddToOutreachCalendarElement(array &$form) :void { * @param array $form * The form. */ - public function modifyRecurringEventsWidgetFieldPresentation(array &$form) { + public function modifyRecurringEventsWidgetFieldPresentation(array &$form): void { // Add our js for toggling items depending on duration choices. $form['#attached']['library'][] = 'va_gov_events/recurring_dates'; @@ -245,7 +246,7 @@ public function modifyRecurringEventsWidgetFieldPresentation(array &$form) { * @param array $form * The form. */ - public function addDisplayManagementToEventFields(array &$form) { + public function addDisplayManagementToEventFields(array &$form): void { $form['#attached']['library'][] = 'va_gov_events/event_form_states_helpers'; } @@ -259,7 +260,7 @@ public function addDisplayManagementToEventFields(array &$form) { * @param array $form * The form. */ - public function modifyFormFieldSetElements(array &$form) { + public function modifyFormFieldSetElements(array &$form): void { // Remove the wrap and title around address widget. $form['field_address']['widget'][0]['#type'] = 'div'; unset($form['field_address']['widget'][0]['#title']); From ca53ff28f80aaac9221f9b0354e8ef602b90216a Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Mon, 2 Oct 2023 16:42:57 -0700 Subject: [PATCH 10/23] VACMS-10089: Adds defualt value for field_listing if user is Outreach hub only user. - Restore the _none option. --- .../EventSubscriber/EntityEventSubscriber.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 2734142c05..0c6ef7b5ed 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -117,7 +117,7 @@ public function alterEventNodeForm(FormIdAlterEvent $event): void { $this->addDisplayManagementToEventFields($form); $this->modifyFormFieldsetElements($form); $this->modifyRecurringEventsWidgetFieldPresentation($form); - $this->modifyAddToOutreachCalendarElement($form); + $this->modifyAddToOutreachCalendarElements($form); } /** @@ -153,17 +153,29 @@ public function addToNationalOutreachCalendar(NodeInterface $node): void { } /** - * Modify the 'Publish to National Outreach Calendar' field element. + * Form changes for 'Publish to National Outreach Calendar' related elements. * * @param array $form * The form array. */ - public function modifyAddToOutreachCalendarElement(array &$form) :void { - // If the user has only the 'Outreach Hub' section, remove the checkbox. + public function modifyAddToOutreachCalendarElements(array &$form) :void { if ($this->outreachHubOnlyUser()) { + // 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']; } } From 2f81169e7fcfce6a0202c25cfb689559eac8c678 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 20:14:06 -0500 Subject: [PATCH 11/23] Bump phpstan/phpstan from 1.10.36 to 1.10.37 (#15521) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.36 to 1.10.37. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.36...1.10.37) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f69af06ea8..22d3b9d38a 100644 --- a/composer.lock +++ b/composer.lock @@ -18411,16 +18411,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.36", + "version": "1.10.37", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ffa3089511121a672e62969404e4fddc753f9b15" + "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", - "reference": "ffa3089511121a672e62969404e4fddc753f9b15", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/058ba07e92f744d4dcf6061ae75283d0c6456f2e", + "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e", "shasum": "" }, "require": { @@ -18469,7 +18469,7 @@ "type": "tidelift" } ], - "time": "2023-09-29T14:07:45+00:00" + "time": "2023-10-02T16:18:37+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", From 0eb85d5feb4d83d0ad8bc296c0b143babb8a7b22 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Thu, 5 Oct 2023 00:29:31 -0700 Subject: [PATCH 12/23] VACMS-10089: Cypress testing of outreach cal checkbox --- ...entity_view_display.node.event.default.yml | 24 ++- .../features/content_type/event.feature | 19 ++- .../common/i_create_a_node.js | 2 + .../common/i_fill_in_node_details.js | 153 ++++++++++++++++++ .../common/should_be_created_successfully.js | 117 ++++++++++++++ 5 files changed, 300 insertions(+), 15 deletions(-) create mode 100644 tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js create mode 100644 tests/cypress/integration/step_definitions/common/should_be_created_successfully.js 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 add74e4c05..936ca6c291 100644 --- a/config/sync/core.entity_view_display.node.event.default.yml +++ b/config/sync/core.entity_view_display.node.event.default.yml @@ -51,6 +51,7 @@ third_party_settings: group_c: children: - field_datetime_range_timezone + - field_listing - field_media - field_body - field_url_of_an_online_event @@ -75,7 +76,7 @@ third_party_settings: label: Location-related parent_name: group_c region: content - weight: 28 + weight: 7 format_type: fieldset format_settings: classes: '' @@ -90,7 +91,7 @@ third_party_settings: label: 'Registration related' parent_name: group_c region: content - weight: 29 + weight: 8 format_type: fieldset format_settings: classes: '' @@ -135,7 +136,7 @@ content: label: above settings: { } third_party_settings: { } - weight: 25 + weight: 4 region: content field_datetime_range_timezone: type: smartdate_default @@ -157,7 +158,7 @@ content: decimals: 2 suffix: h third_party_settings: { } - weight: 23 + weight: 1 region: content field_description: type: string @@ -180,7 +181,7 @@ content: label: above settings: { } third_party_settings: { } - weight: 27 + weight: 6 region: content field_event_registrationrequired: type: boolean @@ -232,6 +233,14 @@ 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 @@ -254,7 +263,7 @@ content: view_mode: default link: false third_party_settings: { } - weight: 24 + weight: 3 region: content field_order: type: list_default @@ -273,14 +282,13 @@ content: rel: '' target: '' third_party_settings: { } - weight: 26 + weight: 5 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 diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index 6920dce76b..0e53238dbd 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -3,7 +3,7 @@ Feature: Content Type: Event Scenario: Log in and create an event. Given I am logged in as a user with the "content_admin" role - Then I create a "event" node + And 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 @@ -33,7 +33,6 @@ 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: 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 @@ -42,7 +41,7 @@ Feature: Content Type: Event 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" + When I am at "node/add/event" And I select the "At a VA facility" radio button Then I should see "Facility location" @@ -79,13 +78,13 @@ Feature: Content Type: Event 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" + When 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" + When 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" + When 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" + When 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 @@ -93,3 +92,9 @@ 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 roles "office_content_creator, content_publisher" + When my workbench access sections are set to "7" + And I am at "node/add/event" + Then I should see "This event will automatically be published to the National Outreach Calendar" 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 d3535e4114..ff6578e57a 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,6 +244,7 @@ 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 } @@ -279,6 +280,7 @@ 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_fill_in_node_details.js b/tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js new file mode 100644 index 0000000000..2f87fe7a6d --- /dev/null +++ b/tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js @@ -0,0 +1,153 @@ +/* eslint-disable max-nested-callbacks */ +import { Given } from "@badeball/cypress-cucumber-preprocessor"; +import { faker } from "@faker-js/faker"; + +const creators = { + event: () => { + cy.findAllByLabelText("Name").type( + `[Test Data] ${faker.lorem.sentence()}`, + { force: true } + ); + cy.get( + "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" + ).type("2023-11-04", { force: true }); + cy.get( + "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" + ).type("2023-11-04", { force: true }); + cy.get( + "#edit-field-datetime-range-timezone-0-time-wrapper-value-time" + ).type("10:00:00", { force: true }); + cy.get( + "#edit-field-datetime-range-timezone-0-time-wrapper-end-value-time" + ).type("11:00:00", { force: true }); + cy.get("#edit-field-datetime-range-timezone-0-timezone").select("Phoenix"); + cy.get("#edit-field-datetime-range-timezone-0-make-recurring").check(); + cy.get("#edit-field-datetime-range-timezone-0-interval").type("1"); + cy.get("#edit-field-datetime-range-timezone-0-repeat-end-date").type( + "2023-11-07", + { force: true } + ); + cy.get("#edit-field-datetime-range-timezone-0-repeat").select("DAILY"); + cy.findAllByLabelText("Where should the event be listed?").select( + "VA Alaska health care: Events", + { force: true } + ); + cy.findAllByLabelText("Street address").type( + faker.address.streetAddress(), + { force: true } + ); + cy.findAllByLabelText("City").type(faker.address.city(), { force: true }); + cy.findAllByLabelText("State").select("Alabama", { force: true }); + cy.findAllByLabelText("Section").select("--Outreach Hub", { force: true }); + // cy.scrollToSelector("#edit-field-media-open-button"); + // cy.get("#edit-field-media-open-button").click({ force: true }); + // cy.get(".dropzone", { + // timeout: 20000, + // }).should("exist"); + // cy.get(".dropzone").attachFile("images/polygon_image.png", { + // subjectType: "drag-n-drop", + // }); + // cy.findAllByLabelText("Alternative text").type(faker.lorem.sentence(), { + // force: true, + // }); + // cy.get('[data-drupal-selector="edit-media-0-fields-field-owner"]').select( + // "VACO", + // { force: true } + // ); + // cy.get("#edit-revision-log-0-value").type( + // `[Test revision log 1]${faker.lorem.sentence()}`, + // { force: true } + // ); + // cy.get("button").contains("Save and insert").click({ force: true }); + // cy.get( + // 'div.media-library-item[data-drupal-selector="edit-field-media-selection-0"]', + // { + // timeout: 20000, + // } + // ).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.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(); + // cy.get("table#manage-instances") + // .find(".dropbutton-action") + // .first() + // .find("a") + // .click({ force: true }); + // cy.get("#manage-instances form").find("input.form-submit").click(); + // cy.get("#manage-instances form").should("not.exist"); + // cy.get("button.ui-dialog-titlebar-close").click(); + return cy.wait(1000); + }, +}; + +Given("I fill in {string} node details", (contentType) => { + const creator = creators[contentType]; + assert.isNotNull( + creator, + `I do not know to fill in ${contentType} node details yet. Please add a definition in ${__filename}.` + ); + cy.visit(`/node/add/${contentType}`); + cy.injectAxe(); + cy.scrollTo("top"); + cy.checkAccessibility(); + creator().then(() => { + cy.get("#edit-revision-log-0-value").type( + `[Test revision log]${faker.lorem.sentence()}`, + { force: true } + ); + cy.get("form.node-form").find("input#edit-submit").click(); + cy.location("pathname", { timeout: 10000 }).should( + "not.include", + "/node/add" + ); + cy.injectAxe(); + cy.checkAccessibility(); + cy.drupalWatchdogHasNoNewErrors(); + cy.getDrupalSettings().then((drupalSettings) => { + const { currentPath } = drupalSettings.path; + cy.wrap(currentPath.split("/").pop()).as("nodeId"); + cy.window().then((window) => { + const pagePath = window.location.pathname; + cy.wrap(pagePath).as("pagePath"); + }); + }); + }); +}); +// +// Given("I create a {string} node and continue", (contentType) => { +// const creator = creators[contentType]; +// assert.isDefined( +// creator, +// `I do not know how to create ${contentType} nodes yet. Please add a definition in ${__filename}.` +// ); +// cy.visit(`/node/add/${contentType}`); +// cy.injectAxe(); +// cy.scrollTo("top"); +// cy.checkAccessibility(); +// creator().then(() => { +// cy.get("#edit-revision-log-0-value").type( +// `[Test revision log]${faker.lorem.sentence()}`, +// { force: true } +// ); +// cy.get("form.node-form").find("input#edit-save-continue").click(); +// cy.location("pathname", { timeout: 10000 }).should( +// "not.include", +// "/node/add" +// ); +// cy.injectAxe(); +// cy.checkAccessibility(); +// cy.drupalWatchdogHasNoNewErrors(); +// cy.getDrupalSettings().then((drupalSettings) => { +// const { currentPath } = drupalSettings.path; +// const pathComponents = currentPath.split("/"); +// pathComponents.pop(); +// cy.wrap(pathComponents.pop()).as("nodeId"); +// cy.window().then((window) => { +// const pagePath = window.location.pathname; +// cy.wrap(pagePath).as("pagePath"); +// }); +// }); +// }); +// }); diff --git a/tests/cypress/integration/step_definitions/common/should_be_created_successfully.js b/tests/cypress/integration/step_definitions/common/should_be_created_successfully.js new file mode 100644 index 0000000000..20faafeba2 --- /dev/null +++ b/tests/cypress/integration/step_definitions/common/should_be_created_successfully.js @@ -0,0 +1,117 @@ +/* eslint-disable max-nested-callbacks */ +import { Given } from "@badeball/cypress-cucumber-preprocessor"; +import { faker } from "@faker-js/faker"; + +const creators = { + event: () => { + // cy.findAllByLabelText("Name").type( + // `[Test Data] ${faker.lorem.sentence()}`, + // { force: true } + // ); + // cy.get( + // "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" + // ).type("2023-11-04", { force: true }); + // cy.get( + // "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" + // ).type("2023-11-04", { force: true }); + // cy.get( + // "#edit-field-datetime-range-timezone-0-time-wrapper-value-time" + // ).type("10:00:00", { force: true }); + // cy.get( + // "#edit-field-datetime-range-timezone-0-time-wrapper-end-value-time" + // ).type("11:00:00", { force: true }); + // cy.get("#edit-field-datetime-range-timezone-0-timezone").select("Phoenix"); + // cy.get("#edit-field-datetime-range-timezone-0-make-recurring").check(); + // cy.get("#edit-field-datetime-range-timezone-0-interval").type("1"); + // cy.get("#edit-field-datetime-range-timezone-0-repeat-end-date").type( + // "2023-11-07", + // { force: true } + // ); + // cy.get("#edit-field-datetime-range-timezone-0-repeat").select("DAILY"); + // cy.findAllByLabelText("Where should the event be listed?").select( + // "VA Alaska health care: Events", + // { force: true } + // ); + // cy.findAllByLabelText("Street address").type( + // faker.address.streetAddress(), + // { force: true } + // ); + // cy.findAllByLabelText("City").type(faker.address.city(), { force: true }); + // cy.findAllByLabelText("State").select("Alabama", { force: true }); + // cy.findAllByLabelText("Section").select("--Outreach Hub", { force: true }); + // cy.scrollToSelector("#edit-field-media-open-button"); + // cy.get("#edit-field-media-open-button").click({ force: true }); + // cy.get(".dropzone", { + // timeout: 20000, + // }).should("exist"); + // cy.get(".dropzone").attachFile("images/polygon_image.png", { + // subjectType: "drag-n-drop", + // }); + // cy.findAllByLabelText("Alternative text").type(faker.lorem.sentence(), { + // force: true, + // }); + // cy.get('[data-drupal-selector="edit-media-0-fields-field-owner"]').select( + // "VACO", + // { force: true } + // ); + // cy.get("#edit-revision-log-0-value").type( + // `[Test revision log 1]${faker.lorem.sentence()}`, + // { force: true } + // ); + // cy.get("button").contains("Save and insert").click({ force: true }); + // cy.get( + // 'div.media-library-item[data-drupal-selector="edit-field-media-selection-0"]', + // { + // timeout: 20000, + // } + // ).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.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(); + cy.get("table#manage-instances") + .find(".dropbutton-action") + .first() + .find("a") + .click({ force: true }); + cy.get("#manage-instances form").find("input.form-submit").click(); + cy.get("#manage-instances form").should("not.exist"); + cy.get("button.ui-dialog-titlebar-close").click(); + return cy.wait(1000); + }, +}; + +Given("{string} node should be created successfully", (contentType) => { + const creator = creators[contentType]; + assert.isNotNull( + creator, + `I do not know how to save ${contentType} nodes yet. Please add a definition in ${__filename}.` + ); + cy.visit(`/node/add/${contentType}`); + cy.injectAxe(); + cy.scrollTo("top"); + cy.checkAccessibility(); + creator().then(() => { + cy.get("#edit-revision-log-0-value").type( + `[Test revision log]${faker.lorem.sentence()}`, + { force: true } + ); + cy.get("form.node-form").find("input#edit-submit").click(); + cy.location("pathname", { timeout: 10000 }).should( + "not.include", + "/node/add" + ); + cy.injectAxe(); + cy.checkAccessibility(); + cy.drupalWatchdogHasNoNewErrors(); + cy.getDrupalSettings().then((drupalSettings) => { + const { currentPath } = drupalSettings.path; + cy.wrap(currentPath.split("/").pop()).as("nodeId"); + cy.window().then((window) => { + const pagePath = window.location.pathname; + cy.wrap(pagePath).as("pagePath"); + }); + }); + }); +}); From 81f9c4557e11f576b4c481aa078dd4ca7b9cbccf Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Thu, 5 Oct 2023 11:52:48 -0700 Subject: [PATCH 13/23] VACMS-10089: Add feature toggle for outreach calendar checkbox --- config/sync/feature_toggle.features.yml | 1 + .../EventSubscriber/EntityEventSubscriber.php | 25 ++++++++++++++++--- .../va_gov_events/va_gov_events.services.yml | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/config/sync/feature_toggle.features.yml b/config/sync/feature_toggle.features.yml index 3c70f0d3ef..500db73770 100644 --- a/config/sync/feature_toggle.features.yml +++ b/config/sync/feature_toggle.features.yml @@ -5,3 +5,4 @@ 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/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php index 0c6ef7b5ed..f7a06f5848 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -8,6 +8,7 @@ use Drupal\core_event_dispatcher\EntityHookEvents; use Drupal\core_event_dispatcher\Event\Entity\EntityPresaveEvent; 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; @@ -39,6 +40,11 @@ class EntityEventSubscriber implements EventSubscriberInterface { */ const OUTREACH_HUB_TID = 7; + /** + * The Feature toggle name for outreach checkbox. + */ + const OUTREACH_FEATURE = 'FEATURE_EVENT_OUTREACH_CHECKBOX'; + /** * The User Perms Service. * @@ -53,6 +59,13 @@ class EntityEventSubscriber implements EventSubscriberInterface { */ protected AccountInterface $currentUser; + /** + * The Feature Toggle Service. + * + * @var \Drupal\feature_toggle\FeatureStatus + */ + protected featureStatus $featureStatus; + /** * Constructs the EventSubscriber object. * @@ -60,10 +73,13 @@ class EntityEventSubscriber implements EventSubscriberInterface { * The current user perms service. * @param \Drupal\Core\Session\AccountProxy $account_proxy * The account proxy service. + * @param \Drupal\feature_toggle\FeatureStatus $featureStatus + * The feature status service. */ - public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy) { + public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $featureStatus) { $this->userPermsService = $user_perms_service; $this->currentUser = $account_proxy->getAccount(); + $this->featureStatus = $featureStatus; } /** @@ -101,7 +117,7 @@ protected function outreachHubOnlyUser(): bool { */ public function entityPresave(EntityPresaveEvent $event): void { $entity = $event->getEntity(); - if ($entity instanceof NodeInterface) { + if ($entity instanceof NodeInterface && $this->featureStatus->getStatus(self::OUTREACH_FEATURE)) { $this->addToNationalOutreachCalendar($entity); } } @@ -159,7 +175,7 @@ public function addToNationalOutreachCalendar(NodeInterface $node): void { * The form array. */ public function modifyAddToOutreachCalendarElements(array &$form) :void { - if ($this->outreachHubOnlyUser()) { + if ($this->outreachHubOnlyUser() && $this->featureStatus->getStatus(self::OUTREACH_FEATURE)) { // Disable the checkbox. $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE; // Set the default value of the checkbox. @@ -177,6 +193,9 @@ public function modifyAddToOutreachCalendarElements(array &$form) :void { 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']; } + if (!$this->featureStatus->getStatus(self::OUTREACH_FEATURE)) { + $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE; + } } /** 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 61828c54e3..57e983a823 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'] + arguments: ['@va_gov_user.user_perms', '@current_user', '@feature_toggle.feature_status'] tags: - { name: event_subscriber } va_gov_events.route_subscriber: From 812b8c8ad10c0fbdd28711fafc07d944a5548883 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Thu, 5 Oct 2023 11:54:32 -0700 Subject: [PATCH 14/23] VACMS-10089: Remove unnessary cypress tests. --- .../common/i_fill_in_node_details.js | 153 ------------------ .../common/should_be_created_successfully.js | 117 -------------- 2 files changed, 270 deletions(-) delete mode 100644 tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js delete mode 100644 tests/cypress/integration/step_definitions/common/should_be_created_successfully.js diff --git a/tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js b/tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js deleted file mode 100644 index 2f87fe7a6d..0000000000 --- a/tests/cypress/integration/step_definitions/common/i_fill_in_node_details.js +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import { Given } from "@badeball/cypress-cucumber-preprocessor"; -import { faker } from "@faker-js/faker"; - -const creators = { - event: () => { - cy.findAllByLabelText("Name").type( - `[Test Data] ${faker.lorem.sentence()}`, - { force: true } - ); - cy.get( - "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" - ).type("2023-11-04", { force: true }); - cy.get( - "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" - ).type("2023-11-04", { force: true }); - cy.get( - "#edit-field-datetime-range-timezone-0-time-wrapper-value-time" - ).type("10:00:00", { force: true }); - cy.get( - "#edit-field-datetime-range-timezone-0-time-wrapper-end-value-time" - ).type("11:00:00", { force: true }); - cy.get("#edit-field-datetime-range-timezone-0-timezone").select("Phoenix"); - cy.get("#edit-field-datetime-range-timezone-0-make-recurring").check(); - cy.get("#edit-field-datetime-range-timezone-0-interval").type("1"); - cy.get("#edit-field-datetime-range-timezone-0-repeat-end-date").type( - "2023-11-07", - { force: true } - ); - cy.get("#edit-field-datetime-range-timezone-0-repeat").select("DAILY"); - cy.findAllByLabelText("Where should the event be listed?").select( - "VA Alaska health care: Events", - { force: true } - ); - cy.findAllByLabelText("Street address").type( - faker.address.streetAddress(), - { force: true } - ); - cy.findAllByLabelText("City").type(faker.address.city(), { force: true }); - cy.findAllByLabelText("State").select("Alabama", { force: true }); - cy.findAllByLabelText("Section").select("--Outreach Hub", { force: true }); - // cy.scrollToSelector("#edit-field-media-open-button"); - // cy.get("#edit-field-media-open-button").click({ force: true }); - // cy.get(".dropzone", { - // timeout: 20000, - // }).should("exist"); - // cy.get(".dropzone").attachFile("images/polygon_image.png", { - // subjectType: "drag-n-drop", - // }); - // cy.findAllByLabelText("Alternative text").type(faker.lorem.sentence(), { - // force: true, - // }); - // cy.get('[data-drupal-selector="edit-media-0-fields-field-owner"]').select( - // "VACO", - // { force: true } - // ); - // cy.get("#edit-revision-log-0-value").type( - // `[Test revision log 1]${faker.lorem.sentence()}`, - // { force: true } - // ); - // cy.get("button").contains("Save and insert").click({ force: true }); - // cy.get( - // 'div.media-library-item[data-drupal-selector="edit-field-media-selection-0"]', - // { - // timeout: 20000, - // } - // ).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.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(); - // cy.get("table#manage-instances") - // .find(".dropbutton-action") - // .first() - // .find("a") - // .click({ force: true }); - // cy.get("#manage-instances form").find("input.form-submit").click(); - // cy.get("#manage-instances form").should("not.exist"); - // cy.get("button.ui-dialog-titlebar-close").click(); - return cy.wait(1000); - }, -}; - -Given("I fill in {string} node details", (contentType) => { - const creator = creators[contentType]; - assert.isNotNull( - creator, - `I do not know to fill in ${contentType} node details yet. Please add a definition in ${__filename}.` - ); - cy.visit(`/node/add/${contentType}`); - cy.injectAxe(); - cy.scrollTo("top"); - cy.checkAccessibility(); - creator().then(() => { - cy.get("#edit-revision-log-0-value").type( - `[Test revision log]${faker.lorem.sentence()}`, - { force: true } - ); - cy.get("form.node-form").find("input#edit-submit").click(); - cy.location("pathname", { timeout: 10000 }).should( - "not.include", - "/node/add" - ); - cy.injectAxe(); - cy.checkAccessibility(); - cy.drupalWatchdogHasNoNewErrors(); - cy.getDrupalSettings().then((drupalSettings) => { - const { currentPath } = drupalSettings.path; - cy.wrap(currentPath.split("/").pop()).as("nodeId"); - cy.window().then((window) => { - const pagePath = window.location.pathname; - cy.wrap(pagePath).as("pagePath"); - }); - }); - }); -}); -// -// Given("I create a {string} node and continue", (contentType) => { -// const creator = creators[contentType]; -// assert.isDefined( -// creator, -// `I do not know how to create ${contentType} nodes yet. Please add a definition in ${__filename}.` -// ); -// cy.visit(`/node/add/${contentType}`); -// cy.injectAxe(); -// cy.scrollTo("top"); -// cy.checkAccessibility(); -// creator().then(() => { -// cy.get("#edit-revision-log-0-value").type( -// `[Test revision log]${faker.lorem.sentence()}`, -// { force: true } -// ); -// cy.get("form.node-form").find("input#edit-save-continue").click(); -// cy.location("pathname", { timeout: 10000 }).should( -// "not.include", -// "/node/add" -// ); -// cy.injectAxe(); -// cy.checkAccessibility(); -// cy.drupalWatchdogHasNoNewErrors(); -// cy.getDrupalSettings().then((drupalSettings) => { -// const { currentPath } = drupalSettings.path; -// const pathComponents = currentPath.split("/"); -// pathComponents.pop(); -// cy.wrap(pathComponents.pop()).as("nodeId"); -// cy.window().then((window) => { -// const pagePath = window.location.pathname; -// cy.wrap(pagePath).as("pagePath"); -// }); -// }); -// }); -// }); diff --git a/tests/cypress/integration/step_definitions/common/should_be_created_successfully.js b/tests/cypress/integration/step_definitions/common/should_be_created_successfully.js deleted file mode 100644 index 20faafeba2..0000000000 --- a/tests/cypress/integration/step_definitions/common/should_be_created_successfully.js +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -import { Given } from "@badeball/cypress-cucumber-preprocessor"; -import { faker } from "@faker-js/faker"; - -const creators = { - event: () => { - // cy.findAllByLabelText("Name").type( - // `[Test Data] ${faker.lorem.sentence()}`, - // { force: true } - // ); - // cy.get( - // "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" - // ).type("2023-11-04", { force: true }); - // cy.get( - // "#edit-field-datetime-range-timezone-0-time-wrapper-value-date" - // ).type("2023-11-04", { force: true }); - // cy.get( - // "#edit-field-datetime-range-timezone-0-time-wrapper-value-time" - // ).type("10:00:00", { force: true }); - // cy.get( - // "#edit-field-datetime-range-timezone-0-time-wrapper-end-value-time" - // ).type("11:00:00", { force: true }); - // cy.get("#edit-field-datetime-range-timezone-0-timezone").select("Phoenix"); - // cy.get("#edit-field-datetime-range-timezone-0-make-recurring").check(); - // cy.get("#edit-field-datetime-range-timezone-0-interval").type("1"); - // cy.get("#edit-field-datetime-range-timezone-0-repeat-end-date").type( - // "2023-11-07", - // { force: true } - // ); - // cy.get("#edit-field-datetime-range-timezone-0-repeat").select("DAILY"); - // cy.findAllByLabelText("Where should the event be listed?").select( - // "VA Alaska health care: Events", - // { force: true } - // ); - // cy.findAllByLabelText("Street address").type( - // faker.address.streetAddress(), - // { force: true } - // ); - // cy.findAllByLabelText("City").type(faker.address.city(), { force: true }); - // cy.findAllByLabelText("State").select("Alabama", { force: true }); - // cy.findAllByLabelText("Section").select("--Outreach Hub", { force: true }); - // cy.scrollToSelector("#edit-field-media-open-button"); - // cy.get("#edit-field-media-open-button").click({ force: true }); - // cy.get(".dropzone", { - // timeout: 20000, - // }).should("exist"); - // cy.get(".dropzone").attachFile("images/polygon_image.png", { - // subjectType: "drag-n-drop", - // }); - // cy.findAllByLabelText("Alternative text").type(faker.lorem.sentence(), { - // force: true, - // }); - // cy.get('[data-drupal-selector="edit-media-0-fields-field-owner"]').select( - // "VACO", - // { force: true } - // ); - // cy.get("#edit-revision-log-0-value").type( - // `[Test revision log 1]${faker.lorem.sentence()}`, - // { force: true } - // ); - // cy.get("button").contains("Save and insert").click({ force: true }); - // cy.get( - // 'div.media-library-item[data-drupal-selector="edit-field-media-selection-0"]', - // { - // timeout: 20000, - // } - // ).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.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(); - cy.get("table#manage-instances") - .find(".dropbutton-action") - .first() - .find("a") - .click({ force: true }); - cy.get("#manage-instances form").find("input.form-submit").click(); - cy.get("#manage-instances form").should("not.exist"); - cy.get("button.ui-dialog-titlebar-close").click(); - return cy.wait(1000); - }, -}; - -Given("{string} node should be created successfully", (contentType) => { - const creator = creators[contentType]; - assert.isNotNull( - creator, - `I do not know how to save ${contentType} nodes yet. Please add a definition in ${__filename}.` - ); - cy.visit(`/node/add/${contentType}`); - cy.injectAxe(); - cy.scrollTo("top"); - cy.checkAccessibility(); - creator().then(() => { - cy.get("#edit-revision-log-0-value").type( - `[Test revision log]${faker.lorem.sentence()}`, - { force: true } - ); - cy.get("form.node-form").find("input#edit-submit").click(); - cy.location("pathname", { timeout: 10000 }).should( - "not.include", - "/node/add" - ); - cy.injectAxe(); - cy.checkAccessibility(); - cy.drupalWatchdogHasNoNewErrors(); - cy.getDrupalSettings().then((drupalSettings) => { - const { currentPath } = drupalSettings.path; - cy.wrap(currentPath.split("/").pop()).as("nodeId"); - cy.window().then((window) => { - const pagePath = window.location.pathname; - cy.wrap(pagePath).as("pagePath"); - }); - }); - }); -}); From 33cf643687724eddfaabe2455f082a93d0a32ce5 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Thu, 5 Oct 2023 11:56:39 -0700 Subject: [PATCH 15/23] Revert "Bump phpstan/phpstan from 1.10.36 to 1.10.37 (#15521)" This reverts commit 2f81169e7fcfce6a0202c25cfb689559eac8c678. --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 22d3b9d38a..f69af06ea8 100644 --- a/composer.lock +++ b/composer.lock @@ -18411,16 +18411,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.37", + "version": "1.10.36", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e" + "reference": "ffa3089511121a672e62969404e4fddc753f9b15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/058ba07e92f744d4dcf6061ae75283d0c6456f2e", - "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", + "reference": "ffa3089511121a672e62969404e4fddc753f9b15", "shasum": "" }, "require": { @@ -18469,7 +18469,7 @@ "type": "tidelift" } ], - "time": "2023-10-02T16:18:37+00:00" + "time": "2023-09-29T14:07:45+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", From f9e3cae3d2c14fee44e13ef7283f5b4b28ed0e00 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Thu, 5 Oct 2023 12:53:21 -0700 Subject: [PATCH 16/23] VACMS-10089: Don't change to snekCase cuz it was wrong --- .../src/EventSubscriber/EntityEventSubscriber.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 f7a06f5848..820a704d39 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -64,7 +64,7 @@ class EntityEventSubscriber implements EventSubscriberInterface { * * @var \Drupal\feature_toggle\FeatureStatus */ - protected featureStatus $featureStatus; + protected featureStatus $feature_status; /** * Constructs the EventSubscriber object. @@ -73,13 +73,13 @@ class EntityEventSubscriber implements EventSubscriberInterface { * The current user perms service. * @param \Drupal\Core\Session\AccountProxy $account_proxy * The account proxy service. - * @param \Drupal\feature_toggle\FeatureStatus $featureStatus + * @param \Drupal\feature_toggle\FeatureStatus $feature_status * The feature status service. */ - public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $featureStatus) { + public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $feature_status) { $this->userPermsService = $user_perms_service; $this->currentUser = $account_proxy->getAccount(); - $this->featureStatus = $featureStatus; + $this->feature_status = $feature_status; } /** @@ -117,7 +117,7 @@ protected function outreachHubOnlyUser(): bool { */ public function entityPresave(EntityPresaveEvent $event): void { $entity = $event->getEntity(); - if ($entity instanceof NodeInterface && $this->featureStatus->getStatus(self::OUTREACH_FEATURE)) { + if ($entity instanceof NodeInterface && $this->feature_status->getStatus(self::OUTREACH_FEATURE)) { $this->addToNationalOutreachCalendar($entity); } } @@ -175,7 +175,7 @@ public function addToNationalOutreachCalendar(NodeInterface $node): void { * The form array. */ public function modifyAddToOutreachCalendarElements(array &$form) :void { - if ($this->outreachHubOnlyUser() && $this->featureStatus->getStatus(self::OUTREACH_FEATURE)) { + if ($this->outreachHubOnlyUser() && $this->feature_status->getStatus(self::OUTREACH_FEATURE)) { // Disable the checkbox. $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE; // Set the default value of the checkbox. @@ -193,7 +193,7 @@ public function modifyAddToOutreachCalendarElements(array &$form) :void { 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']; } - if (!$this->featureStatus->getStatus(self::OUTREACH_FEATURE)) { + if (!$this->feature_status->getStatus(self::OUTREACH_FEATURE)) { $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE; } } From 716ad41cd269ff13299bcbd787bd55b0d36700a2 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Thu, 5 Oct 2023 12:59:41 -0700 Subject: [PATCH 17/23] VACMS-10089: Rename class property for outreach feature toggle --- .../src/EventSubscriber/EntityEventSubscriber.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 820a704d39..965ef3f377 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -64,7 +64,7 @@ class EntityEventSubscriber implements EventSubscriberInterface { * * @var \Drupal\feature_toggle\FeatureStatus */ - protected featureStatus $feature_status; + protected featureStatus $outreachFeatureToggle; /** * Constructs the EventSubscriber object. @@ -79,7 +79,7 @@ class EntityEventSubscriber implements EventSubscriberInterface { public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $feature_status) { $this->userPermsService = $user_perms_service; $this->currentUser = $account_proxy->getAccount(); - $this->feature_status = $feature_status; + $this->outreachFeatureToggle = $feature_status; } /** @@ -117,7 +117,7 @@ protected function outreachHubOnlyUser(): bool { */ public function entityPresave(EntityPresaveEvent $event): void { $entity = $event->getEntity(); - if ($entity instanceof NodeInterface && $this->feature_status->getStatus(self::OUTREACH_FEATURE)) { + if ($entity instanceof NodeInterface && $this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) { $this->addToNationalOutreachCalendar($entity); } } @@ -175,7 +175,7 @@ public function addToNationalOutreachCalendar(NodeInterface $node): void { * The form array. */ public function modifyAddToOutreachCalendarElements(array &$form) :void { - if ($this->outreachHubOnlyUser() && $this->feature_status->getStatus(self::OUTREACH_FEATURE)) { + if ($this->outreachHubOnlyUser() && $this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) { // Disable the checkbox. $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE; // Set the default value of the checkbox. @@ -193,7 +193,7 @@ public function modifyAddToOutreachCalendarElements(array &$form) :void { 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']; } - if (!$this->feature_status->getStatus(self::OUTREACH_FEATURE)) { + if (!$this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) { $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE; } } From 24bcc1d37c6f1c5e9d35f085c6fc549ef013c0a3 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 6 Oct 2023 08:54:53 -0700 Subject: [PATCH 18/23] VACMS-10089: Adjust how the feature toggle is used. --- .../EventSubscriber/EntityEventSubscriber.php | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) 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 965ef3f377..bd3c4f98d7 100644 --- a/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_events/src/EventSubscriber/EntityEventSubscriber.php @@ -43,14 +43,14 @@ class EntityEventSubscriber implements EventSubscriberInterface { /** * The Feature toggle name for outreach checkbox. */ - const OUTREACH_FEATURE = 'FEATURE_EVENT_OUTREACH_CHECKBOX'; + const OUTREACH_CHECKBOX_FEATURE_NAME = 'feature_event_outreach_checkbox'; /** * The User Perms Service. * * @var \Drupal\va_gov_user\Service\UserPermsService */ - protected $userPermsService; + protected UserPermsService $userPermsService; /** * The current user. @@ -60,11 +60,11 @@ class EntityEventSubscriber implements EventSubscriberInterface { protected AccountInterface $currentUser; /** - * The Feature Toggle Service. + * TRUE if the outreach checkbox feature toggle is enabled. * - * @var \Drupal\feature_toggle\FeatureStatus + * @var bool */ - protected featureStatus $outreachFeatureToggle; + private bool $outreachCheckboxEnabled; /** * Constructs the EventSubscriber object. @@ -79,7 +79,7 @@ class EntityEventSubscriber implements EventSubscriberInterface { public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $feature_status) { $this->userPermsService = $user_perms_service; $this->currentUser = $account_proxy->getAccount(); - $this->outreachFeatureToggle = $feature_status; + $this->outreachCheckboxEnabled = $feature_status->getStatus(self::OUTREACH_CHECKBOX_FEATURE_NAME); } /** @@ -117,7 +117,7 @@ protected function outreachHubOnlyUser(): bool { */ public function entityPresave(EntityPresaveEvent $event): void { $entity = $event->getEntity(); - if ($entity instanceof NodeInterface && $this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) { + if ($entity instanceof NodeInterface) { $this->addToNationalOutreachCalendar($entity); } } @@ -150,7 +150,7 @@ public function alterEventNodeForm(FormIdAlterEvent $event): void { * @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)) { + 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(); @@ -175,7 +175,7 @@ public function addToNationalOutreachCalendar(NodeInterface $node): void { * The form array. */ public function modifyAddToOutreachCalendarElements(array &$form) :void { - if ($this->outreachHubOnlyUser() && $this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) { + if ($this->outreachHubOnlyUser() && $this->outreachCheckboxEnabled) { // Disable the checkbox. $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE; // Set the default value of the checkbox. @@ -193,9 +193,8 @@ public function modifyAddToOutreachCalendarElements(array &$form) :void { 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']; } - if (!$this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) { - $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE; - } + // Disable the checkbox element until the feature toggle is on. + $form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = $this->outreachCheckboxEnabled; } /** From 653dbbf35d6c2b05c33d243786841f37ac33d0fd Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 6 Oct 2023 09:09:50 -0700 Subject: [PATCH 19/23] VACMS-10089: Disable some tests that rely on a feature toggle being set. --- .../integration/features/content_type/event.feature | 11 ++++++----- .../step_definitions/common/i_create_a_node.js | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index 0e53238dbd..133f6283c7 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -93,8 +93,9 @@ Feature: Content Type: 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 roles "office_content_creator, content_publisher" - When my workbench access sections are set to "7" - And I am at "node/add/event" - Then I should see "This event will automatically be published to the National Outreach Calendar" +# Commented out until the `feature_event_outreach_checkbox` feature toggle is removed. +# 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 roles "office_content_creator, content_publisher" +# When my workbench access sections are set to "7" +# And I am at "node/add/event" +# Then I should see "This event will automatically be published to the National Outreach Calendar" 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..21107aad08 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 @@ -280,7 +280,9 @@ 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"); + // Removing this step until the `feature_event_outreach_checkbox` is + // removed. + // 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(); From a2c7fbbbbfcb90f243cdba63eaffa0b5b95a84fc Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Fri, 6 Oct 2023 12:49:55 -0700 Subject: [PATCH 20/23] VACMS-10089: Towards the feature cypress test --- .../features/content_type/event.feature | 15 ++++++++------- .../common/i_set_a_feature_toggle.js | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 tests/cypress/integration/step_definitions/common/i_set_a_feature_toggle.js diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index 133f6283c7..5cce70bfdd 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -92,10 +92,11 @@ 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" - -# Commented out until the `feature_event_outreach_checkbox` feature toggle is removed. -# 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 roles "office_content_creator, content_publisher" -# When my workbench access sections are set to "7" -# And I am at "node/add/event" -# Then I should see "This event will automatically be published to the National Outreach Calendar" + # Commented out until the `feature_event_outreach_checkbox` feature toggle is removed. + 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 "admin" role + And I set feature toggle "feature_event_outreach_checkbox" is "on" + And I am logged in as a user with the roles "office_content_creator, content_publisher" + When my workbench access sections are set to "7" + And I am at "node/add/event" + Then I should see "This event will automatically be published to the National Outreach Calendar" 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 new file mode 100644 index 0000000000..380888f59f --- /dev/null +++ b/tests/cypress/integration/step_definitions/common/i_set_a_feature_toggle.js @@ -0,0 +1,6 @@ +import { When } from "@badeball/cypress-cucumber-preprocessor"; + +When("I set a {string} feature toggle to {string}", (featureToggleMachineName, value) => { + + } +); From 17ffcdea113ba4c047f87882eb53596f35d9f3d3 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 6 Oct 2023 14:07:25 -0700 Subject: [PATCH 21/23] VACMS-10089: More cypress. --- .../features/content_type/event.feature | 67 ++----------------- .../common/i_set_a_feature_toggle.js | 14 +++- 2 files changed, 16 insertions(+), 65 deletions(-) diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index 5cce70bfdd..4e348bf8aa 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -34,69 +34,12 @@ Feature: Content Type: Event 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 - 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 - When 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" - When I select option "Apply" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - When I select option "RSVP" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - When I select option "More Details" from dropdown "Call to action" - Then I should see an element with the selector "#edit-field-link-0-uri" - When 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" # Commented out until the `feature_event_outreach_checkbox` feature toggle is removed. 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 "admin" role - And I set feature toggle "feature_event_outreach_checkbox" is "on" - And I am logged in as a user with the roles "office_content_creator, content_publisher" - When my workbench access sections are set to "7" + 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" Then I should see "This event will automatically be published to the National Outreach Calendar" 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 index 380888f59f..3cc671bc62 100644 --- 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 @@ -1,6 +1,14 @@ import { When } from "@badeball/cypress-cucumber-preprocessor"; -When("I set a {string} feature toggle to {string}", (featureToggleMachineName, value) => { - +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 93534027e09812938a4faae96ac0b76dc171d39f Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Fri, 6 Oct 2023 14:29:55 -0700 Subject: [PATCH 22/23] VACMS-10089: Finish cypress tests woot --- tests/cypress/integration/features/content_type/event.feature | 4 +++- .../integration/step_definitions/common/i_create_a_node.js | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index 4e348bf8aa..e229f0d88c 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -2,6 +2,9 @@ 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 @@ -34,7 +37,6 @@ Feature: Content Type: Event 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 - # Commented out until the `feature_event_outreach_checkbox` feature toggle is removed. 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" 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 21107aad08..ff6578e57a 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 @@ -280,9 +280,7 @@ 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"); - // Removing this step until the `feature_event_outreach_checkbox` is - // removed. - // cy.get(".node__content").contains("Outreach events"); + 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(); From bbeab5246c100174707cbce350b25d488ec200ec Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Fri, 6 Oct 2023 14:41:32 -0700 Subject: [PATCH 23/23] VACMS-10089: Remove redundant media upload test --- .../integration/features/platform/file_upload.feature | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 tests/cypress/integration/features/platform/file_upload.feature diff --git a/tests/cypress/integration/features/platform/file_upload.feature b/tests/cypress/integration/features/platform/file_upload.feature deleted file mode 100644 index e3e3cc71a6..0000000000 --- a/tests/cypress/integration/features/platform/file_upload.feature +++ /dev/null @@ -1,11 +0,0 @@ -@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