Skip to content

Commit

Permalink
Initial cypress commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel committed Jan 27, 2025
1 parent 13fcc61 commit ccebd3a
Show file tree
Hide file tree
Showing 13 changed files with 3,162 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

# dependencies
/node_modules
/tests/node_modules
/.pnp
.pnp.js
vendor
Expand Down
11 changes: 11 additions & 0 deletions tests/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
require('@cypress/grep/src/plugin')(config);
return config;
},
},
});
9 changes: 9 additions & 0 deletions tests/cypress/e2e/agencies.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Title
// List of agencies
// cards have logo, title, and explore button
// all are present on load

// USA banner
// mvp banner
// header is there
// Check breadcrumb
2 changes: 2 additions & 0 deletions tests/cypress/e2e/footer.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Make sure footer exists
// There is nothing in it
15 changes: 15 additions & 0 deletions tests/cypress/e2e/goal.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Check for decoration per goal type

// sidebar check
// title
// about section
// link to strategic plan
// objectives
// performance indicators if they exist
// fallback for no indicators


// USA banner
// mvp banner
// header is there
// Check breadcrumb
11 changes: 11 additions & 0 deletions tests/cypress/e2e/header.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Check to see if it exists
// check for logo
// check for goals, agencies links
// check for search bar

// for mobile
// logo is there
// menu button is there
// menu button opens panel
// links in panel
// search in panel
28 changes: 28 additions & 0 deletions tests/cypress/e2e/homepage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
describe('The home page', () => {
beforeEach(() => {
cy.visit('/');
});
it('successfully loads', {tags: ['@homepage', '@smoke']}, () => {
cy.findByRole('heading', {level: 1, name: "Track the U.S. Government's goals"}).should('exist');
});

it('has 9 goal cards on load', {tags: ['@homepage', '@smoke', '@goalSearch', '@goals']}, () => {
cy.get('.usa-card-group').within(($group) => {
cy.findAllByRole('listitem').should('have.length', 9);
});
});
});

// search is there
// search filters goals when used
// tags are present
// tags filter when used
// tags are disabled when they don't match
// clearing tags enables previously disabled ones
// Show more button works
// cards have title, description if present, and explore goal button

// USA banner
// mvp banner
// header is there
// Check breadcrumb doesn't exist
15 changes: 15 additions & 0 deletions tests/cypress/e2e/individual_agency.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Test sidebar links
// Test for logo
// Title
// Mission
// Description
// strategicplan
// strategic goals
// APGs
// Related documents
// Do strategic plan again

// USA banner
// mvp banner
// header is there
// Check breadcrumb
5 changes: 5 additions & 0 deletions tests/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
26 changes: 26 additions & 0 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
import '@testing-library/cypress/add-commands'
20 changes: 20 additions & 0 deletions tests/cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
import registerCypressGrep from '@cypress/grep/src/support';

registerCypressGrep();
Loading

0 comments on commit ccebd3a

Please sign in to comment.