Produced by Araxis Merge on 12/8/2017 1:33:41 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\Testing\src\testing | DisapproveClaimsPageTest.java | Fri Dec 8 17:53:02 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\Testing\src\testing | DisapproveClaimsPageTest.java | Fri Dec 8 18:35:05 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 656 |
| 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 | /** | |
| 2 | * | |
| 3 | */ | |
| 4 | package te sting; | |
| 5 | ||
| 6 | import sta tic org.ju nit.Assert .*; | |
| 7 | ||
| 8 | import jav a.io.File; | |
| 9 | import jav a.util.con current.Ti meUnit; | |
| 10 | ||
| 11 | import org .junit.Aft er; | |
| 12 | import org .junit.Aft erClass; | |
| 13 | import org .junit.Bef ore; | |
| 14 | import org .junit.Bef oreClass; | |
| 15 | import org .junit.Tes t; | |
| 16 | import org .junit.int ernal.Text Listener; | |
| 17 | import org .junit.run ner.JUnitC ore; | |
| 18 | import org .junit.run ner.Result ; | |
| 19 | import org .openqa.se lenium.Ale rt; | |
| 20 | import org .openqa.se lenium.By; | |
| 21 | import org .openqa.se lenium.Key s; | |
| 22 | import org .openqa.se lenium.NoA lertPresen tException ; | |
| 23 | import org .openqa.se lenium.NoS uchElement Exception; | |
| 24 | import org .openqa.se lenium.Web Driver; | |
| 25 | import org .openqa.se lenium.Web Element; | |
| 26 | import org .openqa.se lenium.ie. InternetEx plorerDriv er; | |
| 27 | import org .openqa.se lenium.fir efox.Firef oxDriver; | |
| 28 | import org .openqa.se lenium.sup port.ui.Ex pectedCond itions; | |
| 29 | import org .openqa.se lenium.sup port.ui.Se lect; | |
| 30 | import org .openqa.se lenium.sup port.ui.Wa it; | |
| 31 | import org .openqa.se lenium.sup port.ui.We bDriverWai t; | |
| 32 | ||
| 33 | import org .openqa.se lenium.rem ote.Desire dCapabilit ies; | |
| 34 | ||
| 35 | /** | |
| 36 | * @author DN S PEREZF | |
| 37 | * | |
| 38 | */ | |
| 39 | public cla ss Disappr oveClaimsP ageTest { | |
| 40 | pr ivate WebD river driv er; | |
| 41 | pr ivate Stri ng baseUrl ; | |
| 42 | pr ivate Stri ng disappr oveClaimsP ageUrl; | |
| 43 | pr ivate Stri ng agedCla imsPageUrl ; | |
| 44 | pr ivate Stri ng searchC laimsPageU rl; | |
| 45 | ||
| 46 | pu blic stati c void mai n(String a rgs[]) { | |
| 47 | JUni tCore juni t = new JU nitCore(); | |
| 48 | juni t.addListe ner(new Te xtListener (System.ou t)); | |
| 49 | Resu lt result = junit.ru n(Disappro veClaimsPa geTest.cla ss); // Re place "Sam pleTest" w ith the na me of your class | |
| 50 | if ( result.get FailureCou nt() > 0) { | |
| 51 | System.out .println(" Test faile d.\n" + re sult); | |
| 52 | System.exi t(1); | |
| 53 | } el se { | |
| 54 | System.out .println(" Test finis hed succes sfully."); | |
| 55 | System.exi t(0); | |
| 56 | } | |
| 57 | } | |
| 58 | ||
| 59 | /* * | |
| 60 | * @throws j ava.lang.E xception | |
| 61 | * / | |
| 62 | @B eforeClass | |
| 63 | pu blic stati c void set UpBeforeCl ass() thro ws Excepti on { | |
| 64 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin se tUpBeforeC lass()"); | |
| 65 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End setU pBeforeCla ss()"); | |
| 66 | } | |
| 67 | ||
| 68 | /* * | |
| 69 | * @throws j ava.lang.E xception | |
| 70 | * / | |
| 71 | @A fterClass | |
| 72 | pu blic stati c void tea rDownAfter Class() th rows Excep tion { | |
| 73 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin te arDownAfte rClass()") ; | |
| 74 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End tear DownAfterC lass()"); | |
| 75 | } | |
| 76 | ||
| 77 | /* * | |
| 78 | * @throws j ava.lang.E xception | |
| 79 | * / | |
| 80 | @B efore | |
| 81 | pu blic void setUp() th rows Excep tion { | |
| 82 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin se tUp()"); | |
| 83 | ||
| 84 | File file = ne w File("dr ivers/IEDr iverServer .exe"); | |
| 85 | Syst em.setProp erty("webd river.ie.d river", fi le.getAbso lutePath() ); | |
| 86 | driv er = new I nternetExp lorerDrive r(); | |
| 87 | ||
| 88 | base Url = "htt p://localh ost:4200/" ; | |
| 89 | driv er.manage( ).timeouts ().implici tlyWait(30 , TimeUnit .SECONDS); | |
| 90 | Syst em.out.pri ntln("End Executing 'setUp' me thod"); | |
| 91 | ||
| 92 | disa pproveClai msPageUrl = baseUrl + "disappr ove"; | |
| 93 | aged ClaimsPage Url = base Url + "age dClaims"; | |
| 94 | sear chClaimsPa geUrl = ba seUrl + "s earch"; | |
| 95 | ||
| 96 | goTo LoginPageA ndClickLog inButton() ; | |
| 97 | Thre ad.sleep(2 000); | |
| 98 | ||
| 99 | clic kSetActive Button(); | |
| 100 | Thre ad.sleep(2 000); | |
| 101 | ||
| 102 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End setU p()"); | |
| 103 | } | |
| 104 | ||
| 105 | // Assumes t hat there will be Cl aims in th e Table an d that the re will be an "error Message". | |
| 106 | pr ivate void goToDisap proveClaim sPageViaAg edClaimsPa geSelectin gAllClaims () throws Exception { | |
| 107 | driv er.get(age dClaimsPag eUrl); | |
| 108 | Thre ad.sleep(3 000); | |
| 109 | ||
| 110 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.cl assName("p age-title" )); | |
| 111 | WebE lement pag eTitle_h1_ Element = pageTitleE lement.fin dElement(B y.tagName( "h1")); | |
| 112 | asse rtEquals(" Aged Claim s Page not reached!" , "Aged Cl aims", pag eTitle_h1_ Element.ge tText()); | |
| 113 | ||
| 114 | // S elected al l the Clai ms in the Aged Claim s Table. | |
| 115 | WebE lement tab leComponen tElement = driver.fi ndElement( By.id("tab le")); | |
| 116 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 117 | WebE lement sel ectedColum nElement = dataTable Element.fi ndElement( By.id("sel ect")); | |
| 118 | WebE lement sel ectColumnC heckBoxEle ment = sel ectedColum nElement.f indElement (By.name(" colcheckbo x")); | |
| 119 | sele ctColumnCh eckBoxElem ent.click( ); | |
| 120 | Thre ad.sleep(2 000); | |
| 121 | ||
| 122 | // C lick on th e Disappro ve Button of the Age d Claims P age. | |
| 123 | WebE lement dis approveBut tonElement = driver. findElemen t(By.id("u pperDisapp roveButton ")); | |
| 124 | disa pproveButt onElement. click(); | |
| 125 | Thre ad.sleep(2 000); | |
| 126 | ||
| 127 | // T est to see that it i s the Disa pprove Cla ims Page t hat has be en reached . | |
| 128 | page TitleEleme nt = drive r.findElem ent(By.cla ssName("pa ge-title") ); | |
| 129 | page Title_h1_E lement = p ageTitleEl ement.find Element(By .tagName(" h1")); | |
| 130 | asse rtEquals(" Disapprove Claims Pa ge not rea ched! Inco rrect Titl e!", "Disa pprove Cla ims", page Title_h1_E lement.get Text()); | |
| 131 | asse rtEquals(" Inorrect U RL reached for Disap prove Clai ms Page!", disapprov eClaimsPag eUrl, driv er.getCurr entUrl()); | |
| 132 | ||
| 133 | Thre ad.sleep(2 000); | |
| 134 | } | |
| 135 | ||
| 136 | pr ivate void goToDisap proveClaim sPageViaSe archClaims PageAndSel ectingOnly RejectedCl aims() thr ows Except ion { | |
| 137 | driv er.get(sea rchClaimsP ageUrl); | |
| 138 | Thre ad.sleep(3 000); | |
| 139 | ||
| 140 | // V erify it's the Searc h Claims P age. | |
| 141 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.cl assName("p age-title" )); | |
| 142 | WebE lement pag eTitle_h1_ Element = pageTitleE lement.fin dElement(B y.tagName( "h1")); | |
| 143 | asse rtEquals(" Search Cla ims Page n ot reached !", "Claim s Search", pageTitle _h1_Elemen t.getText( )); | |
| 144 | ||
| 145 | // S elect the "All" Clai m Type. | |
| 146 | Sele ct claimTy peSelectBo x = new Se lect(drive r.findElem ent(By.nam e("claimTy pe"))); | |
| 147 | clai mTypeSelec tBox.selec tByVisible Text("All" ); | |
| 148 | Thre ad.sleep(1 000); | |
| 149 | ||
| 150 | // S elect the "Rejected" Claim Sta tus. | |
| 151 | Sele ct claimSt atusSelect Box = new Select(dri ver.findEl ement(By.n ame("claim Status"))) ; | |
| 152 | clai mStatusSel ectBox.sel ectByVisib leText("Re jected"); | |
| 153 | Thre ad.sleep(1 000); | |
| 154 | ||
| 155 | // C lick on th e Search B utton to b ring uo al l the "Rej ected" Cla ims. | |
| 156 | WebE lement sea rchButtonE lement = d river.find Element(By .id("searc h")); | |
| 157 | sear chButtonEl ement.clic k(); | |
| 158 | Thre ad.sleep(4 000); | |
| 159 | ||
| 160 | // S elect all the Reject ed Claims for Disapp roval. | |
| 161 | WebE lement tab leComponen tElement = driver.fi ndElement( By.id("tab le")); | |
| 162 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 163 | WebE lement sel ectedColum nElement = dataTable Element.fi ndElement( By.id("sel ect")); | |
| 164 | WebE lement col umnCheckBo xElement = selectedC olumnEleme nt.findEle ment(By.na me("colche ckbox")); | |
| 165 | colu mnCheckBox Element.cl ick(); | |
| 166 | Thre ad.sleep(2 000); | |
| 167 | ||
| 168 | // C lick on th e Disappro ve Button. | |
| 169 | WebE lement dis approveBut tonElement = driver. findElemen t(By.id("u pperDisapp rove")); | |
| 170 | disa pproveButt onElement. click(); | |
| 171 | ||
| 172 | Thre ad.sleep(4 000); | |
| 173 | } | |
| 174 | ||
| 175 | pr ivate void goToDisap proveClaim sPageViaSe archClaims PageAndSel ectingOnly CompletedC laims() th rows Excep tion { | |
| 176 | driv er.get(sea rchClaimsP ageUrl); | |
| 177 | Thre ad.sleep(3 000); | |
| 178 | ||
| 179 | // V erify it's the Searc h Claims P age. | |
| 180 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.cl assName("p age-title" )); | |
| 181 | WebE lement pag eTitle_h1_ Element = pageTitleE lement.fin dElement(B y.tagName( "h1")); | |
| 182 | asse rtEquals(" Search Cla ims Page n ot reached !", "Claim s Search", pageTitle _h1_Elemen t.getText( )); | |
| 183 | ||
| 184 | // S elect the "All" Clai m Type. | |
| 185 | Sele ct claimTy peSelectBo x = new Se lect(drive r.findElem ent(By.nam e("claimTy pe"))); | |
| 186 | clai mTypeSelec tBox.selec tByVisible Text("All" ); | |
| 187 | Thre ad.sleep(1 000); | |
| 188 | ||
| 189 | // S elect the "Complete" Claim Sta tus. | |
| 190 | Sele ct claimSt atusSelect Box = new Select(dri ver.findEl ement(By.n ame("claim Status"))) ; | |
| 191 | clai mStatusSel ectBox.sel ectByVisib leText("Co mplete"); | |
| 192 | Thre ad.sleep(1 000); | |
| 193 | ||
| 194 | // C lick on th e Search B utton to b ring uo al l the "Rej ected" Cla ims. | |
| 195 | WebE lement sea rchButtonE lement = d river.find Element(By .id("searc h")); | |
| 196 | sear chButtonEl ement.clic k(); | |
| 197 | Thre ad.sleep(4 000); | |
| 198 | ||
| 199 | // S elect all the Reject ed Claims for Disapp roval. | |
| 200 | WebE lement tab leComponen tElement = driver.fi ndElement( By.id("tab le")); | |
| 201 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 202 | WebE lement sel ectedColum nElement = dataTable Element.fi ndElement( By.id("sel ect")); | |
| 203 | WebE lement col umnCheckBo xElement = selectedC olumnEleme nt.findEle ment(By.na me("colche ckbox")); | |
| 204 | colu mnCheckBox Element.cl ick(); | |
| 205 | Thre ad.sleep(2 000); | |
| 206 | ||
| 207 | // C lick on th e Disappro ve Button. | |
| 208 | WebE lement dis approveBut tonElement = driver. findElemen t(By.id("u pperDisapp rove")); | |
| 209 | disa pproveButt onElement. click(); | |
| 210 | ||
| 211 | Thre ad.sleep(4 000); | |
| 212 | } | |
| 213 | ||
| 214 | pr ivate void clickSetA ctiveButto n() throws Exception { | |
| 215 | WebE lement set ActiveButt on = drive r.findElem ent(By.id( "setActive ")); | |
| 216 | asse rtNotNull( setActiveB utton); | |
| 217 | setA ctiveButto n.click(); | |
| 218 | // s etActiveBu tton.submi t(); // No t inside o f a "form" element. | |
| 219 | setA ctiveButto n.sendKeys (Keys.ENTE R); | |
| 220 | } | |
| 221 | ||
| 222 | pr ivate void goToLogin PageAndCli ckLoginBut ton() thro ws Excepti on { | |
| 223 | driv er.get(bas eUrl); | |
| 224 | WebE lement log inButton = driver.fi ndElement( By.id("log inBtn")); | |
| 225 | asse rtNotNull( loginButto n); | |
| 226 | ||
| 227 | // C lick the L ogin Butto n. Had to do this as advised b y Joshua L one | |
| 228 | // t o get this to work t o forward to next pa ge. | |
| 229 | logi nButton.cl ick(); | |
| 230 | logi nButton.su bmit(); | |
| 231 | logi nButton.se ndKeys(Key s.ENTER); | |
| 232 | } | |
| 233 | ||
| 234 | /* * | |
| 235 | * @throws j ava.lang.E xception | |
| 236 | * / | |
| 237 | @A fter | |
| 238 | pu blic void tearDown() throws Ex ception { | |
| 239 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin te arDown()") ; | |
| 240 | ||
| 241 | Thre ad.sleep(5 000); | |
| 242 | driv er.close() ; | |
| 243 | driv er.quit(); | |
| 244 | ||
| 245 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End tear Down()"); | |
| 246 | } | |
| 247 | ||
| 248 | @T est | |
| 249 | pu blic void test_1_can celButton( ) throws E xception { | |
| 250 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin te st_1_cance lButton()" ); | |
| 251 | ||
| 252 | goTo Disapprove ClaimsPage ViaAgedCla imsPageSel ectingAllC laims(); | |
| 253 | ||
| 254 | WebE lement can celButton = driver.f indElement (By.id("ca ncelButton ")); | |
| 255 | ||
| 256 | canc elButton.c lick(); | |
| 257 | Thre ad.sleep(3 000); | |
| 258 | ||
| 259 | // H ad to comm ent out th e below du e to getti ng a State ElementRef erenceExce ption | |
| 260 | // stating t hat the El ement is n o longer v alid. | |
| 261 | // c ancelButto n.submit() ; | |
| 262 | // c ancelButto n.sendKeys (Keys.ENTE R); | |
| 263 | ||
| 264 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 265 | asse rtNotNull( pageTitleE lement); | |
| 266 | ||
| 267 | asse rtEquals(" Incorrect Page Title for page forwarded after clic king 'Canc el' button !", | |
| 268 | "Claim s", pageTi tleElement .getText() ); | |
| 269 | ||
| 270 | asse rtEquals(" Inorrect U RL reached for Claim s Home Pag e!", "http ://localho st:4200/cl aimsHomePa ge", drive r.getCurre ntUrl()); | |
| 271 | ||
| 272 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End test _1_cancelB utton()"); | |
| 273 | } | |
| 274 | ||
| 275 | @T est | |
| 276 | pu blic void test_2_fai lureMessag eWhenClaim sInTable() throws Ex ception { | |
| 277 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin te st_2_failu reMessageW henClaimsI nTable()") ; | |
| 278 | ||
| 279 | goTo Disapprove ClaimsPage ViaAgedCla imsPageSel ectingAllC laims(); | |
| 280 | ||
| 281 | // E xception t hrown if n ot present . | |
| 282 | WebE lement ale rtErrorMes sageElemen t = driver .findEleme nt(By.id(" errorMessa geWhenClai msPresentI nTable")); | |
| 283 | ||
| 284 | Stri ng partOfE xpectedErr orMessage_ 1 = "The f ollowing c laims cann ot be disa pproved be cause they are "; | |
| 285 | asse rtTrue("Ex pected Fir st part of Failure M essage not present!" , alertErr orMessageE lement.get Text().con tains(part OfExpected ErrorMessa ge_1)); | |
| 286 | ||
| 287 | Stri ng partOfE xpectedErr orMessage_ 2 = "compl eted, part ially reco nciled, or rejected: "; | |
| 288 | asse rtTrue("Ex pected Sec ond part o f Failure Message no t present! ", alertEr rorMessage Element.ge tText().co ntains(par tOfExpecte dErrorMess age_2)); | |
| 289 | ||
| 290 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End test _2_failure MessageWhe nClaimsInT able()"); | |
| 291 | } | |
| 292 | ||
| 293 | @T est | |
| 294 | pu blic void test_3_fai lureMessag eWhenClaim sAllReject ed() throw s Exceptio n { | |
| 295 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin te st_3_failu reMessageW henClaimsA llRejected ()"); | |
| 296 | ||
| 297 | goTo Disapprove ClaimsPage ViaSearchC laimsPageA ndSelectin gOnlyRejec tedClaims( ); | |
| 298 | ||
| 299 | // E xception t hrown if n ot present . | |
| 300 | WebE lement ale rtErrorMes sageElemen t = driver .findEleme nt(By.id(" errorMessa geWhenNoCl aimsPresen tInTable") ); | |
| 301 | ||
| 302 | Stri ng partOfE xpectedErr orMessage_ 1 = "The f ollowing c laims cann ot be disa pproved be cause they are "; | |
| 303 | asse rtTrue("Ex pected Fir st part of Failure M essage not present!" , alertErr orMessageE lement.get Text().con tains(part OfExpected ErrorMessa ge_1)); | |
| 304 | ||
| 305 | Stri ng partOfE xpectedErr orMessage_ 2 = "compl eted, part ially reco nciled, or rejected: "; | |
| 306 | asse rtTrue("Ex pected Sec ond part o f Failure Message no t present! ", alertEr rorMessage Element.ge tText().co ntains(par tOfExpecte dErrorMess age_2)); | |
| 307 | ||
| 308 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End test _3_failure MessageWhe nClaimsAll Rejected() "); | |
| 309 | } | |
| 310 | ||
| 311 | @T est | |
| 312 | pu blic void test_4_fai lureMessag eWhenClaim sAllComple ted() thro ws Excepti on { | |
| 313 | Syst em.out.pri ntln("Disa pproveClai msPageTest : Begin te st_4_failu reMessageW henClaimsA llComplete d()"); | |
| 314 | ||
| 315 | goTo Disapprove ClaimsPage ViaSearchC laimsPageA ndSelectin gOnlyCompl etedClaims (); | |
| 316 | ||
| 317 | // E xception t hrown if n ot present . | |
| 318 | WebE lement ale rtErrorMes sageElemen t = driver .findEleme nt(By.id(" errorMessa geWhenNoCl aimsPresen tInTable") ); | |
| 319 | ||
| 320 | Stri ng partOfE xpectedErr orMessage_ 1 = "The f ollowing c laims cann ot be disa pproved be cause they are "; | |
| 321 | asse rtTrue("Ex pected Fir st part of Failure M essage not present!" , alertErr orMessageE lement.get Text().con tains(part OfExpected ErrorMessa ge_1)); | |
| 322 | ||
| 323 | Stri ng partOfE xpectedErr orMessage_ 2 = "compl eted, part ially reco nciled, or rejected: "; | |
| 324 | asse rtTrue("Ex pected Sec ond part o f Failure Message no t present! ", alertEr rorMessage Element.ge tText().co ntains(par tOfExpecte dErrorMess age_2)); | |
| 325 | ||
| 326 | Syst em.out.pri ntln("Disa pproveClai msPageTest : End test _4_failure MessageWhe nClaimsAll Completed( )"); | |
| 327 | } | |
| 328 | ||
| 329 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.