Skip to content

Commit cb0e689

Browse files
committed
Merge branch 'fixing-contact-us-submission-error' of https://github.com/civictechindex/CTI-website-frontend into fixing-contact-us-submission-error
2 parents c2568d7 + 6cb1d68 commit cb0e689

37 files changed

+244
-242
lines changed

cypress/integration/pages/organizations.spec.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ describe('Contributors Page (using API)', () => {
33
const parentOrg = 'Code for America';
44
const affiliatedOrg = 'Code for ABQ';
55
const affiliatedOrgPartial = 'ABQ';
6-
const parentOrgCount = 24;
6+
const parentOrgCount1 = 24;
7+
const parentOrgCount2 = 1;
78

8-
it(`should load grandparentOrg, ${parentOrgCount} children, parentOrg, affiliatedOrg`, () => {
9+
it(`should load grandparentOrg, parentOrg, affiliatedOrg`, () => {
910
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`).as('getOrganizations');
1011
cy.visit('/organizations/all');
1112
cy.wait('@getOrganizations');
1213
cy.get('[data-cy=index-contributors-checkbox] input:checkbox').uncheck();
1314
cy.contains(grandparentOrg).should('have.length', 1);
14-
// cy.get('[href*=codeforall]').should('have.length', 1);
1515
cy.get('[data-cy=code-for-all-chevron]').click();
1616
cy.get('[data-cy=affiliated-organizations]').within(() => {
17-
cy.get('[data-cy=thumbnail-dropdown]').should('have.length', parentOrgCount);
17+
cy.get('[data-cy=thumbnail-dropdown]').should('have.length', parentOrgCount1);
1818
cy.get('[data-cy=thumbnail-dropdown]')
1919
.contains(parentOrg)
2020
.parentsUntil('[data-cy=thumbnail-dropdown]')
@@ -27,36 +27,33 @@ describe('Contributors Page (using API)', () => {
2727

2828
it('should find affiliatedOrg via search', () => {
2929
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`).as('getOrganizations');
30-
cy.visit('/organizations/all');
30+
cy.visit('/organizations/affiliated');
3131
cy.wait('@getOrganizations');
32-
cy.get('[data-cy=organization-search]').type(affiliatedOrg);
33-
cy.get('[class*=makeStyles-gpGrid]').click();
32+
cy.get('[data-cy=organization-search]').type(affiliatedOrg).type('{enter}');
3433
cy.get('[data-cy=affiliated-organizations]').within(() => {
3534
cy.get('[data-cy=thumbnail-dropdown]').should('have.length', 1);
3635
cy.get('[data-cy=contributor-thumbnail-text]').contains(affiliatedOrg);
3736
});
38-
cy.get('[class*=endAdornment]').click().within(() => {
39-
cy.get('button').click();
40-
});
4137
cy.get('[data-cy=affiliated-organizations]').within(() => {
42-
cy.get('[data-cy=thumbnail-dropdown]').should('have.length', parentOrgCount);
38+
cy.get('[data-cy=thumbnail-dropdown]').should('have.length', parentOrgCount2);
4339
});
40+
cy.get('[data-cy=organization-search]').clear();
4441
});
4542

4643
it('should find affiliatedOrg via partial search', () => {
4744
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`).as(
4845
'getOrganizations'
4946
);
50-
cy.visit('/organizations/all');
47+
cy.visit('/organizations/affiliated');
5148
cy.wait('@getOrganizations');
5249
cy.get('[data-cy=organization-search]').type(affiliatedOrgPartial);
5350
cy.get('[data-cy=organization-search-list]').should('have.length', 1);
5451
cy.get('[data-cy=organization-search-list]').click();
55-
cy.get('[class*=makeStyles-gpGrid]').click();
5652
cy.get('[data-cy=affiliated-organizations]').within(() => {
5753
cy.get('[data-cy=thumbnail-dropdown]').should('have.length', 1);
5854
cy.get('[data-cy=contributor-thumbnail-text]').contains(affiliatedOrg);
5955
});
56+
cy.get('[data-cy=organization-search]').clear();
6057
});
6158

6259
it('should visit organizations page from home page link', () => {
@@ -78,8 +75,9 @@ describe('Contributors Page (using fixture)', () => {
7875
before(() => {
7976
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`, {
8077
fixture: 'orgs.json',
81-
});
78+
}).as('getOrganizations');
8279
cy.visit('/organizations/all');
80+
cy.wait('@getOrganizations');
8381
});
8482

8583
it('should load 24 affiliated orgs', () => {
@@ -107,7 +105,11 @@ describe('Contributors Page (using fixture)', () => {
107105
});
108106

109107
it('should navigate to unaffiliated and show unaffiliated orgs tab selected', () => {
108+
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`, {
109+
fixture: 'orgs.json',
110+
}).as('getOrganizations');
110111
cy.visit('/organizations/unaffiliated');
112+
cy.wait('@getOrganizations');
111113
cy.get('[class*=MuiTabs-flexContainer]').within(() => {
112114
cy.get('button')
113115
.eq(0)
@@ -125,7 +127,11 @@ describe('Contributors Page (using fixture)', () => {
125127
});
126128

127129
it('should navigate to affiliated and show affiliated orgs tab selected', () => {
130+
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`, {
131+
fixture: 'orgs.json',
132+
}).as('getOrganizations');
128133
cy.visit('/organizations/affiliated');
134+
cy.wait('@getOrganizations');
129135
cy.get('[class*=MuiTabs-flexContainer]').within(() => {
130136
cy.get('button')
131137
.eq(0)
@@ -209,7 +215,7 @@ describe('Contributors Page (using fixture)', () => {
209215
});
210216
cy.get('[class*=affiliatedThumbnailsWrapper]')
211217
.find('[class*=afflnThumbnails]')
212-
.should('have.length', 8);
218+
.should('have.length', 6);
213219
});
214220
});
215221

@@ -221,7 +227,7 @@ describe('Contributors Page (using fixture)', () => {
221227
});
222228
cy.get('[class*=affiliatedThumbnailsWrapper]')
223229
.find('[class*=afflnThumbnails]')
224-
.should('have.length.greaterThan', 8);
230+
.should('have.length.greaterThan', 6);
225231
});
226232
});
227233

@@ -245,12 +251,15 @@ describe('Contributors Page (using fixture)', () => {
245251

246252
// TODO: click open Code for America. need to adjust 25 number to 7 (?)
247253
it('should show index contributor indicators', () => {
254+
cy.intercept(`${Cypress.env('REACT_APP_API_URL')}/api/organizations/`, {
255+
fixture: 'orgs.json',
256+
}).as('getOrganizations');
248257
cy.visit('/organizations/affiliated');
258+
cy.wait('@getOrganizations');
249259
cy.get('[data-cy=index-contributors-checkbox] input:checkbox').check();
250260
cy.get('[class*=makeStyles-gpGrid]').within(() => {
251261
cy.get('[class*=contributorIcon]').should('exist');
252262
});
253-
cy.get('[class*=makeStyles-gpGrid]').click();
254263
// cy.get('[data-cy=contributor-icon]').should('have.length', 25);
255264
cy.get('[class*=makeStyles-dropDownGrid]').within(() => {
256265
cy.contains('Code for America').parent().parent().parent().within(() => {

package-lock.json

Lines changed: 60 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@material-ui/core": "^4.11.4",
77
"@material-ui/icons": "^4.9.1",
88
"@material-ui/lab": "^4.0.0-alpha.58",
9-
"axios": "^0.21.1",
9+
"axios": "^0.21.2",
1010
"ga-4-react": "^0.1.281",
1111
"js-priority-queue": "^0.1.5",
1212
"material-ui-chip-input": "^2.0.0-beta.2",
@@ -60,7 +60,7 @@
6060
"@testing-library/react": "^12.0.0",
6161
"babel-plugin-istanbul": "^6.0.0",
6262
"babel-plugin-transform-class-properties": "^6.24.1",
63-
"cypress": "^8.3.0",
63+
"cypress": "^8.7.0",
6464
"eslint": "^6.8.0",
6565
"eslint-plugin-cypress": "^2.11.3",
6666
"eslint-plugin-react": "^7.23.2",

0 commit comments

Comments
 (0)