Skip to content

Commit

Permalink
Merge pull request #2202 from fecgov/release/sprint-48
Browse files Browse the repository at this point in the history
Release/sprint 48
  • Loading branch information
dheitzer authored Oct 3, 2024
2 parents 78dd851 + e08ea3c commit 1266208
Show file tree
Hide file tree
Showing 69 changed files with 17,782 additions and 16,971 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ jobs:
git checkout ${CIRCLE_BRANCH}; \
npm install; \
node --max_old_space_size=4000 ./node_modules/@angular/cli/bin/ng e2e --spec "cypress/e2e/**/*.cy.ts" --headless --watch=false --browser chrome;'\
- run:
name: print api logs
when: always
command: |
docker logs --tail 100 fecfile-api
- run:
name: stage test result artifacts
when: always
Expand Down
56 changes: 0 additions & 56 deletions front-end/.eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion front-end/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
video: false,
videosFolder: 'cypress/videos',
screenshotsFolder: 'cypress/screenshots',
screenshotOnRunFailure: false,
screenshotOnRunFailure: true,
fixturesFolder: 'cypress/fixtures',
trashAssetsBeforeRuns: false,
viewportHeight: 768,
Expand Down
5 changes: 5 additions & 0 deletions front-end/cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ export CYPRESS_COMMITTEE_ID=''
export CYPRESS_PASSWORD=''
sudo circleci local execute -e CIRCLE_BRANCH=${CIRCLE_BRANCH} -e E2E_DJANGO_SECRET_KEY=${E2E_DJANGO_SECRET_KEY} -e E2E_DATABASE_URL=${E2E_DATABASE_URL} -e CYPRESS_EMAIL=${CYPRESS_EMAIL} -e CYPRESS_COMMITTEE_ID=${CYPRESS_COMMITTEE_ID} -e CYPRESS_PASSWORD=${CYPRESS_PASSWORD} --job e2e-test
```

## Tips for Writing E2E Tests

- Assertions made immediately after a page load will sometimes check the previous page before the new page loads. Add checks to ensure that the new page has loaded where possible.
- The `.contains()` Cypress method cannot find the value of a text input field. For assertions, you can instead use the `.should('have.value', VALUE)` method.
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ describe('Form 24 Independent Expenditures', () => {

PageUtils.clickButton('Save');
PageUtils.clickLink('Independent Expenditure');
cy.contains(individualContactFormData.first_name).should('exist');
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains('Address').should('exist');
cy.get('#first_name').should('have.value', individualContactFormData.first_name);
cy.get('#last_name').should('have.value', individualContactFormData.last_name);

ReportListPage.editReport('12-DAY PRE-GENERAL');
PageUtils.clickSidebarItem('Manage your transactions');
PageUtils.clickLink('Independent Expenditure');
cy.contains(individualContactFormData.first_name).should('exist');
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains('Address').should('exist');
cy.get('#first_name').should('have.value', individualContactFormData.first_name);
cy.get('#last_name').should('have.value', individualContactFormData.last_name);
});
});
19 changes: 12 additions & 7 deletions front-end/cypress/e2e/F3X/disbursements.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ describe('Disbursements', () => {
TransactionDetailPage.enterScheduleFormData(defaultTransactionFormData);

PageUtils.clickButton('Save');
cy.contains('Transactions in this report').should('exist');
PageUtils.clickLink('100% Federal Election Activity Payment');
cy.contains(individualContactFormData.first_name).should('exist');
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains('Address').should('exist');
cy.get('#last_name').should('have.value', individualContactFormData.last_name);
cy.get('#first_name').should('have.value', individualContactFormData.first_name);
});

it('should test Independent Expenditure - Void Schedule E disbursement', () => {
Expand All @@ -67,7 +69,8 @@ describe('Disbursements', () => {

PageUtils.clickButton('Save');
PageUtils.clickLink('Independent Expenditure - Void');
cy.contains(organizationFormData.name).should('exist');
cy.contains('Address').should('exist');
cy.get('#organization_name').should('have.value', organizationFormData.name);
});

it('should be able to link an Independent Expenditure to a Form 24', () => {
Expand All @@ -85,8 +88,9 @@ describe('Disbursements', () => {

PageUtils.clickButton('Save');
PageUtils.clickLink('Independent Expenditure');
cy.contains(individualContactFormData.first_name).should('exist');
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains('Address').should('exist');
cy.get('#first_name').should('have.value', individualContactFormData.first_name);
cy.get('#last_name').should('have.value', individualContactFormData.last_name);
PageUtils.clickSidebarItem('Manage your transactions');

PageUtils.getKabob('Independent Expenditure').click();
Expand All @@ -98,8 +102,9 @@ describe('Disbursements', () => {

ReportListPage.editReport('FORM 24');
PageUtils.clickLink('Independent Expenditure');
cy.contains(individualContactFormData.first_name).should('exist');
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains('Address').should('exist');
cy.get('#first_name').should('have.value', individualContactFormData.first_name);
cy.get('#last_name').should('have.value', individualContactFormData.last_name);
});

it('Create an Other Disbursement transaction', () => {
Expand Down
20 changes: 5 additions & 15 deletions front-end/cypress/e2e/pages/loginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export class LoginPage {
`Login Through ${intervalString}`,
() => {
//apiLogin();
legacyLogin();
//legacyLogin();
loginDotGovLogin();
},
{
cacheAcrossSpecs: true,
Expand Down Expand Up @@ -54,29 +55,18 @@ function getLoginIntervalString(sessionDur: number): string {
}
}

function legacyLogin() {
//Dummy login information
const email = Cypress.env('EMAIL');
function loginDotGovLogin() {
const committeeID = Cypress.env('COMMITTEE_ID');
const testPassword = Cypress.env('PASSWORD');

//login page form-fields' id's (or classes where elements have no id's)
const fieldEmail = '#emailId';
const fieldCommittee = '#committeeId';
const fieldPassword = '#loginPassword';

cy.intercept('POST', 'http://localhost:8080/api/v1/user/login/authenticate').as('GetLoggedIn');
cy.intercept('GET', 'http://localhost:8080/api/v1/oidc/login-redirect').as('GetLoggedIn');
cy.intercept('GET', `http://localhost:8080/api/v1/openfec/${committeeID}/committee`, {
fixture: 'FEC_Get_Committee_Account',
}).as('GetCommitteeAccounts');
cy.intercept('POST', 'http://localhost:8080/api/v1/committees/*/activate/').as('ActivateCommittee');

cy.visit('/');
cy.get('#dropdownMenuButton').click();
cy.get('[data-test="debug-login-button"]').click();
cy.get(fieldEmail).type(email);
cy.get(fieldCommittee).type(committeeID);
cy.get(fieldPassword).type(testPassword).type('{enter}');
cy.get('[data-test="login-dot-gov-login-button"]').click();
cy.wait('@GetLoggedIn');
cy.visit('/login/security-notice');
cy.get('.p-checkbox-box').click();
Expand Down
70 changes: 70 additions & 0 deletions front-end/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['src/**/*.png', 'src/**/*.json', 'src/**/*.scss', 'src/**/*.woff', 'src/**/*.svg'],
},
...compat
.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
)
.map((config) => ({
...config,
files: ['**/*.ts'],
})),
{
files: ['**/*.ts'],

languageOptions: {
ecmaVersion: 5,
sourceType: 'script',

parserOptions: {
project: ['tsconfig.json'],
createDefaultProgram: true,
},
},

rules: {
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: 'app',
style: 'camelCase',
},
],

'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'app',
style: 'kebab-case',
},
],
},
},
...compat.extends('plugin:@angular-eslint/template/recommended').map((config) => ({
...config,
files: ['**/*.html'],
})),
{
files: ['**/*.html'],
rules: {},
},
];
Loading

0 comments on commit 1266208

Please sign in to comment.