diff --git a/.circleci/config.yml b/.circleci/config.yml index c472ab965..86d7177ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -287,6 +287,22 @@ jobs: npm install npm run cy:pipeline:proofer when: on_fail + home-page-redirect: + docker: + - image: cypress/included:cypress-13.14.2-node-20.17.0-chrome-128.0.6613.119-1-ff-130.0-edge-128.0.2739.63-1 + environment: + cypress_pipeline: 1 + cypress_cloudgov_application_name: "${project}-drupal-${CIRCLE_BRANCH}" + steps: + - checkout + - attach_workspace: + at: ~/ + - run: + name: "Home Page Redirect" + command: | + cd testing + npm install + npm run cy:pipeline:hpRedirect workflows: deploy-workflow: when: @@ -396,6 +412,16 @@ workflows: - prod jobs: - link-validation + home-page-redirect-workflow: + triggers: + - schedule: + cron: '0 9 * * 1-5' + filters: + branches: + only: + - prod + jobs: + - home-page-redirect scheduled-backup-workflow: when: and: diff --git a/testing/cypress/e2e/frontEndTests/touchpoints-module.cy.js b/testing/cypress/e2e/frontEndTests/touchpoints-module.cy.js new file mode 100644 index 000000000..83b690538 --- /dev/null +++ b/testing/cypress/e2e/frontEndTests/touchpoints-module.cy.js @@ -0,0 +1,14 @@ +/// + +import { pageObjects } from "../../support/pageObjects" + +describe('Check Touchpoints Module', () => { + it('Verify that module is opening', () => { + cy.visit('/') + + pageObjects + .touchpointsBtn().click() + + cy.get('[class="fba-usa-modal fba-modal"]').should('be.visible') + }) +}) diff --git a/testing/cypress/e2e/redirect/homepage-redirect.cy.js b/testing/cypress/e2e/redirect/homepage-redirect.cy.js new file mode 100644 index 000000000..30b99d055 --- /dev/null +++ b/testing/cypress/e2e/redirect/homepage-redirect.cy.js @@ -0,0 +1,39 @@ +/// + +const baseurl = 'https://vote.gov'; +const languages = [ + "es", + "am", + "ar", + "bn", + "zh-hans", + "zh", + "fr", + "ht", + "hi", + "km", + "ko", + "pt", + "ru", + "so", + "tl", + "vi", + "ypk" +]; + +describe('Homepage Redirect Check', () => { + languages.forEach(language => { + it(`Verify ${language} homepage does not redirect`, () => { + cy.visit(`${baseurl}/${language}`).then(() => { + cy.get('body').then($body => { + if ($body.text().includes('Redirecting to')) { + cy.log(`Error: Redirecting to detected for ${language}`); + expect(false, `Redirecting to detected for ${language}`).to.be.true; + } else { + cy.log(`Success: No redirect detected for ${language}`); + } + }); + }) + }); + }); +}); diff --git a/testing/cypress/fixtures/language-urls.json b/testing/cypress/fixtures/language-urls.json new file mode 100644 index 000000000..73e7fa7fb --- /dev/null +++ b/testing/cypress/fixtures/language-urls.json @@ -0,0 +1,20 @@ +[ + "en", + "es", + "am", + "ar", + "bn", + "zh-hans", + "zh", + "fr", + "ht", + "hi", + "km", + "ko", + "pt", + "ru", + "so", + "tl", + "vi", + "ypk" +] diff --git a/testing/cypress/support/pageObjects.js b/testing/cypress/support/pageObjects.js index cccec506b..f206a84a3 100644 --- a/testing/cypress/support/pageObjects.js +++ b/testing/cypress/support/pageObjects.js @@ -108,6 +108,10 @@ class PageObjects { return cy.get('[data-test="stateList"]') } + touchpointsBtn() { + return cy.get('[data-test="touchpointsBtn"]') + } + // Backend Tests pageTitle() { return cy.get('[data-drupal-selector="edit-title-0-value"]') diff --git a/testing/package.json b/testing/package.json index 0e611b995..b45cffd01 100644 --- a/testing/package.json +++ b/testing/package.json @@ -24,7 +24,8 @@ "cy:pipeline:frontEnd": "cypress run --spec 'cypress/e2e/frontEndTests/**/*' --config-file pipeline.config.js", "cy:pipeline:axe": "cypress run --spec 'cypress/e2e/accessibility/**/*' --config-file pipeline.config.js", "cy:pipeline:links": "cypress run --spec 'cypress/e2e/internalLinks/**/*' --config-file pipeline.config.js", - "cy:pipeline:proofer": "cypress run --spec 'cypress/e2e/externalLinks/**/*' --config-file pipeline.config.js" + "cy:pipeline:proofer": "cypress run --spec 'cypress/e2e/externalLinks/**/*' --config-file pipeline.config.js", + "cy:pipeline:hpRedirect": "cypress run --spec 'cypress/e2e/redirect/**/*' --config-file pipeline.config.js" }, "repository": { "type": "git",