Produced by Araxis Merge on 12/8/2017 1:33:40 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\src\app\tools\station-maintenance\addZipCode | station-maintenance-add-zip-code.component.spec.ts | Fri Dec 8 17:53:08 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\src\app\tools\station-maintenance\addZipCode | station-maintenance-add-zip-code.component.spec.ts | Fri Dec 8 18:37:09 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 896 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | import { a sync, Comp onentFixtu re, TestBe d } from ' @angular/c ore/testin g'; | |
| 2 | import { D ebugElemen t } from ' @angular/c ore'; | |
| 3 | import { B y } from ' @angular/p latform-br owser'; | |
| 4 | import { F ormsModule } from '@ angular/fo rms'; | |
| 5 | import { R outerTesti ngModule } from '@an gular/rout er/testing '; | |
| 6 | import { H ttpModule } from '@a ngular/htt p'; | |
| 7 | ||
| 8 | import { O bservable } from 'rx js/Observa ble'; | |
| 9 | ||
| 10 | import { M enuCompone nt } from '../../../ shared/men u/menu.com ponent'; | |
| 11 | import { S tationMain tenanceAdd ZipCodeCom ponent } f rom './sta tion-maint enance-add -zip-code. component' ; | |
| 12 | import { S tationMain tenanceAdd ZipCodeSer vice } fro m './stati on-mainten ance-add-z ip-code.se rvice'; | |
| 13 | import { E ditStation Service } from '../e dit-statio n/station- edit-maint enance.ser vice'; | |
| 14 | import { W indowRefSe rvice } fr om '../../ ../window- ref.servic e'; | |
| 15 | ||
| 16 | // Frankli n Perez (1 0/18/20917 ): Used te chnique de sribed in the | |
| 17 | // https:/ /stackover flow.com/q uestions/4 3549861/un it-testing -and-mocki ng-a-servi ce-with-di | |
| 18 | // web pag e to Mock a Service. | |
| 19 | class Mock StationMai ntenanceAd dZipCodeSe rvice exte nds Statio nMaintenan ceAddZipCo deService { | |
| 20 | co nstructor( ) { | |
| 21 | supe r(null); | |
| 22 | } | |
| 23 | ||
| 24 | st ation = { | |
| 25 | "s tationId": "999", | |
| 26 | "s hortName": "GENHOSP" , | |
| 27 | "n ame": "Gen eral Hospi tal", | |
| 28 | "t ype": "HOS P", | |
| 29 | "v isn": "9", | |
| 30 | "a llowRerout e": "true" , | |
| 31 | "a gedDefinit ion": "", | |
| 32 | "p arentStati on": "", | |
| 33 | "createdBy ": " DNS MBAIAH", | |
| 34 | "d ateCreated ": "01/01/ 2017 12:59 PM" | |
| 35 | }; | |
| 36 | ||
| 37 | re sponseBody = null; | |
| 38 | ||
| 39 | se tResponseB ody(aRespo nseBody) { | |
| 40 | this .responseB ody = aRes ponseBody; | |
| 41 | } | |
| 42 | ||
| 43 | zi pCodeSave( body) { | |
| 44 | retu rn new Obs ervable(ob server => observer.n ext(this.r esponseBod y)); | |
| 45 | } | |
| 46 | } | |
| 47 | ||
| 48 | describe(' StationMai ntenanceAd dZipCodeCo mponent', () => { | |
| 49 | let comp onent: Sta tionMainte nanceAddZi pCodeCompo nent; | |
| 50 | let fixt ure: Compo nentFixtur e<StationM aintenance AddZipCode Component> ; | |
| 51 | let stat ionMainten anceAddZip CodeServic e: MockSta tionMainte nanceAddZi pCodeServi ce; | |
| 52 | ||
| 53 | beforeEa ch(async(( ) => { | |
| 54 | TestBe d.configur eTestingMo dule({ | |
| 55 | decl arations: [ MenuComp onent, Sta tionMainte nanceAddZi pCodeCompo nent ], | |
| 56 | imports: [ /* Router TestingMod ule, */ | |
| 57 | Router TestingMod ule.withRo utes([ | |
| 58 | { path : 'login', component : StationM aintenance AddZipCode Component /* faking this for " async" tes t cases to work */ } | |
| 59 | ]), | |
| 60 | FormsM odule, Htt pModule ], | |
| 61 | providers: [ { provi de: Statio nMaintenan ceAddZipCo deService, useClass: MockStati onMaintena nceAddZipC odeService }, | |
| 62 | EditSt ationServi ce, Window RefService , MockStat ionMainten anceAddZip CodeServic e ] | |
| 63 | }) | |
| 64 | .compi leComponen ts(); | |
| 65 | })); | |
| 66 | ||
| 67 | beforeEa ch(() => { | |
| 68 | fixtur e = TestBe d.createCo mponent(St ationMaint enanceAddZ ipCodeComp onent); | |
| 69 | compon ent = fixt ure.compon entInstanc e; | |
| 70 | ||
| 71 | // Fra nklin Pere z (10/19/2 017): Use the "TestB ed.get" me thod to ge t the Mock Service - not "fixt ure.debugE lement.inj ector.get" . | |
| 72 | // stationMa intenanceA ddZipCodeS ervice = f ixture.deb ugElement. injector.g et(MockSta tionMainte nanceAddZi pCodeServi ce); | |
| 73 | st ationMaint enanceAddZ ipCodeServ ice = Test Bed.get(St ationMaint enanceAddZ ipCodeServ ice); | |
| 74 | ||
| 75 | const userInfo = { | |
| 76 | 'per missions': { | |
| 77 | 'c laimsMenu' : { | |
| 78 | 'paymentEr ror': 'tru e', | |
| 79 | 'unmatched Payments': 'true', | |
| 80 | 'inprocess ': 'true', | |
| 81 | 'aged': 't rue', | |
| 82 | 'searchCla im': 'true ', | |
| 83 | 'rejectCla ims': 'tru e', | |
| 84 | 'awaitingP rocessing' : 'true' | |
| 85 | }, | |
| 86 | 'r eportsMenu ': { | |
| 87 | 'claimsAwa itingProce ssing': 't rue', | |
| 88 | 'reroutedC laims': 't rue', | |
| 89 | 'claimsInp rocessSumm ary': 'tru e', | |
| 90 | 'vistAErro r': 'true' , | |
| 91 | 'claimsCom pleted': ' true', | |
| 92 | 'CPEReport ': 'true', | |
| 93 | 'claimsCom pletedSumm ary': 'tru e', | |
| 94 | 'claimsInp rocess': ' true', | |
| 95 | 'outOfSyst emPayments Summary': 'true', | |
| 96 | 'BPPR16': 'true', | |
| 97 | 'outOfSyst emPayments ': 'true', | |
| 98 | 'claimsAwa itingProce ssingSumma ry': 'true ', | |
| 99 | 'feeReport ': 'true' | |
| 100 | } | |
| 101 | } | |
| 102 | }; | |
| 103 | ||
| 104 | se ssionStora ge.setItem ('userInfo ', JSON.st ringify(us erInfo)); | |
| 105 | ||
| 106 | fixtur e.detectCh anges(); | |
| 107 | }); | |
| 108 | ||
| 109 | it('shou ld be crea ted', () = > { | |
| 110 | expect (component ).toBeTrut hy(); | |
| 111 | }); | |
| 112 | ||
| 113 | it('veri fy "Add ZI P Code" te xt field e xists', () => { | |
| 114 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#zip Code')); | |
| 115 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 116 | ex pect(htmlE lement).to BeTruthy() ; | |
| 117 | }); | |
| 118 | ||
| 119 | it('veri fy "Add ZI P Code" te xt field i s a requir ed field', () => { | |
| 120 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#zip Code')); | |
| 121 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 122 | ex pect(htmlE lement).to BeTruthy() ; | |
| 123 | ||
| 124 | ex pect(htmlE lement.get Attribute( "required" )).not.toB eNull(); | |
| 125 | ex pect(htmlE lement.get Attribute( "required" )).toEqual (""); | |
| 126 | }); | |
| 127 | ||
| 128 | it('veri fy "Add ZI P Code" te xt field h as initial ly an empt y string v alue', () => { | |
| 129 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#zip Code')); | |
| 130 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 131 | ex pect(htmlE lement).to BeTruthy() ; | |
| 132 | ||
| 133 | ex pect(htmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" "); | |
| 134 | }); | |
| 135 | ||
| 136 | it('veri fy "Add ZI P Code" te xt field h as same va lue as the "selected ZipCode" v ariable', () => { | |
| 137 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#zip Code')); | |
| 138 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 139 | ex pect(htmlE lement).to BeTruthy() ; | |
| 140 | ||
| 141 | co mponent.se lectedZipC ode = "902 10"; | |
| 142 | fi xture.dete ctChanges( ); | |
| 143 | ||
| 144 | ex pect(htmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" 90210"); | |
| 145 | }); | |
| 146 | ||
| 147 | it('veri fy Active Indicator is a manda tory field by seeing that need ed element s are pres ent', () = > { | |
| 148 | le t activeOp tionsYesRa dionButton DebugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#activ eOptionsYe s')); | |
| 149 | ex pect(activ eOptionsYe sRadionBut tonDebugEl ement).toB eTruthy(); | |
| 150 | le t activeOp tionsYesRa dionButton HtmlElemen t: HTMLEle ment = act iveOptions YesRadionB uttonDebug Element.na tiveElemen t; | |
| 151 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment).toBe Truthy(); | |
| 152 | ||
| 153 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("t ype")).toE qual("radi o"); | |
| 154 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("n g-control" )).toEqual ("activeOp tions"); | |
| 155 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("n ame")).toE qual("acti veOptions" ); | |
| 156 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("v alue")).to Equal("Yes "); | |
| 157 | ||
| 158 | le t activeOp tionsNoRad ionButtonD ebugElemen t: DebugEl ement = fi xture.debu gElement.q uery(By.cs s('#active OptionsNo' )); | |
| 159 | ex pect(activ eOptionsNo RadionButt onDebugEle ment).toBe Truthy(); | |
| 160 | le t activeOp tionsNoRad ionButtonH tmlElement : HTMLElem ent = acti veOptionsN oRadionBut tonDebugEl ement.nati veElement; | |
| 161 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent).toBeT ruthy(); | |
| 162 | ||
| 163 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("ty pe")).toEq ual("radio "); | |
| 164 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("ng -control") ).toEqual( "activeOpt ions"); | |
| 165 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("na me")).toEq ual("activ eOptions") ; | |
| 166 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("va lue")).toE qual("No") ; | |
| 167 | }); | |
| 168 | ||
| 169 | it('veri fy Active Indicator initially has "Yes" value', () => { | |
| 170 | le t activeOp tionsYesRa dionButton DebugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#activ eOptionsYe s')); | |
| 171 | ex pect(activ eOptionsYe sRadionBut tonDebugEl ement).toB eTruthy(); | |
| 172 | le t activeOp tionsYesRa dionButton HtmlElemen t: HTMLEle ment = act iveOptions YesRadionB uttonDebug Element.na tiveElemen t; | |
| 173 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment).toBe Truthy(); | |
| 174 | ||
| 175 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("n g-reflect- model")).t oEqual("Ye s"); | |
| 176 | ||
| 177 | le t activeOp tionsNoRad ionButtonD ebugElemen t: DebugEl ement = fi xture.debu gElement.q uery(By.cs s('#active OptionsNo' )); | |
| 178 | ex pect(activ eOptionsNo RadionButt onDebugEle ment).toBe Truthy(); | |
| 179 | le t activeOp tionsNoRad ionButtonH tmlElement : HTMLElem ent = acti veOptionsN oRadionBut tonDebugEl ement.nati veElement; | |
| 180 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent).toBeT ruthy(); | |
| 181 | ||
| 182 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("ng -reflect-m odel")).to Equal("Yes "); | |
| 183 | ||
| 184 | ex pect(compo nent.selec tedActive) .toEqual(" Yes"); | |
| 185 | }); | |
| 186 | ||
| 187 | // Frank lin Perez (10/18/201 7): I coul d not get the below to work co rrectly, s o I had to use the m ethodolgy | |
| 188 | // shown in the su bsequent U nit Test. | |
| 189 | /* | |
| 190 | it('veri fy Active Indicator value chan ges to "No " when the "No" Radi o Button i s pressed' , () => { | |
| 191 | le t activeOp tionsYesRa dionButton DebugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#activ eOptionsYe s')); | |
| 192 | ex pect(activ eOptionsYe sRadionBut tonDebugEl ement).toB eTruthy(); | |
| 193 | le t activeOp tionsYesRa dionButton HtmlElemen t: HTMLEle ment = act iveOptions YesRadionB uttonDebug Element.na tiveElemen t; | |
| 194 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment).toBe Truthy(); | |
| 195 | ||
| 196 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("n g-reflect- model")).t oEqual("Ye s"); | |
| 197 | ||
| 198 | le t activeOp tionsNoRad ionButtonD ebugElemen t: DebugEl ement = fi xture.debu gElement.q uery(By.cs s('#active OptionsNo' )); | |
| 199 | ex pect(activ eOptionsNo RadionButt onDebugEle ment).toBe Truthy(); | |
| 200 | le t activeOp tionsNoRad ionButtonH tmlElement : HTMLElem ent = acti veOptionsN oRadionBut tonDebugEl ement.nati veElement; | |
| 201 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent).toBeT ruthy(); | |
| 202 | ||
| 203 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("ng -reflect-m odel")).to Equal("Yes "); | |
| 204 | ||
| 205 | ex pect(compo nent.selec tedActive) .toEqual(" Yes"); | |
| 206 | ||
| 207 | // Click on the "No" r adio Butto n | |
| 208 | ac tiveOption sNoRadionB uttonHtmlE lement.cli ck(); | |
| 209 | fi xture.dete ctChanges( ); | |
| 210 | ||
| 211 | // expect(ac tiveOption sYesRadion ButtonHtml Element.ge tAttribute ("ng-refle ct-model") ).toEqual( "No"); | |
| 212 | // expect(ac tiveOption sNoRadionB uttonHtmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" No"); | |
| 213 | ex pect(compo nent.selec tedActive) .toEqual(" No"); | |
| 214 | }); | |
| 215 | */ | |
| 216 | ||
| 217 | // Frankl in Perez ( 10/18/2017 ): I had t o use the below meth odogy to t est the Te st Case. A bove metho dolgy did not work. | |
| 218 | it('verif y Active I ndicator v alue chang es to "No" when the "No" Radio Button is pressed', async(() => { | |
| 219 | le t activeOp tionsYesRa dionButton DebugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#activ eOptionsYe s')); | |
| 220 | ex pect(activ eOptionsYe sRadionBut tonDebugEl ement).toB eTruthy(); | |
| 221 | le t activeOp tionsYesRa dionButton HtmlElemen t: HTMLEle ment = act iveOptions YesRadionB uttonDebug Element.na tiveElemen t; | |
| 222 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment).toBe Truthy(); | |
| 223 | ||
| 224 | ex pect(activ eOptionsYe sRadionBut tonHtmlEle ment.getAt tribute("n g-reflect- model")).t oEqual("Ye s"); | |
| 225 | ||
| 226 | le t activeOp tionsNoRad ionButtonD ebugElemen t: DebugEl ement = fi xture.debu gElement.q uery(By.cs s('#active OptionsNo' )); | |
| 227 | ex pect(activ eOptionsNo RadionButt onDebugEle ment).toBe Truthy(); | |
| 228 | le t activeOp tionsNoRad ionButtonH tmlElement : HTMLElem ent = acti veOptionsN oRadionBut tonDebugEl ement.nati veElement; | |
| 229 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent).toBeT ruthy(); | |
| 230 | ||
| 231 | ex pect(activ eOptionsNo RadionButt onHtmlElem ent.getAtt ribute("ng -reflect-m odel")).to Equal("Yes "); | |
| 232 | ||
| 233 | ex pect(compo nent.selec tedActive) .toEqual(" Yes"); | |
| 234 | ||
| 235 | fi xture.when Stable().t hen(() => { | |
| 236 | // C lick on th e "No" rad io Button | |
| 237 | acti veOptionsN oRadionBut tonHtmlEle ment.click (); | |
| 238 | // f ixture.det ectChanges (); | |
| 239 | ||
| 240 | // F ranklin Pe rez (10/17 /2017): Fo r some str ange reaso n, the bel ow ALWAYS was "Yes" instead of the "No" expected. | |
| 241 | // e xpect(acti veOptionsY esRadionBu ttonHtmlEl ement.getA ttribute(" ng-reflect -model")). toEqual("N o"); | |
| 242 | // e xpect(acti veOptionsN oRadionBut tonHtmlEle ment.getAt tribute("n g-reflect- model")).t oEqual("No "); | |
| 243 | ||
| 244 | // F ranklin Pe rez (10/17 /2017): Be low did be have corre ctly! | |
| 245 | expe ct(compone nt.selecte dActive).t oEqual("No "); | |
| 246 | }) ; | |
| 247 | })); | |
| 248 | ||
| 249 | it('veri fy "FIPS C ounty Code " text fie ld exists' , () => { | |
| 250 | le t fipsCoun tyCodeText DebugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#fipsC ountyCode' )); | |
| 251 | ex pect(fipsC ountyCodeT extDebugEl ement).toB eTruthy(); | |
| 252 | le t fipsCoun tyCodeText HtmlElemen t: HTMLEle ment = fip sCountyCod eTextDebug Element.na tiveElemen t; | |
| 253 | ex pect(fipsC ountyCodeT extHtmlEle ment).toBe Truthy(); | |
| 254 | ||
| 255 | ex pect(fipsC ountyCodeT extHtmlEle ment.getAt tribute("t ype")).toE qual("text "); | |
| 256 | ex pect(compo nent.selec tedFipsCou ntyCode).t oEqual("") ; | |
| 257 | }); | |
| 258 | ||
| 259 | it('veri fy "FIPS C ounty Code " text fie ld has ini tially an empty stri ng value', () => { | |
| 260 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#fip sCountyCod e')); | |
| 261 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 262 | ex pect(htmlE lement).to BeTruthy() ; | |
| 263 | ||
| 264 | ex pect(htmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" "); | |
| 265 | ex pect(compo nent.selec tedFipsCou ntyCode).t oEqual("") ; | |
| 266 | }); | |
| 267 | ||
| 268 | it('veri fy "FIPS C ounty Code " text fie ld has sam e value as the "sele ctedFipsCo untyCode" variable', () => { | |
| 269 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#fip sCountyCod e')); | |
| 270 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 271 | ex pect(htmlE lement).to BeTruthy() ; | |
| 272 | ||
| 273 | co mponent.se lectedFips CountyCode = "999"; | |
| 274 | fi xture.dete ctChanges( ); | |
| 275 | ||
| 276 | ex pect(htmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" 999"); | |
| 277 | }); | |
| 278 | ||
| 279 | it('veri fy "FIPS S tate Code" text fiel d exists', () => { | |
| 280 | le t fipsStat eCodeTextD ebugElemen t: DebugEl ement = fi xture.debu gElement.q uery(By.cs s('#fipsSt ateCode')) ; | |
| 281 | ex pect(fipsS tateCodeTe xtDebugEle ment).toBe Truthy(); | |
| 282 | le t fipsStat eCodeTextH tmlElement : HTMLElem ent = fips StateCodeT extDebugEl ement.nati veElement; | |
| 283 | ex pect(fipsS tateCodeTe xtHtmlElem ent).toBeT ruthy(); | |
| 284 | ||
| 285 | ex pect(fipsS tateCodeTe xtHtmlElem ent.getAtt ribute("ty pe")).toEq ual("text" ); | |
| 286 | ex pect(compo nent.selec tedFipsSta teCode).to Equal(""); | |
| 287 | }); | |
| 288 | ||
| 289 | it('veri fy "FIPS S tate Code" text fiel d has init ially an e mpty strin g value', () => { | |
| 290 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#fip sStateCode ')); | |
| 291 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 292 | ex pect(htmlE lement).to BeTruthy() ; | |
| 293 | ||
| 294 | ex pect(htmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" "); | |
| 295 | ex pect(compo nent.selec tedFipsCou ntyCode).t oEqual("") ; | |
| 296 | }); | |
| 297 | ||
| 298 | it('veri fy "FIPS S tate Code" text fiel d has same value as the "selec tedFipsSta teCode" va riable', ( ) => { | |
| 299 | le t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#fip sStateCode ')); | |
| 300 | le t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 301 | ex pect(htmlE lement).to BeTruthy() ; | |
| 302 | ||
| 303 | co mponent.se lectedFips StateCode = "CA"; | |
| 304 | fi xture.dete ctChanges( ); | |
| 305 | ||
| 306 | ex pect(htmlE lement.get Attribute( "ng-reflec t-model")) .toEqual(" CA"); | |
| 307 | }); | |
| 308 | ||
| 309 | it ('verify " Urban Indi cator" tex t field ex ists', () => { | |
| 310 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#urban Indicator' )); | |
| 311 | expe ct(debugEl ement).toB eTruthy(); | |
| 312 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 313 | expe ct(htmlEle ment).toBe Truthy(); | |
| 314 | ||
| 315 | expe ct(htmlEle ment.getAt tribute("t ype")).toE qual("text "); | |
| 316 | expe ct(compone nt.selecte dUrbanIndi cator).toE qual(""); | |
| 317 | }) ; | |
| 318 | ||
| 319 | it ('verify " Urban Indi cator" tex t field ha s initiall y an empty string va lue', () = > { | |
| 320 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#urban Indicator' )); | |
| 321 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 322 | expe ct(htmlEle ment).toBe Truthy(); | |
| 323 | ||
| 324 | expe ct(htmlEle ment.getAt tribute("n g-reflect- model")).t oEqual("") ; | |
| 325 | expe ct(compone nt.selecte dUrbanIndi cator).toE qual(""); | |
| 326 | }) ; | |
| 327 | ||
| 328 | it ('verify " Urban Indi cator" tex t field ha s same val ue as the "selectedU rbanIndica tor" varia ble', () = > { | |
| 329 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#urban Indicator' )); | |
| 330 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 331 | expe ct(htmlEle ment).toBe Truthy(); | |
| 332 | ||
| 333 | comp onent.sele ctedUrbanI ndicator = "C1234567 89"; | |
| 334 | fixt ure.detect Changes(); | |
| 335 | ||
| 336 | expe ct(htmlEle ment.getAt tribute("n g-reflect- model")).t oEqual("C1 23456789") ; | |
| 337 | }) ; | |
| 338 | ||
| 339 | it ('verify C ancel butt on exists' , () => { | |
| 340 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#cance l')); | |
| 341 | expe ct(debugEl ement).toB eTruthy(); | |
| 342 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 343 | expe ct(htmlEle ment).toBe Truthy(); | |
| 344 | }) ; | |
| 345 | ||
| 346 | it ('should c all "onCli ckCancel" method whe n Cancel b utton is c licked', a sync(() => { | |
| 347 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#cance l')); | |
| 348 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 349 | ||
| 350 | spyO n(componen t, 'onClic kCancel'); | |
| 351 | ||
| 352 | html Element.cl ick(); | |
| 353 | ||
| 354 | fixt ure.whenSt able().the n(() => { | |
| 355 | expect (component .onClickCa ncel).toHa veBeenCall ed(); | |
| 356 | }); | |
| 357 | }) ); | |
| 358 | ||
| 359 | it ('should r oute to "s tationMain tanceEdit" url when Cancel but ton is cli cked', asy nc(() => { | |
| 360 | ||
| 361 | cons t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#can cel')); | |
| 362 | cons t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 363 | ||
| 364 | cons t navigate Spy = spyO n((<any>co mponent).r outer, 'na vigate'); | |
| 365 | ||
| 366 | html Element.cl ick(); | |
| 367 | ||
| 368 | fixt ure.whenSt able().the n(() => { | |
| 369 | expect (navigateS py).toHave BeenCalled With(['sta tionMainta nceEdit']) ; | |
| 370 | }) | |
| 371 | }) ); | |
| 372 | ||
| 373 | it ('verify S ave button exists', () => { | |
| 374 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#save' )); | |
| 375 | expe ct(debugEl ement).toB eTruthy(); | |
| 376 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 377 | expe ct(htmlEle ment).toBe Truthy(); | |
| 378 | }) ; | |
| 379 | ||
| 380 | it ('should c all "onSub mit" metho d when Sav e button i s clicked' , async(() => { | |
| 381 | let debugEleme nt: DebugE lement = f ixture.deb ugElement. query(By.c ss('#save' )); | |
| 382 | let htmlElemen t: HTMLEle ment = deb ugElement. nativeElem ent; | |
| 383 | ||
| 384 | spyO n(componen t, 'onSubm it'); | |
| 385 | ||
| 386 | html Element.cl ick(); | |
| 387 | ||
| 388 | fixt ure.whenSt able().the n(() => { | |
| 389 | expect (component .onSubmit) .toHaveBee nCalled(); | |
| 390 | }); | |
| 391 | }) ); | |
| 392 | ||
| 393 | it ('should r oute to "s tationMain tanceEdit" url when Save butto n is click ed and suc cessful ad dition of ZIP Code h as been ma de', async (() => { | |
| 394 | cons t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#sav e')); | |
| 395 | cons t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 396 | ||
| 397 | let responseBo dy = { "re sult": "Ad ded ZIP Co de"}; | |
| 398 | stat ionMainten anceAddZip CodeServic e.setRespo nseBody(re sponseBody ); | |
| 399 | ||
| 400 | cons t navigate Spy = spyO n((<any>co mponent).r outer, 'na vigate'); | |
| 401 | ||
| 402 | html Element.cl ick(); | |
| 403 | ||
| 404 | fixt ure.whenSt able().the n(() => { | |
| 405 | expect (navigateS py).toHave BeenCalled With(['sta tionMainta nceEdit']) ; | |
| 406 | }) | |
| 407 | }) ); | |
| 408 | ||
| 409 | // Franklin Perez (10/ 19/2017): Below Test Case code did not w ork, and I had to us e the subs equent one . | |
| 410 | /* | |
| 411 | it ('should d isplay app ropriate E rror Messa ge when Sa ve button is clicked and ZIP C ode not ad ded', asyn c(() => { | |
| 412 | cons t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#sav e')); | |
| 413 | cons t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 414 | ||
| 415 | let responseBo dy = { "me ssage": "Z IP Code er ror Meesag e"}; | |
| 416 | stat ionMainten anceAddZip CodeServic e.setRespo nseBody(re sponseBody ); | |
| 417 | ||
| 418 | html Element.cl ick(); | |
| 419 | ||
| 420 | fixt ure.whenSt able().the n(() => { | |
| 421 | const addZipErro rMessageDe bugElement : DebugEle ment = fix ture.debug Element.qu ery(By.css ('#addZipC odeErrorMe ssage')); | |
| 422 | // exp ect(addZip ErrorMessa geDebugEle ment).toBe Truthy(); | |
| 423 | ||
| 424 | consol e.log(" component. addZipCode ErrorMessa ge = " + c omponent.a ddZipCodeE rrorMessag e); | |
| 425 | }) | |
| 426 | }) ); | |
| 427 | */ | |
| 428 | ||
| 429 | // Fra nklin Pere z (10/19/2 017): Belo w Teest Ca se code wo rk properl y, and I c ould not u se the abo ve one. | |
| 430 | it ('should d isplay app ropriate E rror Messa ge when Sa ve button is clicked and ZIP C ode not ad ded', () = > { | |
| 431 | cons t debugEle ment: Debu gElement = fixture.d ebugElemen t.query(By .css('#sav e')); | |
| 432 | cons t htmlElem ent: HTMLE lement = d ebugElemen t.nativeEl ement; | |
| 433 | ||
| 434 | let responseBo dy = { "me ssage": "Z IP Code er ror Meesag e"}; | |
| 435 | stat ionMainten anceAddZip CodeServic e.setRespo nseBody(re sponseBody ); | |
| 436 | ||
| 437 | html Element.cl ick(); | |
| 438 | fixt ure.detect Changes(); | |
| 439 | ||
| 440 | let addZipErro rMessageDe bugElement : DebugEle ment = fix ture.debug Element.qu ery(By.css ('#addZipC odeErrorMe ssage')); | |
| 441 | expe ct(addZipE rrorMessag eDebugElem ent).toBeT ruthy(); | |
| 442 | let addZipErro rMessageHt mlElement: HTMLEleme nt = addZi pErrorMess ageDebugEl ement.nati veElement; | |
| 443 | expe ct(addZipE rrorMessag eHtmlEleme nt).toBeTr uthy(); | |
| 444 | ||
| 445 | expe ct(addZipE rrorMessag eHtmlEleme nt.innerTe xt).toEqua l(response Body.messa ge); | |
| 446 | expe ct(compone nt.addZipC odeErrorMe ssage).toE qual(respo nseBody.me ssage);; | |
| 447 | }) ; | |
| 448 | ||
| 449 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.