mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 10:04:18 -08:00
Fix all failing cypress tests (#774)
* Fix all failing cypress tests - update test name to be more appropriate - update download packet tests to CDN - update data-cy tag on About heading * Update snapshot
This commit is contained in:
parent
e47cffc3f9
commit
819113ceb7
11 changed files with 52 additions and 41 deletions
|
@ -1,17 +1,17 @@
|
||||||
Feature: Does the About page open?
|
Feature: Does the About page open?
|
||||||
I want to open the about page
|
I want to open the about page
|
||||||
|
|
||||||
Scenario: About page from Explore Tool page
|
Scenario: About page FROM Explore Tool page
|
||||||
Given I am on the Explore Tool page
|
Given I am on the Explore Tool page
|
||||||
When I click on the "About" page in the navigation
|
When I click on the "About" page in the navigation
|
||||||
Then I see "About" in the title
|
Then I see "About" in the title
|
||||||
|
|
||||||
Scenario: About page from Methodology page
|
Scenario: About page FROM Methodology page
|
||||||
Given I am on the Explore Tool page
|
Given I am on the Explore Tool page
|
||||||
When I click on the "Methodology" page in the navigation
|
When I click on the "Methodology" page in the navigation
|
||||||
Then I see "Data and Methodology" in the title
|
Then I see "Data and Methodology" in the title
|
||||||
|
|
||||||
Scenario: About page from Contact page
|
Scenario: About page FROM Contact page
|
||||||
Given I am on the Explore Tool page
|
Given I am on the Explore Tool page
|
||||||
When I click on the "Contact" page in the navigation
|
When I click on the "Contact" page in the navigation
|
||||||
Then I see "Contact" in the title
|
Then I see "Contact" in the title
|
|
@ -47,9 +47,9 @@ function terminalLog(violations) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
describe('Accessibility checks', () => {
|
describe('Do the accessibility checks pass on each page?', () => {
|
||||||
endpoints.forEach((endpoint) => {
|
endpoints.forEach((endpoint) => {
|
||||||
it(`Check Accessibility on ${endpoint} page`, () => {
|
it(`Check accessibility on ${endpoint} page`, () => {
|
||||||
cy.visit(endpoint).get('main').then(() => {
|
cy.visit(endpoint).get('main').then(() => {
|
||||||
cy.injectAxe();
|
cy.injectAxe();
|
||||||
cy.checkA11y(null, null, terminalLog);
|
cy.checkA11y(null, null, terminalLog);
|
||||||
|
|
22
client/cypress/integration/LegacyTests/allLinks.spec.js
Normal file
22
client/cypress/integration/LegacyTests/allLinks.spec.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// / <reference types="Cypress" />
|
||||||
|
|
||||||
|
describe('Do all the English pages have all links with a defined href attribute?', () => {
|
||||||
|
const pages = [
|
||||||
|
'/',
|
||||||
|
'cejst',
|
||||||
|
'methodology',
|
||||||
|
'contact',
|
||||||
|
];
|
||||||
|
|
||||||
|
pages.forEach((page) => {
|
||||||
|
it(`test all href attr on ${page} page`, () => {
|
||||||
|
cy.visit(page);
|
||||||
|
|
||||||
|
// Checks to make sure all a tags have an href:
|
||||||
|
cy.get('a').each(($a) => {
|
||||||
|
const message = $a.text();
|
||||||
|
expect($a, message).to.have.attr('href').not.contain('undefined');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,13 +1,14 @@
|
||||||
// / <reference types="Cypress" />
|
// / <reference types="Cypress" />
|
||||||
|
|
||||||
describe('Census Block Group packet download', () => {
|
describe('Does the Census Block Group packet download?', () => {
|
||||||
const filename = `Screening_Tool_Data.zip`;
|
const filename = `Screening_Tool_Data.zip`;
|
||||||
it('validate file download', () => {
|
it('validate file download', () => {
|
||||||
cy.visit('localhost:8000/en/methodology');
|
cy.visit('localhost:8000/en/methodology');
|
||||||
|
|
||||||
cy.get('[data-cy="download-link"]').invoke('attr', 'target', '_blank');
|
cy.get('[data-cy="download-link"]').invoke('attr', 'target', '_blank');
|
||||||
cy.intercept(`https://d3jqyw10j8e7p9.cloudfront.net/data-pipeline/data/score/downloadable/${filename}`,
|
cy.intercept('GET', '/data-pipeline/data/score/downloadable/Screening_Tool_Data.zip',
|
||||||
{
|
{
|
||||||
|
hostname: 'https://d3jqyw10j8e7p9.cloudfront.net',
|
||||||
body: 'success',
|
body: 'success',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'text/html; charset=utf-8',
|
'Content-Type': 'text/html; charset=utf-8',
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
// / <reference types="Cypress" />
|
|
||||||
|
|
||||||
describe('tests links on Explore Tool Page', () => {
|
|
||||||
it('validate file download', () => {
|
|
||||||
cy.visit('localhost:8000/en/cejst');
|
|
||||||
|
|
||||||
// Checks to make sure all a tags have an href:
|
|
||||||
cy.get('a').each(($a) => {
|
|
||||||
const message = $a.text();
|
|
||||||
expect($a, message).to.have.attr('href').not.contain('undefined');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -4,7 +4,7 @@ describe('Translation Test', () => {
|
||||||
it('Sets default language to /en and redirects', () => {
|
it('Sets default language to /en and redirects', () => {
|
||||||
cy.visit('http://localhost:8000');
|
cy.visit('http://localhost:8000');
|
||||||
cy.url().should('include', '/en/');
|
cy.url().should('include', '/en/');
|
||||||
cy.get('[data-cy=about-screen-tool-heading]').contains('About the screening tool');
|
cy.get('[data-cy=about-page-heading]').contains('About');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Todo VS: Understand how to create es content
|
// Todo VS: Understand how to create es content
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
// / <reference types="Cypress" />
|
// / <reference types="Cypress" />
|
||||||
|
|
||||||
describe('LatLng Test', () => {
|
describe('Does the map zoom and adjust to lat/long correctly?', () => {
|
||||||
it('URL starts at zoom level 3', () => {
|
it('should start at zoom level 3', () => {
|
||||||
cy.visit('http://localhost:8000/en/cejst');
|
cy.visit('http://localhost:8000/en/cejst');
|
||||||
cy.url().should('include', '#3');
|
cy.url().should('include', '#3');
|
||||||
});
|
});
|
||||||
it('URL changes to level 4 when you hit the zoom button', () => {
|
it('should change to level 4 when you hit the zoom button', () => {
|
||||||
cy.get('.mapboxgl-ctrl-zoom-in > .mapboxgl-ctrl-icon').click();
|
cy.get('.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-in').click();
|
||||||
cy.url().should('include', '#4');
|
cy.url().should('include', '#4');
|
||||||
});
|
});
|
||||||
it('URL includes correct lat/lng coordinates', () => {
|
it('should show the correct lat/lng coordinates in the URL', () => {
|
||||||
cy.getMap().then((map) => {
|
cy.getMap().then((map) => {
|
||||||
cy.panTo(map, [-77.9, 35.04]);
|
cy.panTo(map, [-77.9, 35.04]);
|
||||||
cy.url().should('include', '#4/35.04/-77.9');
|
cy.url().should('include', '#4/35.04/-77.9');
|
|
@ -1,6 +1,6 @@
|
||||||
// / <reference types="Cypress" />
|
// / <reference types="Cypress" />
|
||||||
|
|
||||||
describe('Tests for the Explore the Map page', () => {
|
describe('Will it zoom into territories correctly?', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport('macbook-13');
|
cy.viewport('macbook-13');
|
||||||
cy.visit('http://localhost:8000/en/cejst');
|
cy.visit('http://localhost:8000/en/cejst');
|
||||||
|
@ -8,21 +8,24 @@ describe('Tests for the Explore the Map page', () => {
|
||||||
|
|
||||||
// The below values all assume a 13-inch MB as set in viewport above.
|
// The below values all assume a 13-inch MB as set in viewport above.
|
||||||
// Values will be different for different screens
|
// Values will be different for different screens
|
||||||
|
|
||||||
|
// Removing z as each tests has variance on it's value
|
||||||
const tests = {
|
const tests = {
|
||||||
'Lower 48': '3.19/38.07/-95.87',
|
'Lower 48': '/38.07/-95.87',
|
||||||
'Puerto Rico': '7.65/18.2/-66.583',
|
'Puerto Rico': '/18.2/-66.583',
|
||||||
|
|
||||||
// Todo: Understand what causes these two to hang intermittently ticket #579
|
// Todo: Understand what causes these two to hang intermittently ticket #579
|
||||||
// 'Alaska': '3/63.28/-162.39',
|
// 'Alaska': '/63.28/-162.39',
|
||||||
// 'Hawaii': '5.35/20.574/-161.438',
|
// 'Hawaii': '5.35/20.574/-161.438',
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const [territory, zxy] of Object.entries(tests)) {
|
for (const [territory, xy] of Object.entries(tests)) {
|
||||||
it(`Can focus on ${territory} `, () => {
|
it(`Can focus on ${territory} `, () => {
|
||||||
cy.getMap().then((map) => {
|
cy.getMap().then((map) => {
|
||||||
cy.get(`[aria-label="Focus on ${territory}"]`).click();
|
cy.get(`[aria-label="Focus on ${territory}"]`).click();
|
||||||
cy.waitForMapIdle(map);
|
cy.waitForMapIdle(map);
|
||||||
cy.url().should('include', zxy);
|
cy.log(cy.url());
|
||||||
|
cy.url().should('include', xy);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
|
@ -31,7 +31,7 @@ const AboutCard = (props: React.PropsWithChildren<AboutCardProps>) => {
|
||||||
|
|
||||||
<Grid tablet={{col: 9}}>
|
<Grid tablet={{col: 9}}>
|
||||||
<Grid row>
|
<Grid row>
|
||||||
<h2 data-cy={'about-screen-tool-heading'}>{props.header}</h2>
|
<h2>{props.header}</h2>
|
||||||
{props.children}
|
{props.children}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -284,7 +284,9 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
|
||||||
class="grid-container-desktop-lg"
|
class="grid-container-desktop-lg"
|
||||||
data-testid="gridContainer"
|
data-testid="gridContainer"
|
||||||
>
|
>
|
||||||
<h1>
|
<h1
|
||||||
|
data-cy="about-page-heading"
|
||||||
|
>
|
||||||
About us
|
About us
|
||||||
</h1>
|
</h1>
|
||||||
<div
|
<div
|
||||||
|
@ -317,9 +319,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
|
||||||
class="grid-row"
|
class="grid-row"
|
||||||
data-testid="grid"
|
data-testid="grid"
|
||||||
>
|
>
|
||||||
<h2
|
<h2>
|
||||||
data-cy="about-screen-tool-heading"
|
|
||||||
>
|
|
||||||
The screening tool
|
The screening tool
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
|
@ -363,9 +363,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
|
||||||
class="grid-row"
|
class="grid-row"
|
||||||
data-testid="grid"
|
data-testid="grid"
|
||||||
>
|
>
|
||||||
<h2
|
<h2>
|
||||||
data-cy="about-screen-tool-heading"
|
|
||||||
>
|
|
||||||
The Justice40 Initiative
|
The Justice40 Initiative
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -41,7 +41,7 @@ const IndexPage = ({location}: IndexPageProps) => {
|
||||||
</J40MainGridContainer>
|
</J40MainGridContainer>
|
||||||
|
|
||||||
<J40MainGridContainer>
|
<J40MainGridContainer>
|
||||||
<h1>{intl.formatMessage(ABOUT_COPY.PAGE.HEADING)}</h1>
|
<h1 data-cy={'about-page-heading'}>{intl.formatMessage(ABOUT_COPY.PAGE.HEADING)}</h1>
|
||||||
<AboutCardsContainer>
|
<AboutCardsContainer>
|
||||||
<AboutCard
|
<AboutCard
|
||||||
size={'large'}
|
size={'large'}
|
||||||
|
|
Loading…
Add table
Reference in a new issue