From 12502078d8b64c7ea3c739b76c2463a43dd06b6d Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Thu, 27 Jun 2024 12:34:17 -0400 Subject: [PATCH 01/52] PXBF-1453-content-translations-zero-ben: updated english content values for zero benefits view --- benefit-finder/src/shared/locales/en/en.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benefit-finder/src/shared/locales/en/en.json b/benefit-finder/src/shared/locales/en/en.json index da134b877..2b60274a0 100644 --- a/benefit-finder/src/shared/locales/en/en.json +++ b/benefit-finder/src/shared/locales/en/en.json @@ -107,10 +107,10 @@ }, "zeroBenefits": { "chevron": { - "heading": "You are likely not eligible for benefits", - "description": "

If you reached these results by mistake, please go back to review your answers.

" + "heading": "You are likely not eligible for these benefits.", + "description": "

If you reached these results by mistake, please go back to review your answers.

" }, - "heading": "No eligible results", + "heading": "No eligible results.", "description": "Based on your answers you are likely not eligible for benefits. You may become eligible if you enter more information or your situation changes.", "cta": "See all benefits" }, From cdb9137a5dfd14e5ef9a711e27e078edd9d4b923 Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Thu, 27 Jun 2024 12:34:29 -0400 Subject: [PATCH 02/52] PXBF-1453-content-translations-zero-ben: include translation values for zero benefits view --- benefit-finder/src/shared/locales/es/es.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/benefit-finder/src/shared/locales/es/es.json b/benefit-finder/src/shared/locales/es/es.json index 74873b516..02afd10e3 100644 --- a/benefit-finder/src/shared/locales/es/es.json +++ b/benefit-finder/src/shared/locales/es/es.json @@ -105,6 +105,15 @@ "heading": "Resultados", "description": "Según sus respuestas no es elegible para estos beneficios. Podría calificar si tiene información adicional o si su situación cambia." }, + "zeroBenefits": { + "chevron": { + "heading": "Usted parece no ser elegible para estos beneficios.", + "description": "

Si cree que cometió un error, por favor regrese para corregir sus respuestas.

" + }, + "heading": "No tiene resultados elegibles.", + "description": "Basado en sus respuestas usted no es elegible para estos beneficios. Podría ser elegible si ingresa más información o si su situación cambia.", + "cta": "Ver todos los beneficios" + }, "stepBackLink": "Volver", "eligibleResults": { "heading": "Resultados", From b079fc6dd61b231882c3ad9627ef6e21ea8e1575 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 10:02:26 -0400 Subject: [PATCH 03/52] PXBF-1514-update-result-view-value: new appended value for bf-resultview --- .../src/shared/utils/dataLayerUtils/dataLayerStructure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index 428d5c226..015123053 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -26,7 +26,7 @@ const dataLayerStructure = { resultsView: { event: 'bf_page_change', bfData: { - pageView: 'bf-result-view', + pageView: ['bf-result-eligible-view', 'bf-result-not-eligible-view'], viewTitle: null, viewState: [ 'bf-not-eligible-view', From 9086834b41cc3f8152e18b285c61c0e7c0402d46 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 10:02:51 -0400 Subject: [PATCH 04/52] PXBF-1514-update-result-view-value: toggle page view value based on notEligibleview state --- benefit-finder/src/shared/components/ResultsView/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/benefit-finder/src/shared/components/ResultsView/index.jsx b/benefit-finder/src/shared/components/ResultsView/index.jsx index 8b23dac69..138d6c034 100644 --- a/benefit-finder/src/shared/components/ResultsView/index.jsx +++ b/benefit-finder/src/shared/components/ResultsView/index.jsx @@ -114,7 +114,10 @@ const ResultsView = ({ dataLayerUtils.dataLayerPush(window, { event: resultsView.event, bfData: { - pageView: resultsView.bfData.pageView, + pageView: + notEligibleView === true + ? resultsView.bfData.pageView[1] + : resultsView.bfData.pageView[0], viewTitle: notEligibleView === false ? (zeroBenefitsResult && zeroBenefits.chevron.heading) || From 56327ea8e606c3456480cfecfb39e2537c91fa6f Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 10:14:14 -0400 Subject: [PATCH 05/52] PXBF-1514-update-result-view-value: update cypress test to accept index value --- benefit-finder/cypress/e2e/storybook/dataLayer.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js index 19091367c..b8dfc0104 100644 --- a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js +++ b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js @@ -26,7 +26,7 @@ const dataLayerValues = [ { event: resultsView.event, bfData: { - pageView: resultsView.bfData.pageView, + pageView: resultsView.bfData.pageView[1], viewTitle: 'Your potential benefits', viewState: resultsView.bfData.viewState[1], }, From 76a7b710f54fd323e810ec57c410029607377565 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 10:44:58 -0400 Subject: [PATCH 06/52] PXBF-1514-update-result-view-value: update dataLayer index --- benefit-finder/cypress/e2e/storybook/dataLayer.cy.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js index b8dfc0104..2add359e1 100644 --- a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js +++ b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js @@ -26,7 +26,7 @@ const dataLayerValues = [ { event: resultsView.event, bfData: { - pageView: resultsView.bfData.pageView[1], + pageView: resultsView.bfData.pageView[0], viewTitle: 'Your potential benefits', viewState: resultsView.bfData.viewState[1], }, @@ -111,7 +111,7 @@ describe('Calls to Google Analytics Object', function () { .then(() => { // we wait for the last event to fire // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(100).then(() => { + cy.wait(1000).then(() => { // check last page change event const ev = { ...window.dataLayer.filter( @@ -120,6 +120,9 @@ describe('Calls to Google Analytics Object', function () { } delete ev[0]['gtm.uniqueEventId'] + cy.log(resultsView.bfData.pageView[1]) + cy.log(dataLayerValues[2]) + expect(dataLayerValues[2]).to.deep.equal(ev[0]) // // check count event From 45cf20429cb19ea2db1640c2438a3f53fa1fe360 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 10:56:41 -0400 Subject: [PATCH 07/52] PXBF-1516-update-benefit-event-values: update benefitClick to benefitAccordion and its event value --- benefit-finder/src/shared/components/Accordion/index.jsx | 4 ++-- .../src/shared/utils/dataLayerUtils/dataLayerStructure.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/benefit-finder/src/shared/components/Accordion/index.jsx b/benefit-finder/src/shared/components/Accordion/index.jsx index f0cfc316d..cba1a31e5 100644 --- a/benefit-finder/src/shared/components/Accordion/index.jsx +++ b/benefit-finder/src/shared/components/Accordion/index.jsx @@ -39,14 +39,14 @@ const Accordion = ({ */ const [isOpen, setOpen] = useState(false) - const { benefitClick } = dataLayerUtils.dataLayerStructure + const { benefitAccordion } = dataLayerUtils.dataLayerStructure // handle dataLayer const handleOpenClose = isOpen => { setOpen(isOpen) isOpen === true && dataLayerUtils.dataLayerPush(window, { - event: benefitClick.event, + event: benefitAccordion.event, bfData: { benefitTitle: heading, }, diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index 428d5c226..c6625d140 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -36,8 +36,8 @@ const dataLayerStructure = { ], }, }, - benefitClick: { - event: 'bf_benefit_click', + benefitAccordion: { + event: 'bf-accordion-open', bfData: { benefitTitle: null, }, From accf0482e42b6eadadc0feb4f0f96b5cebd2260f Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 10:59:34 -0400 Subject: [PATCH 08/52] PXBF-1516-update-benefit-event-values: update event values to underscores --- .../src/shared/utils/dataLayerUtils/dataLayerStructure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index c6625d140..f4a56abd8 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -37,7 +37,7 @@ const dataLayerStructure = { }, }, benefitAccordion: { - event: 'bf-accordion-open', + event: 'bf_accordion_open', bfData: { benefitTitle: null, }, From 1f537dace2fdd652f885819724da354e26a98cd8 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 11:32:54 -0400 Subject: [PATCH 09/52] PXBF-1516-update-benefit-event-values: allow overide of dedup --- .../src/shared/components/Accordion/index.jsx | 14 +++++++++----- .../shared/utils/dataLayerUtils/dataLayerPush.js | 11 +++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/benefit-finder/src/shared/components/Accordion/index.jsx b/benefit-finder/src/shared/components/Accordion/index.jsx index cba1a31e5..f9fa10d35 100644 --- a/benefit-finder/src/shared/components/Accordion/index.jsx +++ b/benefit-finder/src/shared/components/Accordion/index.jsx @@ -45,12 +45,16 @@ const Accordion = ({ const handleOpenClose = isOpen => { setOpen(isOpen) isOpen === true && - dataLayerUtils.dataLayerPush(window, { - event: benefitAccordion.event, - bfData: { - benefitTitle: heading, + dataLayerUtils.dataLayerPush( + window, + { + event: benefitAccordion.event, + bfData: { + benefitTitle: heading, + }, }, - }) + false + ) } // handle expand all diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js index 79bf5ebf2..1ac74c008 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js @@ -1,4 +1,4 @@ -const dataLayerPush = (w, dataLayerObj, dedup) => { +const dataLayerPush = (w, dataLayerObj, dedup = true) => { const isObject = object => { return object != null && typeof object === 'object' } @@ -31,12 +31,15 @@ const dataLayerPush = (w, dataLayerObj, dedup) => { if (w.dataLayer) { // get the last index of the dataLayer array const lastItem = { ...window.dataLayer[window.dataLayer.length - 1] } - delete lastItem['gtm.uniqueEventId'] - // to prevent pushing duplicate objects unecessarily, as long as our last item doesn't match our current data obj, we push - isDeepEqual(lastItem, dataLayerObj) === false && + if (dedup === true) { + // to prevent pushing duplicate objects unecessarily, as long as our last item doesn't match our current data obj, we push + isDeepEqual(lastItem, dataLayerObj) === false && + w.dataLayer.push(dataLayerObj) + } else { w.dataLayer.push(dataLayerObj) + } } } From 3de1b50ef4a8b4ce9976542c2cc4491524be0746 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 11:56:34 -0400 Subject: [PATCH 10/52] PXBF-1516-new-event-open-all-accordions: new gtm event to track open all interactions on results view --- .../BenefitAccordionGroup/index.jsx | 26 +++++++++++++++++-- .../dataLayerUtils/dataLayerStructure.js | 6 +++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx b/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx index b92f22b0b..7f33e3c76 100644 --- a/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx +++ b/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx @@ -34,7 +34,8 @@ const BenefitAccordionGroup = ({ sourceIsEnglish, } = benefitAccordion const { closedState, openState } = benefitAccordionGroup - const { benefitLink } = dataLayerUtils.dataLayerStructure + const { benefitLink, openAllBenefitAccordions } = + dataLayerUtils.dataLayerStructure /** * a hook that hanldes our open state of the accordions in our group * @function @@ -49,6 +50,7 @@ const BenefitAccordionGroup = ({ */ const handleExpandIcon = isExpandAll ? `${openState} -` : `${closedState} +` + // handle dataLayer /** * a function that pushes dataLayer events when the user clicks the link of that benefit * @function @@ -62,6 +64,26 @@ const BenefitAccordionGroup = ({ }) } + /** + * a function that handles expanded state and pushes dataLayer events when the user clicks the "open all" action + * @function + * @prop {boolean} isExpandAll true or false + */ + const handleExpandAll = isExpandAll => { + setExpandAll(!isExpandAll) + isExpandAll === false && + dataLayerUtils.dataLayerPush( + window, + { + event: openAllBenefitAccordions.event, + bfData: { + accordionsOpen: isExpandAll, + }, + }, + false + ) + } + /** * a functional component that renders a button and controls the expansion of our accordions * @component @@ -74,7 +96,7 @@ const BenefitAccordionGroup = ({ className="bf-expand-all" aria-label={handleExpandIcon} unstyled - onClick={() => setExpandAll(!isExpandAll)} + onClick={() => handleExpandAll(isExpandAll)} > {handleExpandIcon} diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index 428d5c226..702ebe7d1 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -36,6 +36,12 @@ const dataLayerStructure = { ], }, }, + openAllBenefitAccordions: { + event: 'bf_open_all_accordions', + bfData: { + accordionsOpen: false, + }, + }, benefitClick: { event: 'bf_benefit_click', bfData: { From 9707039315d410b8e8f61cf2c2405a776edbabfd Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 15:28:01 -0400 Subject: [PATCH 11/52] PXBF-1516-new-event-open-all-accordions: default datalayer accodionsOpen value --- .../src/shared/utils/dataLayerUtils/dataLayerStructure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index 702ebe7d1..9429dca02 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -39,7 +39,7 @@ const dataLayerStructure = { openAllBenefitAccordions: { event: 'bf_open_all_accordions', bfData: { - accordionsOpen: false, + accordionsOpen: true, }, }, benefitClick: { From 8511b89055f3d07017d308b904c60031b6037a93 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 15:28:33 -0400 Subject: [PATCH 12/52] PXBF-1516-new-event-open-all-accordions: new open all benefits structure and test --- .../cypress/e2e/storybook/dataLayer.cy.js | 63 ++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js index 19091367c..476aaa0a4 100644 --- a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js +++ b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js @@ -5,8 +5,13 @@ import { pageObjects } from '../../support/pageObjects' import * as EN_LOCALE_DATA from '../../../../benefit-finder/src/shared/locales/en/en.json' import * as BENEFITS_ELIBILITY_DATA from '../../fixtures/benefits-eligibility.json' -const { intro, lifeEventSection, resultsView, benefitCount } = - dataLayerUtils.dataLayerStructure +const { + intro, + lifeEventSection, + resultsView, + benefitCount, + openAllBenefitAccordions, +} = dataLayerUtils.dataLayerStructure const dataLayerValues = [ { @@ -39,6 +44,12 @@ const dataLayerValues = [ notEligible: 25, }, }, + { + event: openAllBenefitAccordions.event, + bfData: { + accordionsOpen: openAllBenefitAccordions.bfData.accordionsOpen, + }, + }, ] describe('Basic Data Layer Checks', () => { @@ -136,4 +147,52 @@ describe('Calls to Google Analytics Object', function () { }) }) }) + + it('clicking open all on results page has a bf_open_all_accordions event', function () { + const selectedData = BENEFITS_ELIBILITY_DATA.scenario_1_covid.en.param + const scenario = utils.encodeURIFromObject(selectedData) + cy.visit(`${utils.storybookUri}${scenario}`) + + cy.window().then(window => { + assert.isDefined(window.dataLayer, 'window.dataLayer is defined') + + pageObjects + .expandAll() + .click() + .then(() => { + // we wait for the last event to fire + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(100).then(() => { + // check last page change event + const ev = { + ...window.dataLayer.filter( + x => x?.event === dataLayerValues[4].event + ), + } + delete ev[0]['gtm.uniqueEventId'] + + expect(dataLayerValues[4]).to.deep.equal(ev[0]) + }) + }) + + pageObjects + .expandAll() + .click() + .then(() => { + // we wait for the last event to fire + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(100).then(() => { + // check last page change event + const ev = { + ...window.dataLayer.filter( + x => x?.event === dataLayerValues[4].event + ), + } + delete ev[0]['gtm.uniqueEventId'] + + expect(dataLayerValues[4]).to.not.deep.equal(ev[0]) + }) + }) + }) + }) }) From d5338b6cf3287dba3c905585c3c3609b75e1efc0 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 15:28:49 -0400 Subject: [PATCH 13/52] PXBF-1516-new-event-open-all-accordions: include dedup logic --- .../src/shared/utils/dataLayerUtils/dataLayerPush.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js index 79bf5ebf2..1ac74c008 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerPush.js @@ -1,4 +1,4 @@ -const dataLayerPush = (w, dataLayerObj, dedup) => { +const dataLayerPush = (w, dataLayerObj, dedup = true) => { const isObject = object => { return object != null && typeof object === 'object' } @@ -31,12 +31,15 @@ const dataLayerPush = (w, dataLayerObj, dedup) => { if (w.dataLayer) { // get the last index of the dataLayer array const lastItem = { ...window.dataLayer[window.dataLayer.length - 1] } - delete lastItem['gtm.uniqueEventId'] - // to prevent pushing duplicate objects unecessarily, as long as our last item doesn't match our current data obj, we push - isDeepEqual(lastItem, dataLayerObj) === false && + if (dedup === true) { + // to prevent pushing duplicate objects unecessarily, as long as our last item doesn't match our current data obj, we push + isDeepEqual(lastItem, dataLayerObj) === false && + w.dataLayer.push(dataLayerObj) + } else { w.dataLayer.push(dataLayerObj) + } } } From 867b245d471f59464972e0443e71e3b7e2faded9 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 15:29:20 -0400 Subject: [PATCH 14/52] PXBF-1516-new-event-open-all-accordions: new push event handler on expandAll --- .../BenefitAccordionGroup/index.jsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx b/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx index 7f33e3c76..492e1f791 100644 --- a/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx +++ b/benefit-finder/src/shared/components/BenefitAccordionGroup/index.jsx @@ -71,17 +71,16 @@ const BenefitAccordionGroup = ({ */ const handleExpandAll = isExpandAll => { setExpandAll(!isExpandAll) - isExpandAll === false && - dataLayerUtils.dataLayerPush( - window, - { - event: openAllBenefitAccordions.event, - bfData: { - accordionsOpen: isExpandAll, - }, + dataLayerUtils.dataLayerPush( + window, + { + event: openAllBenefitAccordions.event, + bfData: { + accordionsOpen: !isExpandAll, }, - false - ) + }, + false + ) } /** From 373166a9aa344579196336dd882c535b9f3a8f0c Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 16:23:38 -0400 Subject: [PATCH 15/52] PXBF-1392-handle-codes-prod-link-test: remove old prod config --- benefit-finder/cypress.prod.config.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 benefit-finder/cypress.prod.config.js diff --git a/benefit-finder/cypress.prod.config.js b/benefit-finder/cypress.prod.config.js deleted file mode 100644 index aabff4890..000000000 --- a/benefit-finder/cypress.prod.config.js +++ /dev/null @@ -1,12 +0,0 @@ -const { defineConfig } = require('cypress') - -module.exports = defineConfig({ - retries: { - runMode: 2, - openMode: 0, - }, - e2e: { - baseUrl: 'https://www.usa.gov', - specPattern: 'cypress/e2e/usagov-public-site/*.cy.js' - }, -}) From f2829eb3ad36d7c073644166207c0f486d71053f Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 16:23:54 -0400 Subject: [PATCH 16/52] PXBF-1392-handle-codes-prod-link-test: update prod links test to use new links prod links confir --- .github/workflows/test-cypress-prod-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-cypress-prod-links.yml b/.github/workflows/test-cypress-prod-links.yml index 4d1e036dd..9691138f5 100644 --- a/.github/workflows/test-cypress-prod-links.yml +++ b/.github/workflows/test-cypress-prod-links.yml @@ -30,7 +30,7 @@ jobs: with: browser: chrome env: NODE_ENV=test - config-file: cypress.prod.config.js + config-file: cypress.prod.links.config.js working-directory: benefit-finder - name: create github issue From 64b155e1823744623849711ffc1e2c07dedf57a5 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 16:24:12 -0400 Subject: [PATCH 17/52] PXBF-1392-handle-codes-prod-link-test: update node scrit to use prod links config --- benefit-finder/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefit-finder/package.json b/benefit-finder/package.json index 4c59003bb..6013308c5 100644 --- a/benefit-finder/package.json +++ b/benefit-finder/package.json @@ -32,7 +32,7 @@ "cy:run:component": "NODE_ENV=test npx cypress run --component --browser chrome", "cy:run:e2e": "NODE_ENV=test npx cypress run --browser chrome", "cy:run": "NODE_ENV=test npm run cy:run:component && npm run cy:run:e2e", - "cy:run:prod:e2e": "NODE_ENV=test npx cypress run --config-file cypress.prod.config.js --browser chrome", + "cy:run:prod:e2e": "NODE_ENV=test npx cypress run --config-file cypress.prod.links.config.js --browser chrome", "cy:run:prod:links:e2e": "NODE_ENV=test npx cypress run --config-file cypress.prod.links.config.js --browser chrome", "cy:run:pipeline": "NODE_ENV=test concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"http-server ./storybook-static --port 6006 --silent\" -Y", "cy:run:edge:e2e": "NODE_ENV=test npx cypress run --browser edge", From f6deaea4515f08324b3e182c675017ad773823ec Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 16:24:57 -0400 Subject: [PATCH 18/52] PXBF-1392-handle-codes-prod-link-test: refactor code to structure locales and implement functional programing with validating error codes, and links validation run --- .../e2e/usagov-public-site/links.cy.js | 102 +++++++++--------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index 496485c77..61172fffb 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -1,64 +1,68 @@ import * as utils from '../../support/utils' import * as BENEFITS_ELIBILITY_DATA from '../../fixtures/benefits-eligibility.json' -describe('Verify correct status code when user navigates links', () => { - // to be removed when uncaught exceptions are addressed - Cypress.on('uncaught:exception', (_err, runnable) => { - return false - }) - it('Verify success status code response for links in Death of a loved one English page', () => { - const selectedData = - BENEFITS_ELIBILITY_DATA['death-of-a-loved-one'].en.param - const scenario = utils.encodeURIFromObject(selectedData) - cy.visit(`benefit-finder/death?${scenario}`) - cy.get('main a[href]').each(link => { - cy.request(link.prop('href')) - }) - }) +const localePaths = { + en: [ + { key: 'death-of-a-loved-one', path: 'death' }, + { key: 'retirement', path: 'retirement' }, + { key: 'disability', path: 'disability' }, + ], + es: [ + { key: 'death-of-a-loved-one', path: 'muerte' }, + { key: 'retirement', path: 'jubilacion' }, + { key: 'disability', path: 'discapacidad' }, + ], +} - it('Verify success status code response for links in Death of a Loved One Spanish page', () => { - const selectedData = - BENEFITS_ELIBILITY_DATA['death-of-a-loved-one'].es.param - const scenario = utils.encodeURIFromObject(selectedData) - cy.visit(`es/buscador-beneficios/muerte?${scenario}`) - cy.get('main a[href]').each(link => { - cy.request(link.prop('href')) - }) +const validateErrorCodes = () => { + // we verify site is alive and fail on 404 || 503 + cy.get('#benefit-finder a[href]').each(link => { + cy.request({ url: link.prop('href'), failOnStatusCode: false }).then( + response => { + if (response.status === 200) { + expect(response.status).to.eq(200) + } else if (response.status === 403) { + cy.get('body').children().its('length').should('be.gt', 0) + } else if (response.status === 503) { + throw new Error('site down - gave a 503') + } else if (response.status === 404) { + throw new Error('page not found - gave a 404') + } else { + cy.get('body').children().its('length').should('be.gt', 0) + } + } + ) }) +} - it('Verify success status code response for links in Retirement English page', () => { - const selectedData = BENEFITS_ELIBILITY_DATA.retirement.en.param - const scenario = utils.encodeURIFromObject(selectedData) - cy.visit(`benefit-finder/retirement?${scenario}`) - cy.get('main a[href]').each(link => { - cy.request(link.prop('href')) - }) - }) +const validateLinks = ({ selectedData, path }) => { + console.log(selectedData, path) + const scenario = utils.encodeURIFromObject(selectedData) + cy.visit(`${path}?${scenario}`) + validateErrorCodes() +} - it('Verify success status code response for links in Retirement Spanish page', () => { - const selectedData = BENEFITS_ELIBILITY_DATA.retirement.es.param - const scenario = utils.encodeURIFromObject(selectedData) - cy.visit(`es/buscador-beneficios/jubilacion?${scenario}`) - cy.get('main a[href]').each(link => { - cy.request(link.prop('href')) - }) +describe('Verify correct status code when user navigates links in each locales', () => { + // to be removed when uncaught exceptions are addressed + Cypress.on('uncaught:exception', (_err, runnable) => { + return false }) - it('Verify success status code response for links in Disability English page', () => { - const selectedData = BENEFITS_ELIBILITY_DATA.disability.en.param - const scenario = utils.encodeURIFromObject(selectedData) - cy.visit(`benefit-finder/disability?${scenario}`) - cy.get('main a[href]').each(link => { - cy.request(link.prop('href')) + localePaths.en.forEach(location => { + it(`Verify success status code response for links in ${location.key} en page`, () => { + validateLinks({ + selectedData: BENEFITS_ELIBILITY_DATA[`${location.key}`].en.param, + path: `benefit-finder/${location.path}`, + }) }) }) - it('Verify success status code response for links in Disability English page', () => { - const selectedData = BENEFITS_ELIBILITY_DATA.disability.es.param - const scenario = utils.encodeURIFromObject(selectedData) - cy.visit(`es/buscador-beneficios/discapacidad?${scenario}`) - cy.get('main a[href]').each(link => { - cy.request(link.prop('href')) + localePaths.es.forEach(location => { + it(`Verify success status code response for links in ${location.key} es page`, () => { + validateLinks({ + selectedData: BENEFITS_ELIBILITY_DATA[`${location.key}`].en.param, + path: `es/buscador-beneficios/${location.path}`, + }) }) }) }) From 61d7e082e6b0487006c694ace6433f43980ee6a5 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 17:43:14 -0400 Subject: [PATCH 19/52] PXBF-1392-handle-codes-prod-link-test: set up negative validations before we run tests --- .../e2e/usagov-public-site/links.cy.js | 68 ++++++++++++++----- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index 61172fffb..035dcc9c6 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -14,24 +14,31 @@ const localePaths = { ], } -const validateErrorCodes = () => { +const handlerequest = ({ testLink, link }) => { + return cy + .request({ + url: testLink || link.prop('href'), + failOnStatusCode: false, + }) + .then(response => { + if (response.status === 200) { + expect(response.status).to.eq(200) + } else if (response.status === 403) { + cy.get('body').children().its('length').should('be.gt', 0) + } else if (response.status === 503) { + throw new Error('site down - gave a 503') + } else if (response.status === 404) { + throw new Error('page not found - gave a 404') + } else { + cy.get('body').children().its('length').should('be.gt', 0) + } + }) +} + +const validateErrorCodes = test => { // we verify site is alive and fail on 404 || 503 cy.get('#benefit-finder a[href]').each(link => { - cy.request({ url: link.prop('href'), failOnStatusCode: false }).then( - response => { - if (response.status === 200) { - expect(response.status).to.eq(200) - } else if (response.status === 403) { - cy.get('body').children().its('length').should('be.gt', 0) - } else if (response.status === 503) { - throw new Error('site down - gave a 503') - } else if (response.status === 404) { - throw new Error('page not found - gave a 404') - } else { - cy.get('body').children().its('length').should('be.gt', 0) - } - } - ) + handlerequest({ link }) }) } @@ -42,6 +49,35 @@ const validateLinks = ({ selectedData, path }) => { validateErrorCodes() } +describe('Verify correct status code handling', () => { + // negate validation on our code function + it(`handles 404 with an error`, () => { + Cypress.on('fail', error => { + expect(error).to.not.be.undefined + }) + handlerequest({ testLink: 'https://httpstat.us/404' }) + }) + + it(`handles 503 with an error`, () => { + Cypress.on('fail', error => { + expect(error).to.not.be.undefined + }) + handlerequest({ testLink: 'https://httpstat.us/503' }) + }) + + it(`handles 200 successfully`, () => { + handlerequest({ testLink: 'https://httpstat.us/200' }) + }) + + it(`handles any 403 successfully`, () => { + handlerequest({ testLink: 'https://httpstat.us/403' }) + }) + + it(`handles any other request successfully`, () => { + handlerequest({ testLink: 'https://httpstat.us/201' }) + }) +}) + describe('Verify correct status code when user navigates links in each locales', () => { // to be removed when uncaught exceptions are addressed Cypress.on('uncaught:exception', (_err, runnable) => { From dcaf3883f4ff2bc62ff630ae3e93553ea29fd05f Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 18:17:14 -0400 Subject: [PATCH 20/52] PXBF-1392-handle-codes-prod-link-test: only ignore errors when meaning to, and include url with thrown errors --- .../e2e/usagov-public-site/links.cy.js | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index 035dcc9c6..f3add573b 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -15,9 +15,10 @@ const localePaths = { } const handlerequest = ({ testLink, link }) => { + const url = testLink || link.prop('href') return cy .request({ - url: testLink || link.prop('href'), + url, failOnStatusCode: false, }) .then(response => { @@ -26,9 +27,9 @@ const handlerequest = ({ testLink, link }) => { } else if (response.status === 403) { cy.get('body').children().its('length').should('be.gt', 0) } else if (response.status === 503) { - throw new Error('site down - gave a 503') + throw new Error(`site down - gave a 503 ${url}`) } else if (response.status === 404) { - throw new Error('page not found - gave a 404') + throw new Error(`page not found - gave a 404 ${url}`) } else { cy.get('body').children().its('length').should('be.gt', 0) } @@ -49,19 +50,26 @@ const validateLinks = ({ selectedData, path }) => { validateErrorCodes() } +// to be removed when uncaught exceptions are addressed +Cypress.on('uncaught:exception', (error, runnable) => { + return false +}) + describe('Verify correct status code handling', () => { - // negate validation on our code function - it(`handles 404 with an error`, () => { - Cypress.on('fail', error => { + // negate validation on our functional code + Cypress.on('fail', (error, runnable) => { + if (JSON.stringify(error).includes('httpstat')) { expect(error).to.not.be.undefined - }) + } else { + throw error + } + }) + + it(`handles 404 with an error`, () => { handlerequest({ testLink: 'https://httpstat.us/404' }) }) it(`handles 503 with an error`, () => { - Cypress.on('fail', error => { - expect(error).to.not.be.undefined - }) handlerequest({ testLink: 'https://httpstat.us/503' }) }) @@ -79,11 +87,6 @@ describe('Verify correct status code handling', () => { }) describe('Verify correct status code when user navigates links in each locales', () => { - // to be removed when uncaught exceptions are addressed - Cypress.on('uncaught:exception', (_err, runnable) => { - return false - }) - localePaths.en.forEach(location => { it(`Verify success status code response for links in ${location.key} en page`, () => { validateLinks({ From e7061a49b0841be5514f6669690b281df7007913 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 21:57:11 -0400 Subject: [PATCH 21/52] PXBF-1392-handle-codes-prod-link-test: remove log --- benefit-finder/cypress/e2e/usagov-public-site/links.cy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index f3add573b..d23a15540 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -44,7 +44,6 @@ const validateErrorCodes = test => { } const validateLinks = ({ selectedData, path }) => { - console.log(selectedData, path) const scenario = utils.encodeURIFromObject(selectedData) cy.visit(`${path}?${scenario}`) validateErrorCodes() From 1364b69efb803f337fa5cda16b58d6c38be6f365 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Mon, 1 Jul 2024 22:11:02 -0400 Subject: [PATCH 22/52] PXBF-1516-new-event-open-all-accordions: remove wait values in open all test --- .../cypress/e2e/storybook/dataLayer.cy.js | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js index 3563d5d05..96770f508 100644 --- a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js +++ b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js @@ -163,38 +163,31 @@ describe('Calls to Google Analytics Object', function () { .expandAll() .click() .then(() => { - // we wait for the last event to fire - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(100).then(() => { - // check last page change event - const ev = { - ...window.dataLayer.filter( - x => x?.event === dataLayerValues[4].event - ), - } - delete ev[0]['gtm.uniqueEventId'] - - expect(dataLayerValues[4]).to.deep.equal(ev[0]) - }) + // check last page change event + const ev = { + ...window.dataLayer.filter( + x => x?.event === dataLayerValues[4].event + ), + } + delete ev[0]['gtm.uniqueEventId'] + + expect(dataLayerValues[4]).to.deep.equal(ev[0]) }) pageObjects .expandAll() .click() .then(() => { - // we wait for the last event to fire - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(100).then(() => { - // check last page change event - const ev = { - ...window.dataLayer.filter( - x => x?.event === dataLayerValues[4].event - ), - } - delete ev[0]['gtm.uniqueEventId'] - - expect(dataLayerValues[4]).to.not.deep.equal(ev[0]) - }) + // check last page change event + const ev = { + ...window.dataLayer.filter( + x => x?.event === dataLayerValues[4].event + ), + } + // we ignore dedup here so there can be multiple fires + delete ev[1]['gtm.uniqueEventId'] + + expect(dataLayerValues[4]).to.not.deep.equal(ev[1]) }) }) }) From 0b8cfb8793edbafd7ee2fb824905f2b092379584 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 10:18:52 -0400 Subject: [PATCH 23/52] Update thog, add some features --- .github/workflows/thog_scan.yml | 47 ++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index 89c0b6f0c..a2741b160 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -1,8 +1,6 @@ name: TruffleHog Scan on: - # schedule: - # - cron: '0 8 * * *' # Runs daily at 8 AM UTC workflow_dispatch: jobs: @@ -15,15 +13,56 @@ jobs: with: fetch-depth: 0 - - name: scan + - name: Install GitHub CLI + run: | + sudo apt-get update + sudo apt-get install -y gh + + - name: Authenticate GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + + - name: Run TruffleHog scan + id: trufflehog_scan uses: trufflesecurity/trufflehog@main with: base: "" head: ${{ github.ref_name }} - extra_args: --only-verified + extra_args: --only-verified --json --entropy=True --max-depth=10 + continue-on-error: true - name: Upload TruffleHog scan results + if: always() uses: actions/upload-artifact@v3 with: name: trufflehog-results path: truffleHogResults.json + + - name: Convert JSON to Readable Report + if: always() + run: | + jq -r '.results[] | "File: \(.path)\nCommit: \(.commit)\nDate: \(.date)\nReason: \(.reason)\n---------------------------"' truffleHogResults.json > truffleHogReport.txt + + - name: Upload Readable Report + if: always() + uses: actions/upload-artifact@v3 + with: + name: trufflehog-readable-report + path: truffleHogReport.txt + + - name: Check for findings and create issue + if: failure() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if jq -e '.results | length > 0' truffleHogResults.json > /dev/null; then + echo "Secrets found. Creating GitHub issue." + gh issue create --title "TruffleHog Scan Results" --body "$(cat truffleHogReport.txt)" --label "bug,security" --assignee "@me" + exit 1 + fi + + - name: Fail the job if any secrets are found + if: steps.trufflehog_scan.outcome == 'failure' + run: exit 1 From d983cf5e2ddfdc2ebb06ca8375fb9cbb97b8e54c Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 10:22:01 -0400 Subject: [PATCH 24/52] Update thog, add some features 2 --- .github/workflows/thog_scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index a2741b160..be574b85b 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -20,9 +20,9 @@ jobs: - name: Authenticate GitHub CLI env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} run: | - echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + echo "${{ secrets.ADD_TO_PROJECT_PAT }}" | gh auth login --with-token - name: Run TruffleHog scan id: trufflehog_scan @@ -55,7 +55,7 @@ jobs: - name: Check for findings and create issue if: failure() env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} run: | if jq -e '.results | length > 0' truffleHogResults.json > /dev/null; then echo "Secrets found. Creating GitHub issue." From c969cd38a062c7fa03f4d441dfafa7acc56ad014 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 10:30:43 -0400 Subject: [PATCH 25/52] Update thog, add some features 3 --- .github/workflows/thog_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index be574b85b..70603326f 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -22,7 +22,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} run: | - echo "${{ secrets.ADD_TO_PROJECT_PAT }}" | gh auth login --with-token + gh auth setup-git - name: Run TruffleHog scan id: trufflehog_scan From cae5b17962c9fcee4f14213a9a82b1f2621681fd Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 10:38:24 -0400 Subject: [PATCH 26/52] Update thog, add some features 4 --- .github/workflows/thog_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index 70603326f..3c47d8fe9 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -26,7 +26,7 @@ jobs: - name: Run TruffleHog scan id: trufflehog_scan - uses: trufflesecurity/trufflehog@main + uses: trufflesecurity/trufflehog@v3.79.0 with: base: "" head: ${{ github.ref_name }} From f22347f517860a1b6756f07eb9ef4344d27a0c8e Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 10:41:12 -0400 Subject: [PATCH 27/52] Update thog, add some features 5 --- .github/workflows/thog_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index 3c47d8fe9..8e14fbe57 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -30,7 +30,7 @@ jobs: with: base: "" head: ${{ github.ref_name }} - extra_args: --only-verified --json --entropy=True --max-depth=10 + extra_args: --only-verified --json --entropy --max-depth=10 continue-on-error: true - name: Upload TruffleHog scan results From 6ea652d48d1e9af4a6f4ad454191dff90194078a Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 10:45:24 -0400 Subject: [PATCH 28/52] Update thog, add some features 6 --- .github/workflows/thog_scan.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index 8e14fbe57..d2112eba2 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -33,6 +33,11 @@ jobs: extra_args: --only-verified --json --entropy --max-depth=10 continue-on-error: true + - name: Show me files + run: | + ls -la + pwd + - name: Upload TruffleHog scan results if: always() uses: actions/upload-artifact@v3 From f8f91ef7d89d933a57505137af67409ecf292698 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 11:09:31 -0400 Subject: [PATCH 29/52] Update thog, add some features 7 --- .github/workflows/thog_scan.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index d2112eba2..c0683a75f 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -33,32 +33,36 @@ jobs: extra_args: --only-verified --json --entropy --max-depth=10 continue-on-error: true - - name: Show me files + - name: Check TruffleHog Results + id: check_results run: | - ls -la - pwd + if [ -f truffleHogResults.json ]; then + echo "file_exists=true" >> $GITHUB_ENV + else + echo "file_exists=false" >> $GITHUB_ENV + fi - name: Upload TruffleHog scan results - if: always() + if: always() && env.file_exists == 'true' uses: actions/upload-artifact@v3 with: name: trufflehog-results path: truffleHogResults.json - name: Convert JSON to Readable Report - if: always() + if: always() && env.file_exists == 'true' run: | jq -r '.results[] | "File: \(.path)\nCommit: \(.commit)\nDate: \(.date)\nReason: \(.reason)\n---------------------------"' truffleHogResults.json > truffleHogReport.txt - name: Upload Readable Report - if: always() + if: always() && env.file_exists == 'true' uses: actions/upload-artifact@v3 with: name: trufflehog-readable-report path: truffleHogReport.txt - name: Check for findings and create issue - if: failure() + if: failure() && env.file_exists == 'true' env: GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} run: | @@ -66,6 +70,8 @@ jobs: echo "Secrets found. Creating GitHub issue." gh issue create --title "TruffleHog Scan Results" --body "$(cat truffleHogReport.txt)" --label "bug,security" --assignee "@me" exit 1 + else + echo "No secrets found or no results file." fi - name: Fail the job if any secrets are found From e5ae1b4eeabb488bf84b8f7b86d0fe6f26366409 Mon Sep 17 00:00:00 2001 From: gchi25 Date: Tue, 2 Jul 2024 11:15:43 -0400 Subject: [PATCH 30/52] PXBF-1525-clean-benefit-finder-configuration: remove benefit finder configuration --- ...orm_display.node.bears_benefit.default.yml | 191 ---------------- ...rm_display.node.bears_criteria.default.yml | 210 ------------------ ..._display.node.bears_life_event.default.yml | 209 ----------------- ...iew_display.node.bears_benefit.default.yml | 122 ---------- ...view_display.node.bears_benefit.teaser.yml | 41 ---- ..._display.node.bears_life_event.default.yml | 138 ------------ ...w_display.node.bears_life_event.teaser.yml | 50 ----- ...field.node.bears_life_event.field_b_id.yml | 19 -- ....bears_life_event.field_b_search_title.yml | 19 -- ...ears_life_event.field_meta_description.yml | 19 -- ...node.bears_life_event.field_page_intro.yml | 19 -- ...ars_life_event.field_short_description.yml | 19 -- ....node.bears_life_event_form.field_b_id.yml | 19 -- ...levant_benefit.field_b_life_event_form.yml | 25 --- ...ield.storage.node.field_b_search_title.yml | 25 --- .../usagov_benefit_finder.settings.yml | 3 - 16 files changed, 1128 deletions(-) delete mode 100644 usagov_benefit_finder/configuration/core.entity_form_display.node.bears_benefit.default.yml delete mode 100644 usagov_benefit_finder/configuration/core.entity_form_display.node.bears_criteria.default.yml delete mode 100644 usagov_benefit_finder/configuration/core.entity_form_display.node.bears_life_event.default.yml delete mode 100644 usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.default.yml delete mode 100644 usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.teaser.yml delete mode 100644 usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.default.yml delete mode 100644 usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.teaser.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_id.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_search_title.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_meta_description.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_page_intro.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_short_description.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.node.bears_life_event_form.field_b_id.yml delete mode 100644 usagov_benefit_finder/configuration/field.field.paragraph.b_levent_relevant_benefit.field_b_life_event_form.yml delete mode 100644 usagov_benefit_finder/configuration/field.storage.node.field_b_search_title.yml delete mode 100644 usagov_benefit_finder/configuration/usagov_benefit_finder.settings.yml diff --git a/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_benefit.default.yml b/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_benefit.default.yml deleted file mode 100644 index 34d53aa65..000000000 --- a/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_benefit.default.yml +++ /dev/null @@ -1,191 +0,0 @@ -uuid: d4fdb095-25a3-43ea-879c-0ddf2ef649ae -langcode: en -status: true -dependencies: - config: - - field.field.node.bears_benefit.field_b_agency - - field.field.node.bears_benefit.field_b_eligibility - - field.field.node.bears_benefit.field_b_headline - - field.field.node.bears_benefit.field_b_initial_elg_length - - field.field.node.bears_benefit.field_b_life_event_forms - - field.field.node.bears_benefit.field_b_source_is_english - - field.field.node.bears_benefit.field_b_source_link - - field.field.node.bears_benefit.field_b_summary - - field.field.node.bears_benefit.field_b_tags - - field.field.node.bears_benefit.field_language_toggle - - node.type.bears_benefit - module: - - content_moderation - - paragraphs - - path - - text -id: node.bears_benefit.default -targetEntityType: node -bundle: bears_benefit -mode: default -content: - created: - type: datetime_timestamp - weight: 12 - region: content - settings: { } - third_party_settings: { } - field_b_agency: - type: options_select - weight: 8 - region: content - settings: { } - third_party_settings: { } - field_b_eligibility: - type: paragraphs - weight: 18 - region: content - settings: - title: Paragraph - title_plural: Paragraphs - edit_mode: open - closed_mode: summary - autocollapse: none - closed_mode_threshold: 0 - add_mode: dropdown - form_display_mode: default - default_paragraph_type: '' - features: - collapse_edit_all: collapse_edit_all - duplicate: duplicate - third_party_settings: { } - field_b_headline: - type: text_textarea - weight: 3 - region: content - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - field_b_initial_elg_length: - type: number - weight: 17 - region: content - settings: - placeholder: '' - third_party_settings: { } - field_b_life_event_forms: - type: options_buttons - weight: 7 - region: content - settings: { } - third_party_settings: { } - field_b_source_is_english: - type: boolean_checkbox - weight: 10 - region: content - settings: - display_label: true - third_party_settings: { } - field_b_source_link: - type: string_textfield - weight: 9 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_b_summary: - type: text_textarea - weight: 4 - region: content - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - field_b_tags: - type: options_buttons - weight: 5 - region: content - settings: { } - third_party_settings: { } - field_language_toggle: - type: entity_reference_autocomplete - weight: 1 - region: content - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - langcode: - type: language_select - weight: 0 - region: content - settings: - include_locked: true - third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 20 - region: content - settings: { } - third_party_settings: { } - path: - type: path - weight: 15 - region: content - settings: { } - third_party_settings: { } - promote: - type: boolean_checkbox - weight: 13 - region: content - settings: - display_label: true - third_party_settings: { } - simple_sitemap: - weight: 10 - region: content - settings: { } - third_party_settings: { } - status: - type: boolean_checkbox - weight: 16 - region: content - settings: - display_label: true - third_party_settings: { } - sticky: - type: boolean_checkbox - weight: 14 - region: content - settings: - display_label: true - third_party_settings: { } - title: - type: string_textfield - weight: 2 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - translation: - weight: 10 - region: content - settings: { } - third_party_settings: { } - uid: - type: entity_reference_autocomplete - weight: 11 - region: content - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - url_redirects: - weight: 19 - region: content - settings: { } - third_party_settings: { } -hidden: - menu_entity_index: true diff --git a/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_criteria.default.yml b/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_criteria.default.yml deleted file mode 100644 index 569a12dc2..000000000 --- a/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_criteria.default.yml +++ /dev/null @@ -1,210 +0,0 @@ -uuid: 7b0ea4b3-ad18-416a-81a4-6515572f433f -langcode: en -status: true -dependencies: - config: - - field.field.node.bears_criteria.field_b_child_dependency_option - - field.field.node.bears_criteria.field_b_criteria_key - - field.field.node.bears_criteria.field_b_has_child - - field.field.node.bears_criteria.field_b_id - - field.field.node.bears_criteria.field_b_label - - field.field.node.bears_criteria.field_b_name - - field.field.node.bears_criteria.field_b_type - - field.field.node.bears_criteria.field_b_values - - field.field.node.bears_criteria.field_language_toggle - - node.type.bears_criteria - module: - - content_moderation - - path -id: node.bears_criteria.default -targetEntityType: node -bundle: bears_criteria -mode: default -content: - created: - type: datetime_timestamp - weight: 3 - region: content - settings: { } - third_party_settings: { } - field_b_child_dependency_option: - type: string_textfield - weight: 16 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: - conditional_fields: - 7d256aff-5858-4005-83b2-7a6221d75c58: - entity_type: node - bundle: bears_criteria - dependee: field_b_has_child - settings: - state: required - reset: false - condition: checked - grouping: AND - values_set: 1 - value: '' - values: { } - value_form: - value: false - effect: show - effect_options: { } - selector: '' - 91ce84c7-8a94-49dc-a41c-d5c0f369a2d0: - entity_type: node - bundle: bears_criteria - dependee: field_b_has_child - settings: - state: visible - reset: false - condition: checked - grouping: AND - values_set: 1 - value: '' - values: { } - value_form: - value: false - effect: show - effect_options: { } - selector: '' - field_b_criteria_key: - type: string_textfield - weight: 9 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_b_has_child: - type: boolean_checkbox - weight: 15 - region: content - settings: - display_label: true - third_party_settings: { } - field_b_id: - type: string_textfield - weight: 10 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_b_label: - type: string_textfield - weight: 12 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_b_name: - type: string_textfield - weight: 13 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_b_type: - type: options_select - weight: 11 - region: content - settings: { } - third_party_settings: { } - field_b_values: - type: string_textfield - weight: 14 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_language_toggle: - type: entity_reference_autocomplete - weight: 1 - region: content - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - langcode: - type: language_select - weight: 0 - region: content - settings: - include_locked: true - third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 18 - region: content - settings: { } - third_party_settings: { } - path: - type: path - weight: 6 - region: content - settings: { } - third_party_settings: { } - promote: - type: boolean_checkbox - weight: 4 - region: content - settings: - display_label: true - third_party_settings: { } - simple_sitemap: - weight: 10 - region: content - settings: { } - third_party_settings: { } - status: - type: boolean_checkbox - weight: 7 - region: content - settings: - display_label: true - third_party_settings: { } - sticky: - type: boolean_checkbox - weight: 5 - region: content - settings: - display_label: true - third_party_settings: { } - title: - type: string_textfield - weight: 8 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - translation: - weight: 3 - region: content - settings: { } - third_party_settings: { } - uid: - type: entity_reference_autocomplete - weight: 2 - region: content - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - url_redirects: - weight: 17 - region: content - settings: { } - third_party_settings: { } -hidden: - menu_entity_index: true diff --git a/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_life_event.default.yml b/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_life_event.default.yml deleted file mode 100644 index 94335f34f..000000000 --- a/usagov_benefit_finder/configuration/core.entity_form_display.node.bears_life_event.default.yml +++ /dev/null @@ -1,209 +0,0 @@ -uuid: 99c745fb-37ed-4061-89ac-3bf52d328117 -langcode: en -status: true -dependencies: - config: - - field.field.node.bears_life_event.field_b_id - - field.field.node.bears_life_event.field_b_search_title - - field.field.node.bears_life_event.field_draft_json_data_file - - field.field.node.bears_life_event.field_draft_json_data_file_path - - field.field.node.bears_life_event.field_header_html - - field.field.node.bears_life_event.field_json_data_file - - field.field.node.bears_life_event.field_json_data_file_path - - field.field.node.bears_life_event.field_language_toggle - - field.field.node.bears_life_event.field_meta_description - - field.field.node.bears_life_event.field_page_intro - - field.field.node.bears_life_event.field_short_description - - field.field.node.bears_life_event.field_summary - - node.type.bears_life_event - module: - - allowed_formats - - content_moderation - - file - - path - - text -id: node.bears_life_event.default -targetEntityType: node -bundle: bears_life_event -mode: default -content: - created: - type: datetime_timestamp - weight: 10 - region: content - settings: { } - third_party_settings: { } - field_b_id: - type: string_textfield - weight: 3 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_b_search_title: - type: string_textfield - weight: 7 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_draft_json_data_file: - type: file_generic - weight: 21 - region: content - settings: - progress_indicator: throbber - third_party_settings: { } - field_draft_json_data_file_path: - type: string_textfield - weight: 19 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_header_html: - type: text_textarea - weight: 22 - region: content - settings: - rows: 5 - placeholder: '' - third_party_settings: - allowed_formats: - hide_help: '1' - hide_guidelines: '0' - field_json_data_file: - type: file_generic - weight: 20 - region: content - settings: - progress_indicator: throbber - third_party_settings: { } - field_json_data_file_path: - type: string_textfield - weight: 18 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - field_language_toggle: - type: entity_reference_autocomplete - weight: 1 - region: content - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - field_meta_description: - type: string_textarea - weight: 5 - region: content - settings: - rows: 1 - placeholder: '' - third_party_settings: { } - field_page_intro: - type: string_textarea - weight: 4 - region: content - settings: - rows: 1 - placeholder: '' - third_party_settings: { } - field_short_description: - type: string_textarea - weight: 6 - region: content - settings: - rows: 1 - placeholder: '' - third_party_settings: { } - field_summary: - type: string_textarea - weight: 8 - region: content - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - langcode: - type: language_select - weight: 0 - region: content - settings: - include_locked: true - third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 16 - region: content - settings: { } - third_party_settings: { } - path: - type: path - weight: 13 - region: content - settings: { } - third_party_settings: { } - promote: - type: boolean_checkbox - weight: 11 - region: content - settings: - display_label: true - third_party_settings: { } - simple_sitemap: - weight: 15 - region: content - settings: { } - third_party_settings: { } - status: - type: boolean_checkbox - weight: 17 - region: content - settings: - display_label: true - third_party_settings: { } - sticky: - type: boolean_checkbox - weight: 12 - region: content - settings: - display_label: true - third_party_settings: { } - title: - type: string_textfield - weight: 2 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - translation: - weight: 10 - region: content - settings: { } - third_party_settings: { } - uid: - type: entity_reference_autocomplete - weight: 9 - region: content - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - url_redirects: - weight: 14 - region: content - settings: { } - third_party_settings: { } -hidden: - menu_entity_index: true diff --git a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.default.yml b/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.default.yml deleted file mode 100644 index ee07784d0..000000000 --- a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.default.yml +++ /dev/null @@ -1,122 +0,0 @@ -uuid: 6c74929f-e325-431f-be4a-a55e5ff5254f -langcode: en -status: true -dependencies: - config: - - field.field.node.bears_benefit.field_b_agency - - field.field.node.bears_benefit.field_b_eligibility - - field.field.node.bears_benefit.field_b_headline - - field.field.node.bears_benefit.field_b_initial_elg_length - - field.field.node.bears_benefit.field_b_life_event_forms - - field.field.node.bears_benefit.field_b_source_is_english - - field.field.node.bears_benefit.field_b_source_link - - field.field.node.bears_benefit.field_b_summary - - field.field.node.bears_benefit.field_b_tags - - field.field.node.bears_benefit.field_language_toggle - - node.type.bears_benefit - module: - - entity_reference_revisions - - text - - user -id: node.bears_benefit.default -targetEntityType: node -bundle: bears_benefit -mode: default -content: - field_b_agency: - type: entity_reference_label - label: above - settings: - link: true - third_party_settings: { } - weight: 6 - region: content - field_b_eligibility: - type: entity_reference_revisions_entity_view - label: above - settings: - view_mode: default - link: '' - third_party_settings: { } - weight: 10 - region: content - field_b_headline: - type: text_default - label: above - settings: { } - third_party_settings: { } - weight: 1 - region: content - field_b_initial_elg_length: - type: number_integer - label: above - settings: - thousand_separator: '' - prefix_suffix: true - third_party_settings: { } - weight: 9 - region: content - field_b_life_event_forms: - type: entity_reference_label - label: above - settings: - link: true - third_party_settings: { } - weight: 5 - region: content - field_b_source_is_english: - type: boolean - label: above - settings: - format: default - format_custom_false: '' - format_custom_true: '' - third_party_settings: { } - weight: 8 - region: content - field_b_source_link: - type: string - label: above - settings: - link_to_entity: false - third_party_settings: { } - weight: 7 - region: content - field_b_summary: - type: text_default - label: above - settings: { } - third_party_settings: { } - weight: 2 - region: content - field_b_tags: - type: entity_reference_label - label: above - settings: - link: true - third_party_settings: { } - weight: 3 - region: content - field_language_toggle: - type: entity_reference_label - label: above - settings: - link: true - third_party_settings: { } - weight: 12 - region: content - langcode: - type: language - label: above - settings: - link_to_entity: false - native_language: false - third_party_settings: { } - weight: 11 - region: content - links: - settings: { } - third_party_settings: { } - weight: 0 - region: content -hidden: { } diff --git a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.teaser.yml b/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.teaser.yml deleted file mode 100644 index 4f693d923..000000000 --- a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_benefit.teaser.yml +++ /dev/null @@ -1,41 +0,0 @@ -uuid: dab1fae4-5630-49c4-820a-d787fba71e65 -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.node.teaser - - field.field.node.bears_benefit.field_b_agency - - field.field.node.bears_benefit.field_b_eligibility - - field.field.node.bears_benefit.field_b_headline - - field.field.node.bears_benefit.field_b_initial_elg_length - - field.field.node.bears_benefit.field_b_life_event_forms - - field.field.node.bears_benefit.field_b_source_is_english - - field.field.node.bears_benefit.field_b_source_link - - field.field.node.bears_benefit.field_b_summary - - field.field.node.bears_benefit.field_b_tags - - field.field.node.bears_benefit.field_language_toggle - - node.type.bears_benefit - module: - - user -id: node.bears_benefit.teaser -targetEntityType: node -bundle: bears_benefit -mode: teaser -content: - links: - settings: { } - third_party_settings: { } - weight: 100 - region: content -hidden: - field_b_agency: true - field_b_eligibility: true - field_b_headline: true - field_b_initial_elg_length: true - field_b_life_event_forms: true - field_b_source_is_english: true - field_b_source_link: true - field_b_summary: true - field_b_tags: true - field_language_toggle: true - langcode: true diff --git a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.default.yml b/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.default.yml deleted file mode 100644 index 502604726..000000000 --- a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.default.yml +++ /dev/null @@ -1,138 +0,0 @@ -uuid: 6a658720-5cd1-4c61-bf1c-a8f0c9a40680 -langcode: en -status: true -dependencies: - config: - - field.field.node.bears_life_event.field_b_id - - field.field.node.bears_life_event.field_b_search_title - - field.field.node.bears_life_event.field_draft_json_data_file - - field.field.node.bears_life_event.field_draft_json_data_file_path - - field.field.node.bears_life_event.field_header_html - - field.field.node.bears_life_event.field_json_data_file - - field.field.node.bears_life_event.field_json_data_file_path - - field.field.node.bears_life_event.field_language_toggle - - field.field.node.bears_life_event.field_meta_description - - field.field.node.bears_life_event.field_page_intro - - field.field.node.bears_life_event.field_short_description - - field.field.node.bears_life_event.field_summary - - node.type.bears_life_event - module: - - file - - text - - user -id: node.bears_life_event.default -targetEntityType: node -bundle: bears_life_event -mode: default -content: - content_moderation_control: - settings: { } - third_party_settings: { } - weight: -20 - region: content - field_b_id: - type: string - label: above - settings: - link_to_entity: false - third_party_settings: { } - weight: 2 - region: content - field_b_search_title: - type: string - label: above - settings: - link_to_entity: false - third_party_settings: { } - weight: 12 - region: content - field_draft_json_data_file: - type: file_default - label: above - settings: - use_description_as_link_text: true - third_party_settings: { } - weight: 9 - region: content - field_draft_json_data_file_path: - type: string - label: above - settings: - link_to_entity: false - third_party_settings: { } - weight: 7 - region: content - field_header_html: - type: text_default - label: above - settings: { } - third_party_settings: { } - weight: 10 - region: content - field_json_data_file: - type: file_default - label: above - settings: - use_description_as_link_text: true - third_party_settings: { } - weight: 8 - region: content - field_json_data_file_path: - type: string - label: above - settings: - link_to_entity: false - third_party_settings: { } - weight: 6 - region: content - field_language_toggle: - type: entity_reference_label - label: above - settings: - link: true - third_party_settings: { } - weight: 5 - region: content - field_meta_description: - type: basic_string - label: above - settings: { } - third_party_settings: { } - weight: 3 - region: content - field_page_intro: - type: basic_string - label: hidden - settings: { } - third_party_settings: { } - weight: 2 - region: content - field_short_description: - type: basic_string - label: above - settings: { } - third_party_settings: { } - weight: 11 - region: content - field_summary: - type: basic_string - label: above - settings: { } - third_party_settings: { } - weight: 1 - region: content - langcode: - type: language - label: above - settings: - link_to_entity: false - native_language: false - third_party_settings: { } - weight: 4 - region: content - links: - settings: { } - third_party_settings: { } - weight: 0 - region: content -hidden: { } diff --git a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.teaser.yml b/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.teaser.yml deleted file mode 100644 index 7c76eec76..000000000 --- a/usagov_benefit_finder/configuration/core.entity_view_display.node.bears_life_event.teaser.yml +++ /dev/null @@ -1,50 +0,0 @@ -uuid: 75f24593-dd3f-4f75-aea4-27d8ca76f40b -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.node.teaser - - field.field.node.bears_life_event.field_b_id - - field.field.node.bears_life_event.field_b_search_title - - field.field.node.bears_life_event.field_draft_json_data_file - - field.field.node.bears_life_event.field_draft_json_data_file_path - - field.field.node.bears_life_event.field_header_html - - field.field.node.bears_life_event.field_json_data_file - - field.field.node.bears_life_event.field_json_data_file_path - - field.field.node.bears_life_event.field_language_toggle - - field.field.node.bears_life_event.field_meta_description - - field.field.node.bears_life_event.field_page_intro - - field.field.node.bears_life_event.field_short_description - - field.field.node.bears_life_event.field_summary - - node.type.bears_life_event - module: - - user -id: node.bears_life_event.teaser -targetEntityType: node -bundle: bears_life_event -mode: teaser -content: - content_moderation_control: - settings: { } - third_party_settings: { } - weight: -20 - region: content - links: - settings: { } - third_party_settings: { } - weight: 100 - region: content -hidden: - field_b_id: true - field_b_search_title: true - field_draft_json_data_file: true - field_draft_json_data_file_path: true - field_header_html: true - field_json_data_file: true - field_json_data_file_path: true - field_language_toggle: true - field_meta_description: true - field_page_intro: true - field_short_description: true - field_summary: true - langcode: true diff --git a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_id.yml b/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_id.yml deleted file mode 100644 index 1c64ee604..000000000 --- a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_id.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: 1d3a2be6-3f91-4d75-8388-e26cde7882d0 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_b_id - - node.type.bears_life_event -id: node.bears_life_event.field_b_id -field_name: field_b_id -entity_type: node -bundle: bears_life_event -label: ID -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_search_title.yml b/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_search_title.yml deleted file mode 100644 index 2d321559d..000000000 --- a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_b_search_title.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: 4cfe5edb-4b13-42ac-98b0-3cd6416cd289 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_b_search_title - - node.type.bears_life_event -id: node.bears_life_event.field_b_search_title -field_name: field_b_search_title -entity_type: node -bundle: bears_life_event -label: 'Search Title' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_meta_description.yml b/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_meta_description.yml deleted file mode 100644 index 49b1522c3..000000000 --- a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_meta_description.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: b3333760-014c-45c3-9ac9-1d5c9a3e6a91 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_meta_description - - node.type.bears_life_event -id: node.bears_life_event.field_meta_description -field_name: field_meta_description -entity_type: node -bundle: bears_life_event -label: 'Meta Description' -description: 'Text to place in a "meta description" tag on this page. If this field is empty, the Page Intro will be used for the meta description. ' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string_long diff --git a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_page_intro.yml b/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_page_intro.yml deleted file mode 100644 index aed5f3d4e..000000000 --- a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_page_intro.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: 1f6b04ec-e649-4672-8405-32a594ad93cb -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_page_intro - - node.type.bears_life_event -id: node.bears_life_event.field_page_intro -field_name: field_page_intro -entity_type: node -bundle: bears_life_event -label: 'Page Intro' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string_long diff --git a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_short_description.yml b/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_short_description.yml deleted file mode 100644 index c7d9084e2..000000000 --- a/usagov_benefit_finder/configuration/field.field.node.bears_life_event.field_short_description.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: d892bc96-def5-4e8f-9725-d670fdc2c382 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_short_description - - node.type.bears_life_event -id: node.bears_life_event.field_short_description -field_name: field_short_description -entity_type: node -bundle: bears_life_event -label: 'Short Description' -description: 'The short description appears on cards for the homepage and nav pages. Aim for less than 80 characters. If left blank the page intro will be used.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string_long diff --git a/usagov_benefit_finder/configuration/field.field.node.bears_life_event_form.field_b_id.yml b/usagov_benefit_finder/configuration/field.field.node.bears_life_event_form.field_b_id.yml deleted file mode 100644 index 9bd263382..000000000 --- a/usagov_benefit_finder/configuration/field.field.node.bears_life_event_form.field_b_id.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: 27344f9c-03c7-4232-a628-107b8893f3cb -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_b_id - - node.type.bears_life_event_form -id: node.bears_life_event_form.field_b_id -field_name: field_b_id -entity_type: node -bundle: bears_life_event_form -label: ID -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/usagov_benefit_finder/configuration/field.field.paragraph.b_levent_relevant_benefit.field_b_life_event_form.yml b/usagov_benefit_finder/configuration/field.field.paragraph.b_levent_relevant_benefit.field_b_life_event_form.yml deleted file mode 100644 index 71829a0d7..000000000 --- a/usagov_benefit_finder/configuration/field.field.paragraph.b_levent_relevant_benefit.field_b_life_event_form.yml +++ /dev/null @@ -1,25 +0,0 @@ -uuid: ec5f36b1-45d7-4c91-b74d-3d8a49dd348f -langcode: en -status: true -dependencies: - config: - - field.storage.paragraph.field_b_life_event_form - - paragraphs.paragraphs_type.b_levent_relevant_benefit -id: paragraph.b_levent_relevant_benefit.field_b_life_event_form -field_name: field_b_life_event_form -entity_type: paragraph -bundle: b_levent_relevant_benefit -label: 'Life Event Form' -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: - handler: views - handler_settings: - view: - view_name: benefit_finder - display_name: entity_reference_3 - arguments: { } -field_type: entity_reference diff --git a/usagov_benefit_finder/configuration/field.storage.node.field_b_search_title.yml b/usagov_benefit_finder/configuration/field.storage.node.field_b_search_title.yml deleted file mode 100644 index 802fb8742..000000000 --- a/usagov_benefit_finder/configuration/field.storage.node.field_b_search_title.yml +++ /dev/null @@ -1,25 +0,0 @@ -uuid: ee685fe0-3e6b-4b9a-8c8a-d1733cd1dabd -langcode: en -status: true -dependencies: - module: - - field_permissions - - node -third_party_settings: - field_permissions: - permission_type: public -id: node.field_b_search_title -field_name: field_b_search_title -entity_type: node -type: string -settings: - max_length: 255 - case_sensitive: false - is_ascii: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/usagov_benefit_finder/configuration/usagov_benefit_finder.settings.yml b/usagov_benefit_finder/configuration/usagov_benefit_finder.settings.yml deleted file mode 100644 index e6e3832be..000000000 --- a/usagov_benefit_finder/configuration/usagov_benefit_finder.settings.yml +++ /dev/null @@ -1,3 +0,0 @@ -_core: - default_config_hash: sgIXuoeVJ1TaEzDT2BEh-RcCvmocaPx_0QpNgfRpxQA -automate_json_data_file_generating: true From de601a558cba507e03fe85141131c7a6dc8a9eee Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 11:16:43 -0400 Subject: [PATCH 31/52] Update thog, add some features 8 --- .github/workflows/thog_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index c0683a75f..c007c9c76 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -30,7 +30,7 @@ jobs: with: base: "" head: ${{ github.ref_name }} - extra_args: --only-verified --json --entropy --max-depth=10 + extra_args: --only-verified --json --entropy --max-depth=20 continue-on-error: true - name: Check TruffleHog Results From a742e668847061b7018c754b87bc8413a296b90f Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Tue, 2 Jul 2024 11:20:19 -0400 Subject: [PATCH 32/52] Update thog, add some features 9 --- .github/workflows/thog_scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan.yml index c007c9c76..632681e7e 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan.yml @@ -30,7 +30,7 @@ jobs: with: base: "" head: ${{ github.ref_name }} - extra_args: --only-verified --json --entropy --max-depth=20 + extra_args: --only-verified --json --entropy --max-depth=50 continue-on-error: true - name: Check TruffleHog Results From 68c12ab7e0f092145acdc22b27f5c0c3976d3171 Mon Sep 17 00:00:00 2001 From: gchi25 Date: Wed, 3 Jul 2024 09:28:09 -0400 Subject: [PATCH 33/52] PXBF-1521-disable-life-event-form-delete-if-used: disable life event form delete if used --- .../usagov_benefit_finder_content.module | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/usagov_benefit_finder/modules/usagov_benefit_finder_content/usagov_benefit_finder_content.module b/usagov_benefit_finder/modules/usagov_benefit_finder_content/usagov_benefit_finder_content.module index 3b192ad52..24cc4d65f 100644 --- a/usagov_benefit_finder/modules/usagov_benefit_finder_content/usagov_benefit_finder_content.module +++ b/usagov_benefit_finder/modules/usagov_benefit_finder_content/usagov_benefit_finder_content.module @@ -389,3 +389,78 @@ function _usagov_benefit_finder_content_check_criteria_has_child(int $nid) { return $return; } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function usagov_benefit_finder_content_form_node_bears_life_event_form_delete_form_alter(array &$form, FormStateInterface $form_state) { + _usagov_benefit_finder_content_check_life_event_form_usage($form); +} + +/** + * It checks life event form usage in relevant benefit of life event forms. + * If still used, it lists the life event forms and disables the delete confirmation button. + * + * @param array $form + * Form array. + */ +function _usagov_benefit_finder_content_check_life_event_form_usage(array &$form) { + $description = ''; + + $node = \Drupal::routeMatch()->getParameter('node'); + $nid = $node->id(); + + $result = _usagov_benefit_finder_content_check_life_event_form_usage_in_life_event_form($nid); + foreach ($result as $row) { + $description .= "
  • Life event form: $row[title] ($row[nid])
  • "; + } + + if (!empty($description)) { + $description = '
    ' + . 'This life event form cannot be deleted as it is still used in following content:' + . "
      $description
    " + . '
    '; + $form['description']['#markup'] = t($description); + $form['actions']['submit']['#access'] = FALSE; + } +} + +/** + * It checks life event form usage in relevant benefit of life event forms. + * + * @param int $nid + * Node ID of given life event form. + */ +function _usagov_benefit_finder_content_check_life_event_form_usage_in_life_event_form(int $nid) { + $return = []; + + $connection = Database::getConnection(); + + $query = $connection->select('paragraph__field_b_life_event_form', 't'); + $query->fields('t', ['entity_id']); + $query->condition('t.bundle', 'b_levent_relevant_benefit'); + $query->condition('t.field_b_life_event_form_target_id', $nid); + $result = $query->execute(); + + $entity_ids = []; + foreach ($result as $row) { + $entity_ids[] = $row->entity_id; + } + + if (empty($entity_ids)) { + return $return; + } + + $query = $connection->select('node_field_data', 't1'); + $query->join('node__field_b_relevant_benefits', 't2', 't1.nid = t2.entity_id'); + $query->fields('t1', ['title', 'nid']); + $query->condition('t2.field_b_relevant_benefits_target_id', $entity_ids, 'IN'); + $query->orderBy('title'); + $result = $query->execute(); + + foreach ($result as $row) { + $return[] = ['nid' => $row->nid, 'title' => $row->title]; + } + + return $return; +} From 587b0ea242d4ed492229c56b44d2bac42cd7882e Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Wed, 3 Jul 2024 10:24:14 -0400 Subject: [PATCH 34/52] Split commands --- .github/workflows/database-restore.yml | 2 +- .github/workflows/{thog_scan.yml => thog_scan_commit.yml} | 6 +++++- .github/workflows/thog_scan_scheduled.yml | 0 3 files changed, 6 insertions(+), 2 deletions(-) rename .github/workflows/{thog_scan.yml => thog_scan_commit.yml} (97%) create mode 100644 .github/workflows/thog_scan_scheduled.yml diff --git a/.github/workflows/database-restore.yml b/.github/workflows/database-restore.yml index ab07b8c72..3a08657a2 100644 --- a/.github/workflows/database-restore.yml +++ b/.github/workflows/database-restore.yml @@ -37,7 +37,7 @@ jobs: PROJECT: "${{ secrets.PROJECT }}" run: | echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV - cf start "${PROJECT}-${DATABASE_BACKUP_BASTION_NAME}-${BRANCH}" >/dev/null 2>&1 + cf start "${PROJECT}-${DATABASE_BACKUP_BASTION_NAME}-${BRANCH}" #>/dev/null 2>&1 ./scripts/pipeline/cloud-gov-wait-for-app-start.sh "${PROJECT}-${DATABASE_BACKUP_BASTION_NAME}-${BRANCH}" - name: Restore database shell: bash diff --git a/.github/workflows/thog_scan.yml b/.github/workflows/thog_scan_commit.yml similarity index 97% rename from .github/workflows/thog_scan.yml rename to .github/workflows/thog_scan_commit.yml index 632681e7e..00074f653 100644 --- a/.github/workflows/thog_scan.yml +++ b/.github/workflows/thog_scan_commit.yml @@ -1,7 +1,11 @@ name: TruffleHog Scan on: - workflow_dispatch: + push: + branches: + - main + - develop + pull_request: jobs: scan: diff --git a/.github/workflows/thog_scan_scheduled.yml b/.github/workflows/thog_scan_scheduled.yml new file mode 100644 index 000000000..e69de29bb From 7b3fc0b9f5aa0bfd6c2f6d56dab87ffab17af014 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Wed, 3 Jul 2024 11:36:59 -0400 Subject: [PATCH 35/52] Cleanup --- restore.txt | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 restore.txt diff --git a/restore.txt b/restore.txt deleted file mode 100644 index 80c81b179..000000000 --- a/restore.txt +++ /dev/null @@ -1,12 +0,0 @@ -Finding the service instance details... -Setting up SSH tunnel... -SSH tunnel created. -Skipping call to client CLI. Connection information: - -Host: localhost -Port: 44265 -Username: u1pqgr5amf7bbsm3 -Password: o95jv0wxlkynbk5qx7fxbmc6o -Name: cgawsbrokerprodoly1e52tnaanm56 - -Leave this terminal open while you want to use the SSH tunnel. Press Control-C to stop. From f5ce70fe2901e0b72dd885d38130c947b196bfb1 Mon Sep 17 00:00:00 2001 From: Xavier Metichecchia Date: Mon, 8 Jul 2024 13:21:19 -0400 Subject: [PATCH 36/52] Add workflow permissions --- .github/workflows/build-and-deploy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 4743b89d0..07ede2b2c 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -6,6 +6,10 @@ on: - dev - main +permissions: + contents: read + packages: write + jobs: php-lint: name: PHP Lint From fcc402cad0661f533d2653f65811de23ee946468 Mon Sep 17 00:00:00 2001 From: gchi25 Date: Tue, 9 Jul 2024 09:11:12 -0400 Subject: [PATCH 37/52] PXBF-1541-remove-deprecated-function: remove deprecated function --- .../src/Controller/LifeEventController.php | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php b/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php index 7468c4b7b..41dbe8a2a 100644 --- a/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php +++ b/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php @@ -542,21 +542,30 @@ public function getNode($nid, $mode) { } if ($mode == "published") { - $vid = $this->database - ->query('SELECT MAX(vid) AS vid FROM node_field_revision WHERE status = 1 AND nid = :nid', [':nid' => $nid]) - ->fetchField(); + $query = $this->entityTypeManager->getStorage('node') + ->getQuery() + ->allRevisions() + ->condition('nid', $nid) + ->condition('status', 1) + ->sort('vid', 'DESC') + ->range(0, 1) + ->accessCheck(TRUE); } elseif ($mode == "draft") { - $vid = $this->database - ->query('SELECT MAX(vid) AS vid FROM node_field_revision WHERE nid = :nid', [':nid' => $nid]) - ->fetchField(); - } - else { - // @todo Unknown + $query = $this->entityTypeManager->getStorage('node') + ->getQuery() + ->allRevisions() + ->condition('nid', $nid) + ->sort('vid', 'DESC') + ->range(0, 1) + ->accessCheck(TRUE); } - if ($vid) { - $node = node_revision_load($vid); + $result = $query->execute(); + + if (!empty($result)) { + $revision_id = key($result); + $node = $this->entityTypeManager->getStorage('node')->loadRevision($revision_id); } else { $node = NULL; From acea1526f4b52c0b1095c38e6e795f00050c0ab2 Mon Sep 17 00:00:00 2001 From: gchi25 Date: Tue, 9 Jul 2024 11:16:53 -0400 Subject: [PATCH 38/52] PXBF-1541-remove-deprecated-function: remove checking archived --- .../src/Controller/LifeEventController.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php b/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php index 41dbe8a2a..83c3872d7 100644 --- a/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php +++ b/usagov_benefit_finder/modules/usagov_benefit_finder_api/src/Controller/LifeEventController.php @@ -531,16 +531,6 @@ public function getAgency($nid) { public function getNode($nid, $mode) { $vid = 0; - // Do not use node of moderation state archived. - $id = $this->database - ->query('SELECT id FROM content_moderation_state_field_data - WHERE moderation_state = :mstate AND content_entity_id = :nid', - [':mstate' => 'archived', ':nid' => $nid]) - ->fetchField(); - if ($id) { - return NULL; - } - if ($mode == "published") { $query = $this->entityTypeManager->getStorage('node') ->getQuery() From 01d0e82406f5ba9e0a343528ab2a1b378f1f74e7 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Tue, 9 Jul 2024 13:11:00 -0400 Subject: [PATCH 39/52] PXBF-1525-clean-benefit-finder-configuration: recursively remove all files under custom/module location before copy over new updates --- scripts/pipeline/mv-usagov_benefit_finder.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pipeline/mv-usagov_benefit_finder.sh b/scripts/pipeline/mv-usagov_benefit_finder.sh index 8ff856a6a..6e8314c97 100755 --- a/scripts/pipeline/mv-usagov_benefit_finder.sh +++ b/scripts/pipeline/mv-usagov_benefit_finder.sh @@ -35,6 +35,7 @@ if test -d "$BENEFIT_FINDER_MODULE_LOCATION" then echo "usa.gov benefit-finder module exist" echo "Moving BENEFIT_FINDER custom module to usa.gov project..." + rm -r "${USAGOV_PROJECT_CUSTOM_MODULES_LOCATION}/${BENEFIT_FINDER_MODULE}"/* || exit 1 cp -r "${BENEFIT_FINDER_MODULE_LOCATION}" "${USAGOV_PROJECT_CUSTOM_MODULES_LOCATION}" || exit 1 - test -f "${USAGOV_PROJECT_CUSTOM_MODULES_LOCATION}${BENEFIT_FINDER_MODULE}"; echo -e "BENEFIT_FINDER Module successfully moved" + test -f "${USAGOV_PROJECT_CUSTOM_MODULES_LOCATION}/${BENEFIT_FINDER_MODULE}"; echo -e "BENEFIT_FINDER Module successfully moved" fi From f4c107a31d64f037362c9b0a5fb033c09107c110 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:28:57 -0400 Subject: [PATCH 40/52] PXBF-1536-1537-1538-datalayer-updates: log error --- benefit-finder/cypress/e2e/usagov-public-site/links.cy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index d23a15540..59a6fb9a5 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -51,6 +51,7 @@ const validateLinks = ({ selectedData, path }) => { // to be removed when uncaught exceptions are addressed Cypress.on('uncaught:exception', (error, runnable) => { + console.log(error) return false }) From c60cb36660798e9b6c7d72e2d829e2534d389567 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:30:33 -0400 Subject: [PATCH 41/52] PXBF-1536-1537-1538-datalayer-updates: revert back to unhandled --- benefit-finder/cypress/e2e/usagov-public-site/links.cy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index 59a6fb9a5..d23a15540 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -51,7 +51,6 @@ const validateLinks = ({ selectedData, path }) => { // to be removed when uncaught exceptions are addressed Cypress.on('uncaught:exception', (error, runnable) => { - console.log(error) return false }) From bd7b31fcab2e7822eb4f1deb3a83727a10dc3a56 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:32:32 -0400 Subject: [PATCH 42/52] PXBF-1536-1537-1538-datalayer-updates: update modal to page change event, inclue view title --- .../src/shared/utils/dataLayerUtils/dataLayerStructure.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index d85cffacd..dce848ced 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -11,9 +11,10 @@ const dataLayerStructure = { }, }, modal: { - event: 'bf_modal_open', + event: 'bf_page_change', bfData: { - modalOpen: false, + pageView: 'bf-form-completion-modal', + viewTitle: null, }, }, verifySelections: { From b772165612830a95d71a732802d54d6803d636d0 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:32:49 -0400 Subject: [PATCH 43/52] PXBF-1536-1537-1538-datalayer-updates: ignore linting in thest --- benefit-finder/cypress/e2e/usagov-public-site/links.cy.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js index d23a15540..9fc879911 100644 --- a/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js +++ b/benefit-finder/cypress/e2e/usagov-public-site/links.cy.js @@ -50,6 +50,7 @@ const validateLinks = ({ selectedData, path }) => { } // to be removed when uncaught exceptions are addressed +// eslint-disable-next-line n/handle-callback-err Cypress.on('uncaught:exception', (error, runnable) => { return false }) @@ -58,6 +59,7 @@ describe('Verify correct status code handling', () => { // negate validation on our functional code Cypress.on('fail', (error, runnable) => { if (JSON.stringify(error).includes('httpstat')) { + // eslint-disable-next-line no-unused-expressions expect(error).to.not.be.undefined } else { throw error From 4fddaf95af3e23fd8571918218d52c07b25a13f8 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:33:06 -0400 Subject: [PATCH 44/52] PXBF-1536-1537-1538-datalayer-updates: pass title as prop to dataLayer values --- .../src/shared/components/LifeEventSection/index.jsx | 1 + benefit-finder/src/shared/components/Modal/index.jsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/benefit-finder/src/shared/components/LifeEventSection/index.jsx b/benefit-finder/src/shared/components/LifeEventSection/index.jsx index 702431cca..185f0bd26 100644 --- a/benefit-finder/src/shared/components/LifeEventSection/index.jsx +++ b/benefit-finder/src/shared/components/LifeEventSection/index.jsx @@ -561,6 +561,7 @@ const LifeEventSection = ({
    { // state const triggerRef = useRef(null) @@ -107,7 +108,8 @@ const Modal = ({ dataLayerUtils.dataLayerPush(window, { event: modal.event, bfData: { - modalOpen, + pageView: modal.bfData.pageView, + viewTitle: dataLayerValue.viewTitle, }, }) }, []) From 18717b7901d3eedf5e2dc477f1efc36f0f2ec275 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:34:46 -0400 Subject: [PATCH 45/52] PXBF-1536-1537-1538-datalayer-updates: remove view state from structure an push event --- benefit-finder/src/shared/components/ResultsView/index.jsx | 6 ------ .../src/shared/utils/dataLayerUtils/dataLayerStructure.js | 6 ------ 2 files changed, 12 deletions(-) diff --git a/benefit-finder/src/shared/components/ResultsView/index.jsx b/benefit-finder/src/shared/components/ResultsView/index.jsx index 138d6c034..2eeaa003a 100644 --- a/benefit-finder/src/shared/components/ResultsView/index.jsx +++ b/benefit-finder/src/shared/components/ResultsView/index.jsx @@ -124,12 +124,6 @@ const ResultsView = ({ eligible.chevron.heading : (zeroBenefitsResult && zeroBenefits.chevron.heading) || notEligible.chevron.heading, - viewState: - notEligibleView === true - ? (zeroBenefitsResult && resultsView.bfData.viewState[2]) || - resultsView.bfData.viewState[0] - : (zeroBenefitsResult && resultsView.bfData.viewState[3]) || - resultsView.bfData.viewState[1], }, }) }, [notEligibleView, eligibilityCount]) diff --git a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js index dce848ced..8e0e9ebd4 100644 --- a/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js +++ b/benefit-finder/src/shared/utils/dataLayerUtils/dataLayerStructure.js @@ -29,12 +29,6 @@ const dataLayerStructure = { bfData: { pageView: ['bf-result-eligible-view', 'bf-result-not-eligible-view'], viewTitle: null, - viewState: [ - 'bf-not-eligible-view', - 'bf-eligible-view', - 'bf-not-eligible-view-zero-benefits', - 'bf-eligible-view-zero-benefits', - ], }, }, openAllBenefitAccordions: { From bc8e8c67adc80f18ae260d65ffdf457f3a3734d1 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 10:54:25 -0400 Subject: [PATCH 46/52] PXBF-1536-1537-1538-datalayer-updates: move bf_count to page change event, include values as string and number types --- .../shared/components/ResultsView/index.jsx | 41 +++++++++---------- .../dataLayerUtils/dataLayerStructure.js | 1 - 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/benefit-finder/src/shared/components/ResultsView/index.jsx b/benefit-finder/src/shared/components/ResultsView/index.jsx index 2eeaa003a..2ef3f3613 100644 --- a/benefit-finder/src/shared/components/ResultsView/index.jsx +++ b/benefit-finder/src/shared/components/ResultsView/index.jsx @@ -48,9 +48,9 @@ const ResultsView = ({ const [notEligibleView, setnotEligibleView] = useState(false) const [eligibilityCount, setEligibilityCount] = useState({ - eligible: 0, - notEligible, - moreInfo: 0, + eligibleBenefitCount: { number: 0, string: '0' }, + notEligibleBenefitCount: { number: 0, string: '0' }, + moreInfoBenefitCount: { number: 0, string: '0' }, }) const resetElement = useResetElement() @@ -81,7 +81,7 @@ const ResultsView = ({ matches.push(div) } } - return matches.length + return { number: matches.length, string: `${matches.length}` } } const handleViewToggle = () => { @@ -90,18 +90,18 @@ const ResultsView = ({ resetElement.current.focus() } - const zeroBenefitsResult = eligibilityCount.eligible === 0 + const zeroBenefitsResult = eligibilityCount.eligibleBenefitCount.number === 0 useEffect(() => { window.scrollTo(0, 0) setEligibilityCount({ - eligible: handleEligibilityLength( + eligibleBenefitCount: handleEligibilityLength( ui.benefitAccordion.eligibleStatusLabels[0] ), - moreInfo: handleEligibilityLength( + moreInfoBenefitCount: handleEligibilityLength( ui.benefitAccordion.eligibleStatusLabels[1] ), - notEligible: handleEligibilityLength( + notEligibleBenefitCount: handleEligibilityLength( ui.benefitAccordion.eligibleStatusLabels[2] ), }) @@ -110,7 +110,7 @@ const ResultsView = ({ // handle dataLayer useEffect(() => { const { resultsView } = dataLayerUtils.dataLayerStructure - eligibilityCount.notEligible >= 0 && + eligibilityCount.notEligibleBenefitCount.number >= 0 && dataLayerUtils.dataLayerPush(window, { event: resultsView.event, bfData: { @@ -124,20 +124,11 @@ const ResultsView = ({ eligible.chevron.heading : (zeroBenefitsResult && zeroBenefits.chevron.heading) || notEligible.chevron.heading, + ...eligibilityCount, }, }) }, [notEligibleView, eligibilityCount]) - // handle dataLayer - useEffect(() => { - const { benefitCount } = dataLayerUtils.dataLayerStructure - eligibilityCount.notEligible >= 0 && - dataLayerUtils.dataLayerPush(window, { - event: benefitCount.event, - bfData: eligibilityCount, - }) - }, [eligibilityCount]) - // compare the selected criteria array with benefits return (
    Date: Wed, 10 Jul 2024 11:23:01 -0400 Subject: [PATCH 47/52] PXBF-1536-1537-1538-datalayer-updates: update benefit count assertion --- .../cypress/e2e/storybook/dataLayer.cy.js | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js index 96770f508..f8ddf481e 100644 --- a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js +++ b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js @@ -33,15 +33,9 @@ const dataLayerValues = [ bfData: { pageView: resultsView.bfData.pageView[0], viewTitle: 'Your potential benefits', - viewState: resultsView.bfData.viewState[1], - }, - }, - { - event: benefitCount.event, - bfData: { - eligible: 4, - moreInfo: 1, - notEligible: 25, + eligibleBenefitCount: { number: 4, string: '4' }, + moreInfoBenefitCount: { number: 1, string: '1' }, + notEligibleBenefitCount: { number: 25, string: '25' }, }, }, { @@ -122,7 +116,7 @@ describe('Calls to Google Analytics Object', function () { .then(() => { // we wait for the last event to fire // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(1000).then(() => { + cy.wait(2000).then(() => { // check last page change event const ev = { ...window.dataLayer.filter( @@ -131,21 +125,18 @@ describe('Calls to Google Analytics Object', function () { } delete ev[0]['gtm.uniqueEventId'] - cy.log(resultsView.bfData.pageView[1]) - cy.log(dataLayerValues[2]) - - expect(dataLayerValues[2]).to.deep.equal(ev[0]) + expect(ev[0]).to.deep.equal(dataLayerValues[2]) // // check count event - const evCount = { - ...window.dataLayer.filter( - x => x.event === dataLayerValues[3].event - ), - } + // const evCount = { + // ...window.dataLayer.filter( + // x => x.event === dataLayerValues[2].event + // ), + // } - delete evCount[0]['gtm.uniqueEventId'] + // delete evCount[0]['gtm.uniqueEventId'] - expect(dataLayerValues[3]).to.deep.equal(evCount[0]) + // expect(dataLayerValues[3]).to.deep.equal(evCount[0]) }) }) }) @@ -166,12 +157,12 @@ describe('Calls to Google Analytics Object', function () { // check last page change event const ev = { ...window.dataLayer.filter( - x => x?.event === dataLayerValues[4].event + x => x?.event === dataLayerValues[3].event ), } delete ev[0]['gtm.uniqueEventId'] - expect(dataLayerValues[4]).to.deep.equal(ev[0]) + expect(dataLayerValues[3]).to.deep.equal(ev[0]) }) pageObjects @@ -181,7 +172,7 @@ describe('Calls to Google Analytics Object', function () { // check last page change event const ev = { ...window.dataLayer.filter( - x => x?.event === dataLayerValues[4].event + x => x?.event === dataLayerValues[3].event ), } // we ignore dedup here so there can be multiple fires From 6e30457ea64698ece514d74d89da39f4456762a9 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 11:24:32 -0400 Subject: [PATCH 48/52] PXBF-dev: git keep configuration file --- usagov_benefit_finder/configuration/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 usagov_benefit_finder/configuration/.gitkeep diff --git a/usagov_benefit_finder/configuration/.gitkeep b/usagov_benefit_finder/configuration/.gitkeep new file mode 100644 index 000000000..e69de29bb From bed36e7d268e34fd0f6552d0daf5241a6e4cf99a Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 13:01:02 -0400 Subject: [PATCH 49/52] PXBF-1536-1537-1538-datalayer-updates: establish null state, then build as a side effect --- .../src/shared/components/ResultsView/index.jsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/benefit-finder/src/shared/components/ResultsView/index.jsx b/benefit-finder/src/shared/components/ResultsView/index.jsx index 2ef3f3613..f1dd28a31 100644 --- a/benefit-finder/src/shared/components/ResultsView/index.jsx +++ b/benefit-finder/src/shared/components/ResultsView/index.jsx @@ -47,11 +47,7 @@ const ResultsView = ({ } = ui const [notEligibleView, setnotEligibleView] = useState(false) - const [eligibilityCount, setEligibilityCount] = useState({ - eligibleBenefitCount: { number: 0, string: '0' }, - notEligibleBenefitCount: { number: 0, string: '0' }, - moreInfoBenefitCount: { number: 0, string: '0' }, - }) + const [eligibilityCount, setEligibilityCount] = useState(null) const resetElement = useResetElement() @@ -90,7 +86,7 @@ const ResultsView = ({ resetElement.current.focus() } - const zeroBenefitsResult = eligibilityCount.eligibleBenefitCount.number === 0 + const zeroBenefitsResult = eligibilityCount?.eligibleBenefitCount.number === 0 useEffect(() => { window.scrollTo(0, 0) @@ -110,7 +106,7 @@ const ResultsView = ({ // handle dataLayer useEffect(() => { const { resultsView } = dataLayerUtils.dataLayerStructure - eligibilityCount.notEligibleBenefitCount.number >= 0 && + eligibilityCount !== null && dataLayerUtils.dataLayerPush(window, { event: resultsView.event, bfData: { @@ -141,13 +137,13 @@ const ResultsView = ({ data-analytics-content-criteria-values={criteriaValues} data-analytics-content-benefits={benefitsLength} data-analytics-content-eligible={ - eligibilityCount.eligibleBenefitCount.number + eligibilityCount?.eligibleBenefitCount.number } data-analytics-content-not-eligible={ - eligibilityCount.notEligibleBenefitCount.number + eligibilityCount?.notEligibleBenefitCount.number } data-analytics-content-more-info={ - eligibilityCount.moreInfoBenefitCount.number + eligibilityCount?.moreInfoBenefitCount.number } > Date: Wed, 10 Jul 2024 13:01:35 -0400 Subject: [PATCH 50/52] PXBF-1536-1537-1538-datalayer-updates: benefit count is now part of page change event --- .../cypress/e2e/storybook/dataLayer.cy.js | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js index f8ddf481e..31dc6e51a 100644 --- a/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js +++ b/benefit-finder/cypress/e2e/storybook/dataLayer.cy.js @@ -5,13 +5,8 @@ import { pageObjects } from '../../support/pageObjects' import * as EN_LOCALE_DATA from '../../../../benefit-finder/src/shared/locales/en/en.json' import * as BENEFITS_ELIBILITY_DATA from '../../fixtures/benefits-eligibility.json' -const { - intro, - lifeEventSection, - resultsView, - benefitCount, - openAllBenefitAccordions, -} = dataLayerUtils.dataLayerStructure +const { intro, lifeEventSection, resultsView, openAllBenefitAccordions } = + dataLayerUtils.dataLayerStructure const dataLayerValues = [ { @@ -116,7 +111,7 @@ describe('Calls to Google Analytics Object', function () { .then(() => { // we wait for the last event to fire // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(2000).then(() => { + cy.wait(100).then(() => { // check last page change event const ev = { ...window.dataLayer.filter( @@ -126,17 +121,6 @@ describe('Calls to Google Analytics Object', function () { delete ev[0]['gtm.uniqueEventId'] expect(ev[0]).to.deep.equal(dataLayerValues[2]) - - // // check count event - // const evCount = { - // ...window.dataLayer.filter( - // x => x.event === dataLayerValues[2].event - // ), - // } - - // delete evCount[0]['gtm.uniqueEventId'] - - // expect(dataLayerValues[3]).to.deep.equal(evCount[0]) }) }) }) From 7f3ca7d774ec7b3a6b414b20c6402b65551a4e3e Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 13:02:01 -0400 Subject: [PATCH 51/52] PXBF-1536-1537-1538-datalayer-updates: updated snaps --- .../src/App/__tests__/__snapshots__/index.spec.jsx.snap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benefit-finder/src/App/__tests__/__snapshots__/index.spec.jsx.snap b/benefit-finder/src/App/__tests__/__snapshots__/index.spec.jsx.snap index 578df2ebb..30b9f84ac 100644 --- a/benefit-finder/src/App/__tests__/__snapshots__/index.spec.jsx.snap +++ b/benefit-finder/src/App/__tests__/__snapshots__/index.spec.jsx.snap @@ -348,7 +348,7 @@ exports[`loads window query scenario 1 1`] = ` >

    @@ -6728,7 +6728,7 @@ exports[`loads window query scenario 1 1`] = ` >

    @@ -7104,7 +7104,7 @@ exports[`loads window query scenario 2 1`] = ` >

    @@ -13496,7 +13496,7 @@ exports[`loads window query scenario 2 1`] = ` >

    From 82c5bc72febb79a4ef3d02e2d7b31bb2d0432dc5 Mon Sep 17 00:00:00 2001 From: gscottqueen Date: Wed, 10 Jul 2024 13:02:24 -0400 Subject: [PATCH 52/52] PXBF-1536-1537-1538-datalayer-updates: append modal string to viewTitle --- benefit-finder/src/shared/components/Modal/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benefit-finder/src/shared/components/Modal/index.jsx b/benefit-finder/src/shared/components/Modal/index.jsx index e357bee26..b5d084496 100644 --- a/benefit-finder/src/shared/components/Modal/index.jsx +++ b/benefit-finder/src/shared/components/Modal/index.jsx @@ -109,7 +109,7 @@ const Modal = ({ event: modal.event, bfData: { pageView: modal.bfData.pageView, - viewTitle: dataLayerValue.viewTitle, + viewTitle: `${dataLayerValue.viewTitle} modal`, }, }) }, [])