@@ -4,7 +4,7 @@ import fixtureData from './fieldReport.json';
44
55test . use ( { storageState : 'playwright/.auth/user.json' } ) ;
66
7- test . describe ( 'Field Report' , ( ) => {
7+ test . describe ( 'Field Report' , ( ) => {
88 test ( 'should create a new event type field report' , async ( { page } ) => {
99 const {
1010 formName,
@@ -103,19 +103,15 @@ test.describe('Field Report', () => {
103103 await page . getByRole ( 'button' , { name : 'Continue' } ) . click ( ) ;
104104 // Situation Page
105105 await page . locator ( 'input[name="num_injured"]' ) . fill ( numInjured ) ;
106- await page
107- . locator ( 'input[name="gov_num_injured"]' )
108- . fill ( govNumInjured ) ;
106+ await page . locator ( 'input[name="gov_num_injured"]' ) . fill ( govNumInjured ) ;
109107 await page
110108 . locator ( 'input[name="other_num_injured"]' )
111109 . fill ( otherNumInjured ) ;
112110 await page . locator ( 'input[name="num_dead"]' ) . fill ( numDead ) ;
113111 await page . locator ( 'input[name="gov_num_dead"]' ) . fill ( govNumDead ) ;
114112 await page . locator ( 'input[name="other_num_dead"]' ) . fill ( otherNumDead ) ;
115113 await page . locator ( 'input[name="num_missing"]' ) . fill ( numMissing ) ;
116- await page
117- . locator ( 'input[name="gov_num_missing"]' )
118- . fill ( govNumMissing ) ;
114+ await page . locator ( 'input[name="gov_num_missing"]' ) . fill ( govNumMissing ) ;
119115 await page
120116 . locator ( 'input[name="other_num_missing"]' )
121117 . fill ( otherNumMissing ) ;
@@ -133,9 +129,7 @@ test.describe('Field Report', () => {
133129 await page
134130 . locator ( 'input[name="other_num_displaced"]' )
135131 . fill ( otherNumDisplaced ) ;
136- await page
137- . locator ( 'textarea[name="other_sources"]' )
138- . fill ( otherSources ) ;
132+ await page . locator ( 'textarea[name="other_sources"]' ) . fill ( otherSources ) ;
139133 // await page.frameLocator('iframe[title="Rich Text Area"]').locator('html').fill("Just the random data");
140134 // issue in Situational overview textbox
141135 await page . getByRole ( 'button' , { name : 'Continue' } ) . click ( ) ;
@@ -497,28 +491,36 @@ test.describe('Field Report', () => {
497491 await expect ( detailLocator ) . toContainText ( detail . email ) ;
498492 await expect ( detailLocator ) . toContainText ( detail . phone ) ;
499493 }
500- await page . getByRole ( 'link' , { name : 'Edit Report' } ) . click ( ) ;
494+ await page . getByRole ( 'link' , { name : 'Edit Report' } ) . click ( ) ;
501495 // Input Value Assertions
502496 // Context Page
503497 // Status
504- const statusValue = page . locator ( 'label' ) . filter ( { hasText : 'EventFirst report for this disaster' } )
498+ const statusValue = page
499+ . locator ( 'label' )
500+ . filter ( { hasText : 'EventFirst report for this disaster' } ) ;
505501 await expect ( statusValue ) . toBeChecked ( ) ;
506502 // Assertions for Country, Region, Disaster Type, Date and Title
507503 const countryValue = page . locator ( 'input[name="country"]' ) ;
508504 await expect ( countryValue ) . toHaveValue ( country ) ;
509- const regionValue = page . locator ( 'input[name="districts"]' )
505+ const regionValue = page . locator ( 'input[name="districts"]' ) ;
510506 await expect ( regionValue ) . toHaveValue ( district ) ;
511507 const disasterValue = page . locator ( 'input[name="dtype"]' ) ;
512508 await expect ( disasterValue ) . toHaveValue ( disasterType ) ;
513509 const dateValue = page . locator ( 'input[name="start_date"]' ) ;
514510 await expect ( dateValue ) . toHaveValue ( date ) ;
515511 const titleValue = page . getByPlaceholder ( 'Example: Cyclone Cody' ) ;
516- await expect ( titleValue ) . toHaveValue ( `${ newtitle } - ${ title } ` , ) ;
512+ await expect ( titleValue ) . toHaveValue ( `${ newtitle } - ${ title } ` ) ;
517513 // Government request international assistance
518- const govReqValue = page . locator ( 'label' ) . filter ( { hasText : govRequest } ) . nth ( 1 )
514+ const govReqValue = page
515+ . locator ( 'label' )
516+ . filter ( { hasText : govRequest } )
517+ . nth ( 1 ) ;
519518 await expect ( govReqValue ) . toBeChecked ( ) ;
520519 // National Society requests international assistance?
521- const nsReqValue = page . locator ( 'label' ) . filter ( { hasText : nationalsocietyRequest } ) . nth ( 2 )
520+ const nsReqValue = page
521+ . locator ( 'label' )
522+ . filter ( { hasText : nationalsocietyRequest } )
523+ . nth ( 2 ) ;
522524 await expect ( nsReqValue ) . toBeChecked ( ) ;
523525 await page . getByRole ( 'button' , { name : 'Continue' } ) . click ( ) ;
524526 // Situation Page
@@ -538,7 +540,7 @@ test.describe('Field Report', () => {
538540 { name : 'other_num_affected' , value : otherNumAffected } ,
539541 { name : 'num_displaced' , value : numDisplaced } ,
540542 { name : 'gov_num_displaced' , value : govNumDisplaced } ,
541- { name : 'other_num_displaced' , value : otherNumDisplaced }
543+ { name : 'other_num_displaced' , value : otherNumDisplaced } ,
542544 ] ;
543545 for ( const { name, value } of numericDetailValues ) {
544546 const inputValue = page . locator ( `input[name="${ name } "]` ) ;
@@ -555,7 +557,7 @@ test.describe('Field Report', () => {
555557 { name : 'num_assisted' , value : numAssisted } ,
556558 { name : 'num_localstaff' , value : numLocalstaff } ,
557559 { name : 'num_volunteers' , value : numVolunteers } ,
558- { name : 'num_expats_delegates' , value : numExpatsDelegates }
560+ { name : 'num_expats_delegates' , value : numExpatsDelegates } ,
559561 ] ;
560562 for ( const { name, value } of assistedValues ) {
561563 const inputValue = page . locator ( `input[name="${ name } "]` ) ;
@@ -564,33 +566,51 @@ test.describe('Field Report', () => {
564566 // Assertions for Actions Taken by National Society Red Cross Value
565567 const nsActions = [ actionHuman , actionShelter , actionEvacuation ] ;
566568 for ( const action of nsActions ) {
567- const label = page . locator ( 'label' ) . filter ( { hasText : action } ) . first ( ) ;
569+ const label = page
570+ . locator ( 'label' )
571+ . filter ( { hasText : action } )
572+ . first ( ) ;
568573 await expect ( label ) . toBeChecked ( ) ;
569574 }
570- const nsValue = page . getByPlaceholder ( 'Brief description of the action' ) . first ( ) ;
575+ const nsValue = page
576+ . getByPlaceholder ( 'Brief description of the action' )
577+ . first ( ) ;
571578 await expect ( nsValue ) . toHaveText ( nationalSocietySummary ) ;
572579 // Assertions for Actions Taken by IFRC Value
573580 const ifrcActions = [ actionHealth , actionShelter , actionCamp ] ;
574581 for ( const action of ifrcActions ) {
575- const label = page . locator ( 'label' ) . filter ( { hasText : action } ) . nth ( 1 ) ;
582+ const label = page
583+ . locator ( 'label' )
584+ . filter ( { hasText : action } )
585+ . nth ( 1 ) ;
576586 await expect ( label ) . toBeChecked ( ) ;
577587 }
578- const ifrcValue = page . getByPlaceholder ( 'Brief description of the action' ) . nth ( 1 ) ;
588+ const ifrcValue = page
589+ . getByPlaceholder ( 'Brief description of the action' )
590+ . nth ( 1 ) ;
579591 await expect ( ifrcValue ) . toHaveText ( federationSummary ) ;
580592 // Assertions for Actions Taken by RCRC Movements Value
581593 const rcrcActions = [ actionFirst , actionPsychosocial , actionFood ] ;
582594 for ( const action of rcrcActions ) {
583- const label = page . locator ( 'label' ) . filter ( { hasText : action } ) . nth ( 2 ) ;
595+ const label = page
596+ . locator ( 'label' )
597+ . filter ( { hasText : action } )
598+ . nth ( 2 ) ;
584599 await expect ( label ) . toBeChecked ( ) ;
585600 }
586- const rcrcValue = page . getByPlaceholder ( 'Brief description of the action' ) . nth ( 2 ) ;
601+ const rcrcValue = page
602+ . getByPlaceholder ( 'Brief description of the action' )
603+ . nth ( 2 ) ;
587604 await expect ( rcrcValue ) . toHaveText ( rcrcSummary ) ;
588605 // Assertions for Information Bulletin
589- const bulletinValue = page . locator ( 'label' ) . filter ( { hasText : informationBulletin } ) ;
606+ const bulletinValue = page
607+ . locator ( 'label' )
608+ . filter ( { hasText : informationBulletin } ) ;
590609 await expect ( bulletinValue ) . toBeChecked ( ) ;
591610 // Assertions for Actions Taken by Others Value
592- const actionsOtherValue = page . locator ( 'textarea[name="actions_others"]' ) ;
593- await expect ( actionsOtherValue ) . toHaveText ( actionOther )
594-
595- } ) ;
611+ const actionsOtherValue = page . locator (
612+ 'textarea[name="actions_others"]' ,
613+ ) ;
614+ await expect ( actionsOtherValue ) . toHaveText ( actionOther ) ;
615+ } ) ;
596616} ) ;
0 commit comments