@@ -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
0 commit comments