diff --git a/cypress/e2e/state-calculator-events.cy.ts b/cypress/e2e/state-calculator-events.cy.ts index 7cec652..24b7f38 100644 --- a/cypress/e2e/state-calculator-events.cy.ts +++ b/cypress/e2e/state-calculator-events.cy.ts @@ -14,8 +14,6 @@ describe('rewiring-america-state-calculator events', () => { element.get(0).addEventListener('calculator-submitted', submit); }); - cy.selectProjects(['hvac', 'ev']); - cy.get('rewiring-america-state-calculator') .shadow() .find('input#zip') @@ -29,10 +27,6 @@ describe('rewiring-america-state-calculator events', () => { expect(event.detail).to.exist; expect(event.detail.formData).to.exist; expect(event.detail.formData.zip).to.equal('02859'); - expect(Array.from(event.detail.formData.projects).sort()).to.eql([ - 'ev', - 'hvac', - ]); }); }); diff --git a/cypress/e2e/state-calculator.cy.ts b/cypress/e2e/state-calculator.cy.ts index d982891..2b4ce8d 100644 --- a/cypress/e2e/state-calculator.cy.ts +++ b/cypress/e2e/state-calculator.cy.ts @@ -26,8 +26,6 @@ describe('rewiring-america-state-calculator', () => { }); it('fetches results if you submit after entering a RI zip code', () => { - cy.selectProjects(['hvac']); - cy.get('rewiring-america-state-calculator') .shadow() .find('input#zip') @@ -51,7 +49,9 @@ describe('rewiring-america-state-calculator', () => { cy.get('rewiring-america-state-calculator') .shadow() - .contains('Incentives you’re interested in'); + .contains(/We found \d+ results across \d+ projects./); + + cy.selectProjects(['hvac']); cy.get('rewiring-america-state-calculator') .shadow() @@ -73,10 +73,6 @@ describe('rewiring-america-state-calculator', () => { .shadow() .contains('$2,000 off an air source heat pump'); - cy.get('rewiring-america-state-calculator') - .shadow() - .contains('Other incentives available to you'); - cy.get('rewiring-america-state-calculator') .shadow() .contains('Brought to you in partnership with'); @@ -88,54 +84,6 @@ describe('rewiring-america-state-calculator', () => { }); }); - it('shows an empty state if you are not eligible for any incentives for your chosen project', () => { - cy.selectProjects(['cooking']); - - cy.get('rewiring-america-state-calculator') - .shadow() - .find('#zip') - .type('02859'); - - // "force" to work around a Cypress bug - // https://github.com/cypress-io/cypress/issues/5830 - cy.get('rewiring-america-state-calculator') - .shadow() - .find('#household_income') - .type('200000{enter}', { force: true }); - - // make sure we saw an empty result state, and scroll down to it: - cy.get('rewiring-america-state-calculator') - .shadow() - .contains('No incentives available for this project') - .scrollIntoView(); - - cy.get('rewiring-america-state-calculator') - .shadow() - .checkA11y(null, { - runOnly: ['wcag2a', 'wcag2aa'], - }); - - // // make sure we have scrolled down - cy.get('rewiring-america-state-calculator') - .shadow() - .contains('Your household info') - .isNotInViewport(); - - cy.get('rewiring-america-state-calculator') - .shadow() - .contains('Back to calculator') - .click(); - - // wait for animated scroll - cy.wait(1000); - - // make sure we scrolled back up - cy.get('rewiring-america-state-calculator') - .shadow() - .contains('Your household info') - .isInViewport(); - }); - it('shows an error if you query in the wrong state', () => { // Add the state-restricting attribute to the element cy.get('rewiring-america-state-calculator').invoke('attr', 'state', 'RI'); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index ebed843..5484a9e 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -88,7 +88,7 @@ Cypress.Commands.add( (projects: string[]) => { cy.get('rewiring-america-state-calculator') .shadow() - .find('button#projects') + .find('button#project-selector') .click(); projects.forEach(project => @@ -98,11 +98,5 @@ Cypress.Commands.add( .find(`li[data-value="${project}"]`) .click(), ); - - // Unfocus the project selector - cy.get('rewiring-america-state-calculator') - .shadow() - .find('button#projects') - .click(); }, );