This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from cfpb/560-add-cypress-tests
Add Cypress tests
- Loading branch information
Showing
85 changed files
with
739 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"chromeWebSecurity": false, | ||
"pluginsFile": false, | ||
"env": { | ||
"HH_INSTITUTION": "FRONTENDTESTBANK9999", | ||
"HH_AUTH_REALM": "hmda2", | ||
"HH_AUTH_CLIENT_ID": "hmda2-api", | ||
"HH_HOST": "http://localhost:3000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
const { | ||
HH_HOST, | ||
HH_USERNAME, | ||
HH_PASSWORD, | ||
HH_INSTITUTION, | ||
HH_AUTH_URL, | ||
HH_AUTH_REALM, | ||
HH_AUTH_CLIENT_ID | ||
} = Cypress.env() | ||
|
||
describe('HMDA Help', () => { | ||
beforeEach(() => { | ||
cy.logout({ root: HH_AUTH_URL, realm: HH_AUTH_REALM }) | ||
cy.login({ | ||
root: HH_AUTH_URL, | ||
realm: HH_AUTH_REALM, | ||
client_id: HH_AUTH_CLIENT_ID, | ||
redirect_uri: HH_HOST, | ||
username: HH_USERNAME, | ||
password: HH_PASSWORD | ||
}) | ||
cy.viewport(1600, 900) | ||
cy.visit(HH_HOST) | ||
}) | ||
|
||
it('Can update existing Institutions', () => { | ||
// Search for existing Instititution | ||
cy.findByLabelText("LEI").type(HH_INSTITUTION) | ||
cy.findByText('Search institutions').click() | ||
cy.findAllByText('Update') | ||
.first() | ||
.click() | ||
|
||
const successMessage = `The institution, ${HH_INSTITUTION}, has been updated.` | ||
const nameLabelText = 'Respondent Name' | ||
const updateButtonText = 'Update the institution' | ||
const testName = 'Cypress Test Name Update' | ||
|
||
cy.findByLabelText(nameLabelText).then($name => { | ||
const savedName = $name.attr('value') | ||
expect($name.attr('value')).to.not.contain(testName) | ||
|
||
// Change Respondent Name | ||
cy.findByLabelText(nameLabelText) | ||
.type('{selectAll}' + testName) | ||
.blur() | ||
.then($name2 => { | ||
cy.findByText(updateButtonText) | ||
.should('be.enabled') | ||
.click() | ||
.then(() => { | ||
// Validate | ||
cy.findAllByText(successMessage) | ||
.should('exist') | ||
.then(() => { | ||
expect($name2.attr('value')).to.contain(testName) | ||
}) | ||
}) | ||
}) | ||
|
||
// Change it back | ||
cy.findByLabelText(nameLabelText) | ||
.type('{selectAll}' + savedName) | ||
.blur() | ||
.then(() => { | ||
cy.findByText(updateButtonText) | ||
.should('be.enabled') | ||
.click() | ||
.then(() => { | ||
// Validate | ||
cy.findAllByText(successMessage) | ||
.should('exist') | ||
.then(() => { | ||
expect($name.attr('value')).to.contain(savedName) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
it('Can delete and create Institutions', () => { | ||
const institution = 'MEISSADIATESTBANK001' | ||
const year = '2020' | ||
|
||
// Delete | ||
cy.findByLabelText("LEI").type(`${institution}{enter}`) | ||
cy.get('table.institutions tbody tr').first().get('td').first().should('contain', year) | ||
cy.findAllByText('Delete').first().click() | ||
cy.findAllByText('Yes').first().click() | ||
cy.get('table.institutions tbody tr').first().get('td').first().should('not.contain', year) | ||
|
||
// Create | ||
cy.visit(HH_HOST) | ||
cy.findByLabelText("LEI").type("MEISSADIATESTBANK001{enter}") | ||
cy.findByText(`Add ${institution} for ${year}`).click() | ||
|
||
cy.findByLabelText('Activity Year').select(year).should('have.value', year) | ||
cy.findByLabelText('Respondent Name').type('MD Bank 1') | ||
cy.findByLabelText('Email Domains').type('bank1.com') | ||
cy.findByLabelText('Tax Id').type('53-0000001') | ||
cy.findByLabelText('9 - Consumer Financial Protection Bureau (CFPB)').click() | ||
|
||
cy.findByText('Show other fields').click() | ||
cy.findByLabelText('RSSD').type('-1') | ||
cy.findByLabelText('Parent ID RSSD').type('-1') | ||
cy.findByLabelText('Assets').type('-1') | ||
cy.findByLabelText('Top Holder ID RSSD').type('-1') | ||
|
||
cy.findByText('Add the institution') | ||
.should('be.enabled') | ||
.click() | ||
|
||
cy.findAllByText(`The institution, ${institution}, has been added!`).should('exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// *********************************************************** | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
import '@testing-library/cypress/add-commands' | ||
import 'cypress-keycloak'; |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.94 KB
npm-packages-offline-cache/@samverschueren-stream-to-observable-0.3.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+8.87 KB
...ne-cache/electron-to-chromium-1.3.505.tgz → ...ne-cache/electron-to-chromium-1.3.506.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.