@@ -25,6 +25,7 @@ import {
2525 interceptFetchDepartmentsByIdsRequest ,
2626 interceptFetchDepartmentsRequest ,
2727 interceptFetchDepartmentByIdRequest ,
28+ interceptFetchEmployeesByIdsRequest ,
2829} from 'support/interceptors' ;
2930
3031describe ( 'Employee Catalog Tests' , ( ) => {
@@ -76,6 +77,7 @@ describe('Employee Catalog Tests', () => {
7677
7778 it ( 'should display the loader if fetching employees is in progress' , ( ) => {
7879 interceptFetchEmployeesRequest ( ) ;
80+ interceptFetchEmployeesByIdsRequest ( ) ;
7981
8082 getLinearLoader ( Module . employeeManagement , SubModule . employeeCatalog , 'table' ) . should ( 'exist' ) ;
8183 cy . wait ( '@fetchEmployeesRequest' ) . its ( 'request.url' ) . should ( 'include' , 'Employees?pageNumber=1&pageSize=10' ) ;
@@ -89,6 +91,7 @@ describe('Employee Catalog Tests', () => {
8991 { pageNumber : 1 , pageSize : 10 } ,
9092 { alias : 'fetchEmployeesQuickRequest' , fixture : 'employee/employees' , statusCode : 200 , delay : 50 }
9193 ) ;
94+ interceptFetchEmployeesByIdsRequest ( ) ;
9295
9396 getLinearLoader ( Module . employeeManagement , SubModule . employeeCatalog , 'table' ) . should ( 'not.exist' ) ;
9497 } ) ;
@@ -98,6 +101,7 @@ describe('Employee Catalog Tests', () => {
98101 { pageNumber : 1 , pageSize : 10 } ,
99102 { alias : 'fetchMultipleEmployeesRequest' , fixture : 'employee/employees-multiple' }
100103 ) ;
104+ interceptFetchEmployeesByIdsRequest ( ) ;
101105
102106 getLinearLoader ( Module . employeeManagement , SubModule . employeeCatalog , 'table' ) . should ( 'exist' ) ;
103107 cy . wait ( '@fetchMultipleEmployeesRequest' ) . its ( 'request.url' ) . should ( 'include' , 'Employees?pageNumber=1&pageSize=10' ) ;
@@ -116,6 +120,18 @@ describe('Employee Catalog Tests', () => {
116120 'have.text' ,
117121 'Full Name'
118122 ) ;
123+ getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-header-cell-assignedBranchName' ) . should (
124+ 'have.text' ,
125+ 'Assigned Branch'
126+ ) ;
127+ getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-header-cell-assignedDepartmentName' ) . should (
128+ 'have.text' ,
129+ 'Assigned Department'
130+ ) ;
131+ getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-header-cell-reportsToName' ) . should (
132+ 'have.text' ,
133+ 'Manager'
134+ ) ;
119135 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-firstName' )
120136 . find ( 'p' )
121137 . should ( 'exist' )
@@ -129,6 +145,9 @@ describe('Employee Catalog Tests', () => {
129145 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-assignedBranchName' )
130146 . should ( 'exist' )
131147 . and ( 'have.text' , 'New York Branch' ) ;
148+ getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-reportsToName' )
149+ . should ( 'exist' )
150+ . and ( 'have.text' , 'Gabriel Admin Archangel' ) ;
132151 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-assignedDepartmentName' )
133152 . should ( 'exist' )
134153 . and ( 'have.text' , 'Production' ) ;
@@ -141,6 +160,7 @@ describe('Employee Catalog Tests', () => {
141160
142161 it ( 'should send correct request when pagination changes' , ( ) => {
143162 interceptFetchEmployeesRequest ( ) ;
163+ interceptFetchEmployeesByIdsRequest ( ) ;
144164 cy . wait ( '@fetchEmployeesRequest' ) ;
145165
146166 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-pagination' )
@@ -166,6 +186,7 @@ describe('Employee Catalog Tests', () => {
166186 { pageNumber : 1 , pageSize : 10 } ,
167187 { alias : 'fetchMultipleEmployeesRequest' , fixture : 'employee/employees-multiple' }
168188 ) ;
189+ interceptFetchEmployeesByIdsRequest ( ) ;
169190
170191 cy . wait ( '@fetchMultipleEmployeesRequest' ) . its ( 'request.url' ) . should ( 'include' , 'Employees?pageNumber=1&pageSize=10' ) ;
171192
@@ -218,6 +239,7 @@ describe('Employee Catalog Tests', () => {
218239 { pageNumber : 1 , pageSize : 10 , search : 'Anthony' } ,
219240 { alias : 'fetchSearchedEmployeesRequest' , fixture : 'employee/employees' }
220241 ) ;
242+ interceptFetchEmployeesByIdsRequest ( ) ;
221243
222244 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'search-employees' ) . find ( 'input' ) . type ( 'Anthony' ) ;
223245 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-row' , true ) . should ( 'have.length' , 1 ) ;
@@ -242,6 +264,7 @@ describe('Employee Catalog Tests', () => {
242264 { pageNumber : 1 , pageSize : 10 } ,
243265 { alias : 'fetchMultipleEmployeesRequest' , fixture : 'employee/employees-multiple' }
244266 ) ;
267+ interceptFetchEmployeesByIdsRequest ( ) ;
245268
246269 getLinearLoader ( Module . employeeManagement , SubModule . employeeCatalog , 'table' ) . should ( 'exist' ) ;
247270 cy . wait ( '@fetchMultipleEmployeesRequest' ) ;
@@ -294,6 +317,7 @@ describe('Employee Catalog Tests', () => {
294317
295318 it ( 'should display action column and correct actions' , ( ) => {
296319 interceptFetchEmployeesRequest ( ) ;
320+ interceptFetchEmployeesByIdsRequest ( ) ;
297321
298322 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-layout-action-button' ) . should ( 'not.exist' ) ;
299323 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'actions-menu-icon-333333333335' )
@@ -312,7 +336,9 @@ describe('Employee Catalog Tests', () => {
312336
313337 it ( 'should be able to navigate to the View Employee page' , ( ) => {
314338 interceptFetchEmployeesRequest ( ) ;
339+ interceptFetchEmployeesByIdsRequest ( ) ;
315340 interceptFetchEmployeeByIdRequest ( '333333333335' ) ;
341+ interceptFetchEmployeeByIdRequest ( '333333333333' ) ;
316342 interceptFetchBranchByIdRequest ( '222222222222' ) ;
317343 interceptFetchDepartmentByIdRequest ( '444444444444' ) ;
318344
@@ -332,6 +358,7 @@ describe('Employee Catalog Tests', () => {
332358 { pageNumber : 1 , pageSize : 10 } ,
333359 { alias : 'fetchMultipleEmployeesRequest' , fixture : 'employee/employees-multiple' }
334360 ) ;
361+ interceptFetchEmployeesByIdsRequest ( ) ;
335362
336363 getLinearLoader ( Module . employeeManagement , SubModule . employeeCatalog , 'table' ) . should ( 'exist' ) ;
337364 cy . wait ( '@fetchMultipleEmployeesRequest' ) . its ( 'request.url' ) . should ( 'include' , 'Employees?pageNumber=1&pageSize=10' ) ;
@@ -350,6 +377,21 @@ describe('Employee Catalog Tests', () => {
350377 'have.text' ,
351378 'Full Name'
352379 ) ;
380+ getTestSelectorByModule (
381+ Module . employeeManagement ,
382+ SubModule . employeeCatalog ,
383+ 'table-header-cell-333333333335-assignedBranchName'
384+ ) . should ( 'have.text' , 'Assigned Branch' ) ;
385+ getTestSelectorByModule (
386+ Module . employeeManagement ,
387+ SubModule . employeeCatalog ,
388+ 'table-header-cell-333333333335-assignedDepartmentName'
389+ ) . should ( 'have.text' , 'Assigned Department' ) ;
390+ getTestSelectorByModule (
391+ Module . employeeManagement ,
392+ SubModule . employeeCatalog ,
393+ 'table-header-cell-333333333335-reportsToName'
394+ ) . should ( 'have.text' , 'Manager' ) ;
353395 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-firstName' )
354396 . find ( 'p' )
355397 . should ( 'exist' )
@@ -366,6 +408,9 @@ describe('Employee Catalog Tests', () => {
366408 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-assignedDepartmentName' )
367409 . should ( 'exist' )
368410 . and ( 'have.text' , 'Production' ) ;
411+ getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'table-body-cell-333333333335-reportsToName' )
412+ . should ( 'exist' )
413+ . and ( 'have.text' , 'Gabriel Admin Archangel' ) ;
369414 getTestSelectorByModule ( Module . employeeManagement , SubModule . employeeCatalog , 'actions-menu-icon-333333333335' )
370415 . should ( 'exist' )
371416 . click ( ) ;
@@ -390,6 +435,8 @@ describe('Employee Catalog Tests', () => {
390435 describe ( 'User Role' , ( ) => {
391436 beforeEach ( ( ) => {
392437 cy . loginMock ( ) ;
438+ interceptFetchEmployeesRequest ( { pageNumber : 1 , pageSize : 1 } ) ;
439+ interceptFetchDepartmentsRequest ( { pageNumber : 1 , pageSize : 1 } ) ;
393440 } ) ;
394441
395442 it ( 'should not be able to navigate to the Edit Employee page' , ( ) => {
@@ -411,11 +458,13 @@ describe('Employee Catalog Tests', () => {
411458
412459 it ( 'should be able to navigate to the Edit Employee page' , ( ) => {
413460 interceptFetchEmployeesRequest ( ) ;
461+ interceptFetchEmployeesByIdsRequest ( ) ;
414462 interceptFetchBranchesByIdsRequest ( ) ;
415463 interceptFetchDepartmentsByIdsRequest ( ) ;
416464 interceptFetchBranchesRequest ( ) ;
417465 interceptFetchDepartmentsRequest ( ) ;
418466 interceptFetchEmployeeByIdRequest ( '333333333335' ) ;
467+ interceptFetchEmployeeByIdRequest ( '333333333333' ) ;
419468 interceptFetchBranchByIdRequest ( '222222222222' ) ;
420469 interceptFetchDepartmentByIdRequest ( '444444444444' ) ;
421470
0 commit comments