Skip to content

Commit

Permalink
Merge pull request #1890 from GSA/dev
Browse files Browse the repository at this point in the history
Release v0.8.0.beta.1 (Sprint 42)
  • Loading branch information
scottqueen-bixal authored Oct 21, 2024
2 parents 45ee688 + 0a0237b commit 0a08218
Show file tree
Hide file tree
Showing 88 changed files with 7,313 additions and 5,600 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ jobs:
git submodule update
cd usagov-2021
git checkout prod
- name: Insert rewrite rules in alphabetical order
run: |
sed -i '/^ rewrite \^\/benefits-grants-loans/a\ rewrite ^/benefit-finder/([^/]+)/[^/]+$ /benefit-finder/$1 permanent;' ./usagov-2021/.docker/src-cms/etc/nginx/partials/internal_redirects.conf
sed -i '/^ rewrite \^\/espanol\/beneficios-familias-militares/a\ rewrite ^/espanol/benefit-finder/([^/]+)/[^/]+$ /espanol/benefit-finder/$1 permanent;' ./usagov-2021/.docker/src-cms/etc/nginx/partials/internal_redirects.conf
cat ./usagov-2021/.docker/src-cms/etc/nginx/partials/internal_redirects.conf
sed -i 's/^[[:space:]]*# include partials\/internal_redirects.conf;/ include partials\/internal_redirects.conf;/' ./usagov-2021/.docker/src-cms/etc/nginx/partials/cms.conf.tmpl
cat ./usagov-2021/.docker/src-cms/etc/nginx/partials/cms.conf.tmpl
- name: Merge files into module
run: |
bash ./scripts/pipeline/mv-benefit-finder-app.sh
Expand All @@ -151,8 +158,9 @@ jobs:
sed -i 's/80/8080/g' Dockerfile-cms
sed -i 's/ENTRYPOINT/CMD/' Dockerfile-cms
sed -i 's/\["s3"\]\[\]?/s3\[\]/g' scripts/tome-run.sh scripts/tome-sync.sh
sed -i "s|/var/www/scripts/tome-run.sh \$URI \$@||" .docker/src-cms/etc/periodic/1min/generate-static-site
# sed -i "s|/var/www/scripts/tome-run.sh \$URI \$@||" .docker/src-cms/etc/periodic/1min/generate-static-site
sed -i 's/80/8080/g' .docker/src-cms/etc/nginx/partials/cms.conf.tmpl
sed -i '/listen 8080 default_server;/a\ port_in_redirect off;' .docker/src-cms/etc/nginx/partials/cms.conf.tmpl
sed -i "s/\$service\['name'\] === 'database'/stristr(\$service\['name'\], 'mysql')/" web/sites/default/settings.php
sed -i "s/\$settings\['hash_salt'\] = \$service\['credentials'\]\['HASH_SALT'\]/\$settings\['hash_salt'\] = \$service\['credentials'\]\['hash_salt'\]/" web/sites/default/settings.php
sed -i "s/\$service\['name'\] === 'storage'/stristr(\$service\['name'\], 'storage')/" web/sites/default/settings.php
Expand All @@ -169,7 +177,7 @@ jobs:
with:
images: ghcr.io/${{ vars.CR_REPOSITORY }}
tags: |
type=sha,enable=true,priority=100,prefix=,suffix=,format=short
type=sha,enable=true,priority=100,prefix=,suffifx=,format=short
- name: Build and push Docker image
# uses: docker/[email protected]
uses: docker/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
push:
paths:
- benefit-finder/*
pull_request:
paths:
- benefit-finder/*

permissions: read-all

Expand Down
2 changes: 2 additions & 0 deletions benefit-finder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
|-nginx
|-src
|-App
|-Routes
|-shared
|-api
|-components
Expand Down Expand Up @@ -45,6 +46,7 @@
| `src/index.jsx` | Entry file. |
| `index.html` | All scripts and styles injected here |
| `src/App` | Main application routes, global / ancestor of all modules. |
| `src/Routes` | Route components |
| `src/shared/api` | dev utils for interacting with data |
| `src/shared/components` | Components, constants, machines, hooks, styles, utils etc; |
| `src/shared/hooks` | Custom Hooks |
Expand Down
48 changes: 26 additions & 22 deletions benefit-finder/cypress/e2e/storybook/benefitAccordionGroup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,33 @@ describe('BenefitAccordionGroup component tests', () => {
})

it('Validate opening individual accordion expands the clicked accordion and clicking it again closes it', () => {
// we wait for the last event to fire
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2500)
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'false')
// get the first visible accordion and click it
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button').eq(0).click()
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'true')
// get the second visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(1)
.should('have.attr', 'aria-expanded', 'false')
// get the first visible accordion and click it
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button').eq(0).click()
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'false')
cy.wait(2500).then(() => {
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'false')
// get the first visible accordion and click it
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.click()
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'true')
// get the second visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(1)
.should('have.attr', 'aria-expanded', 'false')
// get the first visible accordion and click it
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.click()
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'false')
})
})

it('Validate clicking Expand all opens all accordions', () => {
Expand Down
86 changes: 52 additions & 34 deletions benefit-finder/cypress/e2e/storybook/dataLayer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ describe('Calls to Google Analytics Object', function () {
.button()
.contains(EN_LOCALE_DATA.intro.button)
.then(() => {

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(wait).then(() => {
assert.isDefined(
window.dataLayer.find(x => x.event === 'gtm.load'),
Expand All @@ -228,7 +230,6 @@ describe('Calls to Google Analytics Object', function () {
)

cy.wait(500).then(() => {
console.log(window.dataLayer)
// get the last pushed event
const bfEventIndex = window.dataLayer.findIndex(
x => x.event === 'bf_page_change'
Expand Down Expand Up @@ -518,49 +519,66 @@ describe('Calls to Google Analytics Object', function () {
})
})

it('results page with not eligible benefits has a bf_page_change and bf_count events', function () {
it.only('results page with not eligible benefits has a bf_page_change and bf_count events', function () {
cy.visit(`${utils.storybookUri}${scenario}`)

cy.window().then(window => {
assert.isDefined(window.dataLayer, 'window.dataLayer is defined')

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2500).then(() => {
// click not eligible benefits view
pageObjects
.notEligibleResultsButton()
.click()
.then(() => {
// get visible benfits results
pageObjects
.benefitsAccordion()
.filter(':visible')
.should(
'have.length',
dataLayerValueResultsViewEligible.bfData.eligibleBenefitCount.number
)
.then(() => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2500).then(() => {
// click not eligible benefits view
pageObjects
.benefitsAccordion()
.filter(':visible')
.should(
'have.length',
dataLayerValueResultsViewNotEligible.bfData
.notEligibleBenefitCount.number +
dataLayerValueResultsViewNotEligible.bfData
.moreInfoBenefitCount.number
)
.notEligibleResultsButton()
.click()
.then(() => {
// we wait for the last event to fire
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(wait).then(() => {
// get all the events in our layer that matches the event value
const ev = [
...window.dataLayer.filter(
x =>
x?.event === dataLayerValueResultsViewNotEligible.event
),
]
removeID(ev[1])

expect(ev[1]).to.deep.equal(
dataLayerValueResultsViewNotEligible
pageObjects
.benefitsAccordion()
.filter(':visible')
.should(
'have.length',
dataLayerValueResultsViewNotEligible.bfData
.notEligibleBenefitCount.number +
dataLayerValueResultsViewNotEligible.bfData
.moreInfoBenefitCount.number
)
})
.then(() => {
// we wait for the last event to fire
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2500).then(() => {
// get all the events in our layer that matches the event value
const ev = [
...window.dataLayer.filter(
x =>
x?.event ===
dataLayerValueResultsViewNotEligible.event
),
]

const bfEventIndex = ev.findIndex(
x =>
x.bfData.viewTitle ===
dataLayerValueResultsViewNotEligible.bfData.viewTitle
)
removeID(ev[bfEventIndex])

expect(ev[bfEventIndex]).to.deep.equal(
dataLayerValueResultsViewNotEligible
)
})
})
})
})
})
})
})
})

Expand Down
25 changes: 11 additions & 14 deletions benefit-finder/cypress/e2e/storybook/openAllAccordions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,17 @@ describe('open all interaction tests', () => {
)

// click step back and they should all be closed again
pageObjects
.stepBackLink()
.click()
.then(() => {
cy.get('.bf-usa-accordion__button.usa-accordion__button').each(
accordion => {
cy.wrap(accordion).should(
'have.attr',
'aria-expanded',
'false'
)
}
)
})
cy.go('back').then(() => {
cy.get('.bf-usa-accordion__button.usa-accordion__button').each(
accordion => {
cy.wrap(accordion).should(
'have.attr',
'aria-expanded',
'false'
)
}
)
})
})
})
})
Expand Down
4 changes: 0 additions & 4 deletions benefit-finder/cypress/support/pageObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ class PageObjects {
return cy.get('[data-testid="bf-result-view-unmet-button"]')
}

stepBackLink() {
return cy.get('.bf-step-back-button')
}

dateOfBirthError() {
return cy.get('[data-testid="error-description-applicant_date_of_birth"]')
}
Expand Down
Loading

0 comments on commit 0a08218

Please sign in to comment.