From b63e7fd6f61ffeaa369e0b9c0ba2d48459215302 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Thu, 18 Jan 2024 08:59:45 -0800 Subject: [PATCH 1/3] VACMS-16882: Simplify the check for outreach cal field value. --- .../va_gov_content_types/src/Traits/EventOutreachTrait.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docroot/modules/custom/va_gov_content_types/src/Traits/EventOutreachTrait.php b/docroot/modules/custom/va_gov_content_types/src/Traits/EventOutreachTrait.php index 41b2398e48..a604d7afee 100644 --- a/docroot/modules/custom/va_gov_content_types/src/Traits/EventOutreachTrait.php +++ b/docroot/modules/custom/va_gov_content_types/src/Traits/EventOutreachTrait.php @@ -46,10 +46,11 @@ public function addToNationalOutreachCalendar(EventInterface $node): void { if ($node->hasField(EventOutreachInterface::LISTING_FIELD) && $node->hasField(EventOutreachInterface::PUBLISH_TO_OUTREACH_CAL_FIELD) && $node->hasField(EventOutreachInterface::ADDITIONAL_LISTING_FIELD)) { - $addToCalValue = $node->get(EventOutreachInterface::PUBLISH_TO_OUTREACH_CAL_FIELD)->first()->getValue(); - if (isset($addToCalValue['value'])) { + if ($node->get(EventOutreachInterface::PUBLISH_TO_OUTREACH_CAL_FIELD)->first()) { + $addToCalValue = $node->get(EventOutreachInterface::PUBLISH_TO_OUTREACH_CAL_FIELD)->first()->getValue(); $listings = $node->get(EventOutreachInterface::LISTING_FIELD)->getValue(); $additionalListings = $node->get(EventOutreachInterface::ADDITIONAL_LISTING_FIELD)->getValue(); + assert(array_key_exists('value', $addToCalValue)); if ($addToCalValue['value'] === 1 || $this->outreachHubOnlyUser()) { // Add to Outreach calendar selected, or user is Outreach Hub only // user. From 746d65ef7eb47a67aefae06390e21e6a327cee03 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 19 Jan 2024 14:09:37 -0800 Subject: [PATCH 2/3] VACMS-16882: Adds the 'I feature the content' step definition. --- .../step_definitions/common/i_feature_the_content.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/cypress/integration/step_definitions/common/i_feature_the_content.js diff --git a/tests/cypress/integration/step_definitions/common/i_feature_the_content.js b/tests/cypress/integration/step_definitions/common/i_feature_the_content.js new file mode 100644 index 0000000000..4e3fcb8d23 --- /dev/null +++ b/tests/cypress/integration/step_definitions/common/i_feature_the_content.js @@ -0,0 +1,5 @@ +import { Given } from "@badeball/cypress-cucumber-preprocessor"; + +Given("I feature the content", () => { + cy.get("#edit-field-featured-value").check({ force: true }); +}); From 60f470011531853cca7b515154eb4ca2b7998aa7 Mon Sep 17 00:00:00 2001 From: Daniel Sasser Date: Fri, 19 Jan 2024 14:19:16 -0800 Subject: [PATCH 3/3] VACMS-16882: Adds test for creating featured events. --- .../integration/features/content_type/event.feature | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/cypress/integration/features/content_type/event.feature b/tests/cypress/integration/features/content_type/event.feature index b4779d0e4a..8f5496374b 100644 --- a/tests/cypress/integration/features/content_type/event.feature +++ b/tests/cypress/integration/features/content_type/event.feature @@ -144,3 +144,11 @@ Feature: Content Type: Event Given I am logged in as a user with the "content_admin" role When I am at "node/add/event" Then an element with the selector "#edit-field-datetime-range-timezone-wrapper button.tabledrag-toggle-weight" should not exist + + Scenario: Confirm creating "Featured" Events is possible. + Given I am logged in as a user with the "content_admin" role + And I create a "event" node and continue + And I fill in field with selector "#edit-revision-log-0-value" with fake text + And I feature the content + When I save the node + Then I should see "has been updated."