Skip to content

Commit

Permalink
Merge pull request #2399 from fecgov/release/sprint-51
Browse files Browse the repository at this point in the history
Release/sprint 51
  • Loading branch information
Elaine-Krauss-TCG authored Dec 3, 2024
2 parents b53014f + d761f07 commit 675c526
Show file tree
Hide file tree
Showing 141 changed files with 2,377 additions and 2,182 deletions.
17 changes: 3 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
command: ./node_modules/.bin/eslint "src/**/*.ts" --max-warnings=0
working_directory: ~/project/front-end/
- run:
name: 'Run Prettier with project configuration'
name: "Run Prettier with project configuration"
command: npm run prettier:check:ci
working_directory: ~/project/front-end/
test:
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
DB_DOCKERFILE="Dockerfile-e2e" WORKER_DOCKERFILE="Worker_Dockerfile-e2e" API_DOCKERFILE="Dockerfile-e2e" FECFILE_TEST_DB_NAME="postgres" DJANGO_SECRET_KEY=${E2E_DJANGO_SECRET_KEY} DATABASE_URL=${E2E_DATABASE_URL} FEC_API=${E2E_FEC_API} FEC_API_KEY=${E2E_FEC_API_KEY} MOCK_EFO="True" docker-compose up --build -d
docker container run --network container:fecfile-api-proxy \
docker.io/jwilder/dockerize \
-wait http://localhost:8080/api/v1/user/login/authenticate \
-wait http://localhost:8080/api/v1/status/ \
-wait-retry-interval 2s \
-timeout 60s; \
working_directory: ~/project/fecfile-web-api
Expand Down Expand Up @@ -205,20 +205,14 @@ jobs:
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
parameters:
is-nightly-run:
type: boolean
default: false

is-triggered-e2e-test:
type: boolean
default: false

workflows:
primary:
when:
and:
- not: << pipeline.parameters.is-nightly-run >>
- not: << pipeline.parameters.is-triggered-e2e-test >>
not: << pipeline.parameters.is-triggered-e2e-test >>
jobs:
- lint
- test
Expand All @@ -237,11 +231,6 @@ workflows:
branches:
only: /develop|release\/sprint-[\.\d]+|main/

nightly-run:
when: << pipeline.parameters.is-nightly-run >>
jobs:
- e2e-test

# This job is run when an e2e test is triggered with the
# is-triggered-e2e-test parameter via the fecfile-web-api
# circleci config file. It is used to run the e2e tests
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ A Snyk authentication token is needed and should be set as the SNYK_AUTH_TOKEN e

### Running the Front-End locally

From within the front-end directory, run the command:
`
ng serve
`
From within the front-end directory, install packages with
```
npm install
````
and run the application with the command:
```
npx -p @angular/cli ng serve
```
to start a local server for the application. The front-end can then be accessed through your browser at port 4200.
### Running end-to-end (E2E) tests
Expand Down
3 changes: 3 additions & 0 deletions deploy-config/front-end-nginx-config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ http {
listen {{port}};
root fecfile-web;
index index.html index.htm Default.htm;
location = /index.html {
add_header Cache-Control no-cache;
}
location / {
try_files $uri $uri/ /index.html;
}
Expand Down
2 changes: 1 addition & 1 deletion front-end/cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To run in headless mode, run the command: ng e2e --headless

## E2E tests in CircleCI

A new job was added to the CircleCI fecfile-web-app configuration to run the E2E test suite nightly. This job uses CircleCI's [Docker executor](https://circleci.com/docs/building-docker-images/#run-docker-commands-using-the-docker-executor) to spin up an instance of the fecfile-web-api using Docker Compose in an isolated remote docker instance.
A new job was added to the CircleCI fecfile-web-app configuration to run the E2E test suite when triggered. This job uses CircleCI's [Docker executor](https://circleci.com/docs/building-docker-images/#run-docker-commands-using-the-docker-executor) to spin up an instance of the fecfile-web-api using Docker Compose in an isolated remote docker instance.

For security reasons, CircleCI's remote docker [does not allow mounting volumes](https://circleci.com/docs/building-docker-images/#mounting-folders), and thus our compose `volumes` commands fail. To get around this, we had to create two new E2E Dockerfiles for the API/Worker to add these filesystem resources to the images directly.

Expand Down
23 changes: 17 additions & 6 deletions front-end/cypress/e2e/F1M/f1m-affiliation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ describe('Manage reports', () => {
cy.contains(committeeFormData.name).click();
PageUtils.valueCheck('[id="affiliated_committee_name"', committeeFormData.name);
PageUtils.clickButton('Save');
cy.get('[data-cy="date-of-affiliation-error"]').contains('This is a required field.');
PageUtils.calendarSetValue('[data-cy="date-of-affiliation"]');
cy.get('[data-cy="affiliated_date_form_f1_filed-error"]').contains('This is a required field.');
PageUtils.calendarSetValue('[data-cy="affiliated_date_form_f1_filed"]');
PageUtils.clickButton('Save');
cy.get('[data-cy="report-list-component').should('exist');
});
Expand All @@ -40,17 +40,17 @@ describe('Manage reports', () => {
cy.get('[data-cy="state-party-radio"]').click();
cy.get('[data-cy="qualification-radio"').click();
cy.get('[data-cy="qualification-radio"').click();
PageUtils.calendarSetValue('[data-cy="date-of-contribution"]');
PageUtils.calendarSetValue('[data-cy="date-of-registration"]');
PageUtils.calendarSetValue('[data-cy="date-of-requirements"]');
PageUtils.calendarSetValue('[data-cy="date_of_51st_contributor"]');
PageUtils.calendarSetValue('[data-cy="date_of_original_registration"]');
PageUtils.calendarSetValue('[data-cy="date_committee_met_requirements"]');
for (let index = 0; index < candidates.length; index++) {
const candidateSection = cy.get(`[data-cy="candidate-${index}"]`);
candidateSection.find('[id="searchBox"]').type(candidates[index].first_name.slice(0, 3));
candidateSection.get(`[data-cy="candidate-lookup"]`).contains(candidates[index].first_name).click();
cy.get(`[data-cy="candidate-${index}"]`)
.find('[data-cy="last-name"]')
.should('have.value', candidates[index].last_name);
PageUtils.calendarSetValue('[data-cy="candidate-date"]', new Date(), `[data-cy="candidate-${index}"]`);
PageUtils.calendarSetValue(getId(index), new Date(), `[data-cy="candidate-${index}"]`);
}
PageUtils.clickButton('Save and continue');
cy.get('[data-cy="print-preview"]').should('exist');
Expand All @@ -67,3 +67,14 @@ describe('Manage reports', () => {
cy.get('[id="text4000"]').should('have.value', memoText);
});
});

const romanMap: { [key: number]: string } = {
1: 'I',
2: 'II',
3: 'III',
4: 'IV',
5: 'V',
};
function getId(num: any) {
return `[data-cy="${romanMap[num + 1]}_date_of_contribution"]`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ describe('Form 24 Independent Expenditures', () => {
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains(individualContactFormData.last_name).click();

TransactionDetailPage.enterSheduleFormDataForVoidExpenditure(independentExpenditureData, candidateFormData);
TransactionDetailPage.enterSheduleFormDataForVoidExpenditure(
independentExpenditureData,
candidateFormData,
false,
'',
'date_signed',
);

PageUtils.clickButton('Save');
PageUtils.clickLink('Independent Expenditure');
Expand Down
16 changes: 14 additions & 2 deletions front-end/cypress/e2e/F3X/disbursements.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ describe('Disbursements', () => {
cy.contains(organizationFormData.name).should('exist');
cy.contains(organizationFormData.name).click();

TransactionDetailPage.enterSheduleFormDataForVoidExpenditure(independentExpVoidData, candidateFormData);
TransactionDetailPage.enterSheduleFormDataForVoidExpenditure(
independentExpVoidData,
candidateFormData,
false,
'',
'date_signed',
);

PageUtils.clickButton('Save');
PageUtils.clickLink('Independent Expenditure - Void');
Expand All @@ -84,7 +90,13 @@ describe('Disbursements', () => {
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains(individualContactFormData.last_name).click();

TransactionDetailPage.enterSheduleFormDataForVoidExpenditure(independentExpVoidData, candidateFormData);
TransactionDetailPage.enterSheduleFormDataForVoidExpenditure(
independentExpVoidData,
candidateFormData,
false,
'',
'date_signed',
);

PageUtils.clickButton('Save');
PageUtils.clickLink('Independent Expenditure');
Expand Down
10 changes: 8 additions & 2 deletions front-end/cypress/e2e/F3X/reattributions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function CreateReceipt() {
cy.get('[id="searchBox"]').type(individualContactFormData.last_name.slice(0, 1));
cy.contains(individualContactFormData.last_name).should('exist');
cy.contains(individualContactFormData.last_name).click();
TransactionDetailPage.enterScheduleFormData(new ScheduleFormData(receiptData));
TransactionDetailPage.enterScheduleFormData(new ScheduleFormData(receiptData), false, '', true, 'contribution_date');

PageUtils.clickButton('Save');
PageUtils.urlCheck('/list');
Expand All @@ -70,7 +70,13 @@ function Reattribute(old = false) {
cy.get('[id="searchBox"]').type(assignee.last_name.slice(0, 1));
cy.contains(assignee.last_name).should('exist');
cy.contains(assignee.last_name).click();
TransactionDetailPage.enterScheduleFormData(new ScheduleFormData(reattributeData));
TransactionDetailPage.enterScheduleFormData(
new ScheduleFormData(reattributeData),
false,
'',
true,
'contribution_date',
);

PageUtils.clickButton('Save');
PageUtils.urlCheck('/list');
Expand Down
Loading

0 comments on commit 675c526

Please sign in to comment.