j40-cejst-2/client/cypress/integration/LegacyTests/mapInfoPanel.spec.js
Vim 47df35b77e
Gherkin cypress spike (#673)
* integrate gherkin/cucumber w/ cypress

- change cypress.json config from e2e back to standard integration
- add cypress-cucumber-preprocessor
- add integration test of about page

* add a title to each page

* add intl to the 404 page

* Refactor explore tool page

- add intl to static strings
- replace component css with <Grid> layout

* Add title to contact page

* add intl to title of page

* Add gherkin tests for nav to about page

- navigate from any page to the about page
- ensure each link has the title correct on that page
2021-09-15 12:06:13 -07:00

67 lines
2.7 KiB
JavaScript

// / <reference types="Cypress" />
/*
A risk with this test is that if the feature/area that is currently being selected become non-prioritized, then this
test will fail. However it would be a major win for that area!
*/
import {ENDPOINTS} from './constants';
const devices = [
[1024, 720],
['iphone-6', 'portrait'],
['samsung-s10', 'portrait'],
];
describe('tests that the map side panel renders MapIntroduction component', () => {
devices.forEach((device) => {
it(`should render MapIntroduction component on ${device[0]} x ${device[1]}`, () => {
cy.visit(ENDPOINTS.EXPLORE_THE_TOOL);
cy.viewport(device[0], device[1]);
cy.get('aside').should('be.visible');
});
});
});
/**
* Todo: Ticket #423:
*
* After fixing the PR deployed URL in regards to the mobile view (parent height
* not setting to 44vh) by creating a state variable to force a re-render, this
* cypress test regressed and is now failing. Need to investigate why.
*
* See this ticket for more info:
* https://app.zenhub.com/workspaces/justice40-60993f6e05473d0010ec44e3/issues/usds/justice40-tool/423
*
* Tried
* 1. reloading the page
* 2. forcing the 44vh value via a selector (data-cy and class)
*/
// describe('tests that the map side panel renders AreaDetail component', () => {
// devices.forEach((device) => {
// it(`should render AreaDetail component on ${device[0]} x ${device[1]}`, () => {
// // Only set the viewport for mobile devices:
// cy.visit(ENDPOINTS.EXPLORE_THE_TOOL);
// if (!Number.isInteger(device[0])) cy.viewport(device[0], device[1]);
// cy.reload(true);
// cy.get('div[class*="mapContainer"]').invoke('attr', 'height', '44vh');
// cy.getMap().then((map) => {
// // Loop over the click event simulating zooming by a certain amount
// // The map will end at the end zoom level
// const endZoomLevel = device[0].isInteger ? 11 : 10;
// for (let zoom = 3; zoom <= endZoomLevel; zoom++) {
// cy.get('.mapboxgl-ctrl-zoom-in > .mapboxgl-ctrl-icon').click();
// cy.waitForMapIdle(map);
// }
// cy.get('.overlays').click('bottomRight');
// cy.get('aside').should('be.visible');
// cy.get('[data-cy="score"]').should('be.visible');
// cy.get('[data-cy="indicatorBox"]').should('be.visible');
// cy.get('[data-cy="indicatorBox"]')
// .each((indicator) => cy.wrap(indicator)
// // currently the padding-top on desktop = 1.5rem => 24px
// // currently the padding-top on mobile = .8 rem => 8px
// .should('have.css', 'padding-top', `${Number.isInteger(device[0]) ? '24px' : '8px'}`));
// });
// });
// });
// });