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 | RejectClaimsPageTest.java | Fri Dec 8 17:53:06 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\Testing\src\testing | RejectClaimsPageTest.java | Fri Dec 8 18:35:08 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1440 |
| 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.Lis t; | |
| 10 | import jav a.util.con current.Ti meUnit; | |
| 11 | ||
| 12 | import org .junit.Aft er; | |
| 13 | import org .junit.Aft erClass; | |
| 14 | import org .junit.Bef ore; | |
| 15 | import org .junit.Bef oreClass; | |
| 16 | import org .junit.Fix MethodOrde r; | |
| 17 | import org .junit.run ners.Metho dSorters; | |
| 18 | import org .junit.Tes t; | |
| 19 | import org .junit.int ernal.Text Listener; | |
| 20 | import org .junit.run ner.JUnitC ore; | |
| 21 | import org .junit.run ner.Result ; | |
| 22 | import org .openqa.se lenium.By; | |
| 23 | import org .openqa.se lenium.Key s; | |
| 24 | import org .openqa.se lenium.NoS uchElement Exception; | |
| 25 | import org .openqa.se lenium.Web Driver; | |
| 26 | import org .openqa.se lenium.Web Element; | |
| 27 | import org .openqa.se lenium.ie. InternetEx plorerDriv er; | |
| 28 | ||
| 29 | /** | |
| 30 | * @author DN S PEREZF | |
| 31 | * | |
| 32 | */ | |
| 33 | @FixMethod Order(Meth odSorters. NAME_ASCEN DING) | |
| 34 | public cla ss RejectC laimsPageT est { | |
| 35 | pr ivate WebD river driv er; | |
| 36 | pr ivate Stri ng baseUrl ; | |
| 37 | pr ivate Stri ng rejectC laimsPageU rl; | |
| 38 | ||
| 39 | pu blic stati c void mai n(String a rgs[]) { | |
| 40 | JUni tCore juni t = new JU nitCore(); | |
| 41 | juni t.addListe ner(new Te xtListener (System.ou t)); | |
| 42 | Resu lt result = junit.ru n(RejectCl aimsPageTe st.class); // Replac e "SampleT est" with the name o f your cla ss | |
| 43 | if ( result.get FailureCou nt() > 0) { | |
| 44 | System.out .println(" Test faile d.\n" + re sult); | |
| 45 | System.exi t(1); | |
| 46 | } el se { | |
| 47 | System.out .println(" Test finis hed succes sfully."); | |
| 48 | System.exi t(0); | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 52 | /* * | |
| 53 | * @throws j ava.lang.E xception | |
| 54 | * / | |
| 55 | @B eforeClass | |
| 56 | pu blic stati c void set UpBeforeCl ass() thro ws Excepti on { | |
| 57 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin setUpB eforeClass ()"); | |
| 58 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d setUpBef oreClass() "); | |
| 59 | } | |
| 60 | ||
| 61 | /* * | |
| 62 | * @throws j ava.lang.E xception | |
| 63 | * / | |
| 64 | @A fterClass | |
| 65 | pu blic stati c void tea rDownAfter Class() th rows Excep tion { | |
| 66 | Syst em.out.pri ntln("ARej ectClaimsP ageTest: B egin tearD ownAfterCl ass()"); | |
| 67 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d tearDown AfterClass ()"); | |
| 68 | } | |
| 69 | ||
| 70 | /* * | |
| 71 | * @throws j ava.lang.E xception | |
| 72 | * / | |
| 73 | @B efore | |
| 74 | pu blic void setUp() th rows Excep tion { | |
| 75 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin setUp( )"); | |
| 76 | ||
| 77 | File file = ne w File("dr ivers/IEDr iverServer .exe"); | |
| 78 | Syst em.setProp erty("webd river.ie.d river", fi le.getAbso lutePath() ); | |
| 79 | driv er = new I nternetExp lorerDrive r(); | |
| 80 | ||
| 81 | base Url = "htt p://localh ost:4200/" ; | |
| 82 | driv er.manage( ).timeouts ().implici tlyWait(30 , TimeUnit .SECONDS); | |
| 83 | ||
| 84 | goTo LoginPageA ndClickLog inButton() ; | |
| 85 | Thre ad.sleep(5 000); | |
| 86 | clic kSetActive Button(); | |
| 87 | ||
| 88 | reje ctClaimsPa geUrl = ba seUrl + "r eject"; | |
| 89 | ||
| 90 | Thre ad.sleep(3 000); | |
| 91 | ||
| 92 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d setUp()" ); | |
| 93 | } | |
| 94 | ||
| 95 | pr ivate void clickSetA ctiveButto n() throws Exception { | |
| 96 | WebE lement set ActiveButt on = drive r.findElem ent(By.id( "setActive ")); | |
| 97 | asse rtNotNull( setActiveB utton); | |
| 98 | setA ctiveButto n.click(); | |
| 99 | // s etActiveBu tton.submi t(); // No t inside o f a "form" element. | |
| 100 | setA ctiveButto n.sendKeys (Keys.ENTE R); | |
| 101 | } | |
| 102 | ||
| 103 | pr ivate void goToLogin PageAndCli ckLoginBut ton() thro ws Excepti on { | |
| 104 | driv er.get(bas eUrl); | |
| 105 | WebE lement log inButton = driver.fi ndElement( By.id("log inBtn")); | |
| 106 | asse rtNotNull( loginButto n); | |
| 107 | ||
| 108 | // C lick the L ogin Butto n. Had to do this as advised b y Joshua L one | |
| 109 | // t o get this to work t o forward to next pa ge. | |
| 110 | logi nButton.cl ick(); | |
| 111 | logi nButton.su bmit(); | |
| 112 | logi nButton.se ndKeys(Key s.ENTER); | |
| 113 | } | |
| 114 | ||
| 115 | /* * | |
| 116 | * @throws j ava.lang.E xception | |
| 117 | * / | |
| 118 | @A fter | |
| 119 | pu blic void tearDown() throws Ex ception { | |
| 120 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin tearDo wn()"); | |
| 121 | ||
| 122 | Thre ad.sleep(5 000); | |
| 123 | driv er.close() ; | |
| 124 | driv er.quit(); | |
| 125 | Thre ad.sleep(5 000); | |
| 126 | Syst em.out.pri ntln("End Executing 'tearDown' method"); | |
| 127 | ||
| 128 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d tearDown ()"); | |
| 129 | } | |
| 130 | ||
| 131 | @T est | |
| 132 | pu blic void test_1_Rej ectClaimsP ageAppears WhenGoingD irectly() throws Exc eption { | |
| 133 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_1 _RejectCla imsPageApp earsWhenGo ingDirectl y()"); | |
| 134 | ||
| 135 | driv er.get(rej ectClaimsP ageUrl); | |
| 136 | Thre ad.sleep(3 000); | |
| 137 | ||
| 138 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 139 | asse rtNotNull( pageTitleE lement); | |
| 140 | ||
| 141 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 142 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 143 | ||
| 144 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 145 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 146 | ||
| 147 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 148 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 149 | ||
| 150 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_1_R ejectClaim sPageAppea rsWhenGoin gDirectly( )"); | |
| 151 | } | |
| 152 | ||
| 153 | @T est | |
| 154 | pu blic void test_2_Rej ectClaimsP ageAppears ViaDropDow nMenuOptio ns() throw s Exceptio n { | |
| 155 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_2 _RejectCla imsPageApp earsViaDro pDownMenuO ptions()") ; | |
| 156 | ||
| 157 | List <WebElemen t> dropDow nParentEle mentsList = driver.f indElement s(By.class Name("drop down-paren t")); | |
| 158 | asse rtNotNull( dropDownPa rentElemen tsList); | |
| 159 | asse rtTrue("Fa iled to fi nd any ele ments with class equ al to 'dro pdown-pare nt'", drop DownParent ElementsLi st.size() > 0); | |
| 160 | ||
| 161 | bool ean claims DropDownPa rentElemen tFound = f alse; | |
| 162 | for (int i = 0 ; i < drop DownParent ElementsLi st.size(); i++) { | |
| 163 | ||
| 164 | WebEle ment dropD ownParentE lement = d ropDownPar entElement sList.get( i); | |
| 165 | assert NotNull(dr opDownPare ntElement) ; | |
| 166 | ||
| 167 | WebEle ment aElem ent = drop DownParent Element.fi ndElement( By.tagName ("a")); | |
| 168 | assert NotNull("N o 'a' elem ent was fo und under a Drop Dow n Parent E lement!", aElement); | |
| 169 | ||
| 170 | if ( " Claims".eq uals(aElem ent.getTex t()) ) { | |
| 171 | claimsDr opDownPare ntElementF ound = tru e; | |
| 172 | ||
| 173 | // Click on the Cl aims Paren t Drop Dow n Parent E lement | |
| 174 | aElement .click(); | |
| 175 | Thread.s leep(3000) ; | |
| 176 | ||
| 177 | WebEleme nt claimsD ropDownSho wElement = dropDownP arentEleme nt.findEle ment(By.id ("claims") ); | |
| 178 | assertNo tNull("No 'Claims' D rop Down S how Elemen t found un der the 'C laims' Dro p Down Par ent Elemen t!", claim sDropDownS howElement ); | |
| 179 | ||
| 180 | WebEleme nt rejectC laims_aEle ment = cla imsDropDow nShowEleme nt.findEle ment(By.li nkText("Re ject Claim s")); | |
| 181 | assertNo tNull("No 'Reject Cl aims' A Ta g Element Found!", r ejectClaim s_aElement ); | |
| 182 | ||
| 183 | // Click on the "R eject Clai ms" Option to bring up the "Re ject Claim s" page. | |
| 184 | rejectCl aims_aElem ent.click( ); | |
| 185 | Thread.s leep(3000) ; | |
| 186 | ||
| 187 | WebEleme nt pageTit leElement = driver.f indElement (By.id("pa geTitle")) ; | |
| 188 | assertNo tNull(page TitleEleme nt); | |
| 189 | ||
| 190 | assertEq uals("Inco rrect Page Title for Reject Cl aims Page! ", | |
| 191 | "R eject Clai ms", pageT itleElemen t.getText( )); | |
| 192 | ||
| 193 | WebEleme nt section HeaderTitl eElement = driver.fi ndElement( By.id("sec tionHeader Title")); | |
| 194 | assertNo tNull(sect ionHeaderT itleElemen t); | |
| 195 | ||
| 196 | assertEq uals("Inco rrect Sect ion Header Title for Reject Cl aims Page! ", | |
| 197 | "D isapproved Claims", sectionHea derTitleEl ement.getT ext()); | |
| 198 | ||
| 199 | break; | |
| 200 | } | |
| 201 | } | |
| 202 | ||
| 203 | if ( !claimsDro pDownParen tElementFo und) { | |
| 204 | fail(" No 'Claims Drop Down Parent Me nu Found!' "); | |
| 205 | } | |
| 206 | ||
| 207 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_2_R ejectClaim sPageAppea rsViaDropD ownMenuOpt ions()"); | |
| 208 | } | |
| 209 | ||
| 210 | @T est | |
| 211 | pu blic void test_3_IfR ejectedCla imsTableEx ists_Verif yColumnsEx istAndName sAreCorrec t() throws Exception { | |
| 212 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_3 _IfRejecte dClaimsTab leExists_V erifyColum nsExistAnd NamesAreCo rrect()"); | |
| 213 | ||
| 214 | driv er.get(rej ectClaimsP ageUrl); | |
| 215 | Thre ad.sleep(4 000); | |
| 216 | ||
| 217 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 218 | asse rtNotNull( pageTitleE lement); | |
| 219 | ||
| 220 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 221 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 222 | ||
| 223 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 224 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 225 | ||
| 226 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 227 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 228 | ||
| 229 | WebE lement tab leComponen tElement = null; | |
| 230 | try { | |
| 231 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 232 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 233 | if ( tableCompo nentElemen t == null) { | |
| 234 | return ; | |
| 235 | } | |
| 236 | ||
| 237 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 238 | asse rtNotNull( "The 'data table' ele ment insid e of the ' table' ele ment does not exist! ", dataTab leElement) ; | |
| 239 | ||
| 240 | WebE lement sel ectedColum nElement = dataTable Element.fi ndElement( By.id("sel ected")); | |
| 241 | asse rtNotNull( "The 'sele cted' Colu mn Header does not e xist!", se lectedColu mnElement) ; | |
| 242 | ||
| 243 | WebE lement inp utColumnEl ement = se lectedColu mnElement. findElemen t(By.name( "colcheckb ox")); | |
| 244 | asse rtNotNull( "The 'sele cted' Colu mn Header does not h ave a chec kbox!", in putColumnE lement); | |
| 245 | ||
| 246 | WebE lement cla imIdColumn Element = dataTableE lement.fin dElement(B y.id("clai mId")); | |
| 247 | asse rtNotNull( "The 'clai mId' Colum n Header d oes not ex ist!", cla imIdColumn Element); | |
| 248 | ||
| 249 | WebE lement div ColumnElem ent = clai mIdColumnE lement.fin dElement(B y.tagName( "div")); | |
| 250 | asse rtNotNull( "The 'clai mId' Colum n Header d oes not ha ve a 'div' element!" , divColum nElement); | |
| 251 | asse rtEquals(" Claim ID", divColumn Element.ge tText()); | |
| 252 | ||
| 253 | WebE lement cla imTypeColu mnElement = dataTabl eElement.f indElement (By.id("cl aimType")) ; | |
| 254 | asse rtNotNull( "The 'clai mType' Col umn Header does not exist!", c laimTypeCo lumnElemen t); | |
| 255 | ||
| 256 | divC olumnEleme nt = claim TypeColumn Element.fi ndElement( By.tagName ("div")); | |
| 257 | asse rtNotNull( "The 'clai mType' Col umn Header does not have a 'di v' element !", divCol umnElement ); | |
| 258 | asse rtEquals(" Claim Type ", divColu mnElement. getText()) ; | |
| 259 | ||
| 260 | WebE lement her oColumnEle ment = dat aTableElem ent.findEl ement(By.i d("hero")) ; | |
| 261 | asse rtNotNull( "The 'hero ' Column H eader does not exist !", heroCo lumnElemen t); | |
| 262 | ||
| 263 | divC olumnEleme nt = heroC olumnEleme nt.findEle ment(By.ta gName("div ")); | |
| 264 | asse rtNotNull( "The 'hero ' Column H eader does not have a 'div' el ement!", d ivColumnEl ement); | |
| 265 | asse rtEquals(" HERO", div ColumnElem ent.getTex t()); | |
| 266 | ||
| 267 | WebE lement pat ientIdColu mnElement = dataTabl eElement.f indElement (By.id("pa tientId")) ; | |
| 268 | asse rtNotNull( "The 'pati entId' Col umn Header does not exist!", p atientIdCo lumnElemen t); | |
| 269 | ||
| 270 | divC olumnEleme nt = patie ntIdColumn Element.fi ndElement( By.tagName ("div")); | |
| 271 | asse rtNotNull( "The 'pati entId' Col umn Header does not have a 'di v' element !", divCol umnElement ); | |
| 272 | asse rtEquals(" Patient ID ", divColu mnElement. getText()) ; | |
| 273 | ||
| 274 | WebE lement cla imDateColu mnElement = dataTabl eElement.f indElement (By.id("cl aimDate")) ; | |
| 275 | asse rtNotNull( "The 'clai mDate' Col umn Header does not exist!", c laimDateCo lumnElemen t); | |
| 276 | ||
| 277 | divC olumnEleme nt = claim DateColumn Element.fi ndElement( By.tagName ("div")); | |
| 278 | asse rtNotNull( "The 'clai mDate' Col umn Header does not have a 'di v' element !", divCol umnElement ); | |
| 279 | asse rtEquals(" Claim Date ", divColu mnElement. getText()) ; | |
| 280 | ||
| 281 | WebE lement cla imAmountCo lumnElemen t = dataTa bleElement .findEleme nt(By.id(" claimAmoun t")); | |
| 282 | asse rtNotNull( "The 'clai mAmount' C olumn Head er does no t exist!", claimAmou ntColumnEl ement); | |
| 283 | ||
| 284 | divC olumnEleme nt = claim AmountColu mnElement. findElemen t(By.tagNa me("div")) ; | |
| 285 | asse rtNotNull( "The 'clai mAmount' C olumn Head er does no t have a ' div' eleme nt!", divC olumnEleme nt); | |
| 286 | asse rtEquals(" Claim Amou nt", divCo lumnElemen t.getText( )); | |
| 287 | ||
| 288 | WebE lement pro viderNameC olumnEleme nt = dataT ableElemen t.findElem ent(By.id( "providerN ame")); | |
| 289 | asse rtNotNull( "The 'prov iderName' Column Hea der does n ot exist!" , provider NameColumn Element); | |
| 290 | ||
| 291 | divC olumnEleme nt = provi derNameCol umnElement .findEleme nt(By.tagN ame("div") ); | |
| 292 | asse rtNotNull( "The 'prov iderName' Column Hea der does n ot have a 'div' elem ent!", div ColumnElem ent); | |
| 293 | asse rtEquals(" Provider", divColumn Element.ge tText()); | |
| 294 | ||
| 295 | WebE lement dis approvedBy ColumnElem ent = data TableEleme nt.findEle ment(By.id ("disappro vedBy")); | |
| 296 | asse rtNotNull( "The 'disa pprovedBy' Column He ader does not exist! ", disappr ovedByColu mnElement) ; | |
| 297 | ||
| 298 | divC olumnEleme nt = disap provedByCo lumnElemen t.findElem ent(By.tag Name("div" )); | |
| 299 | asse rtNotNull( "The 'disa pprovedBy' Column He ader does not have a 'div' ele ment!", di vColumnEle ment); | |
| 300 | asse rtEquals(" Disapprove d By", div ColumnElem ent.getTex t()); | |
| 301 | ||
| 302 | WebE lement dis approvedDa teColumnEl ement = da taTableEle ment.findE lement(By. id("disapp rovedDate" )); | |
| 303 | asse rtNotNull( "The 'disa pprovedDat e' Column Header doe s not exis t!", disap provedDate ColumnElem ent); | |
| 304 | ||
| 305 | divC olumnEleme nt = disap provedDate ColumnElem ent.findEl ement(By.t agName("di v")); | |
| 306 | asse rtNotNull( "The 'disa pprovedDat e' Column Header doe s not have a 'div' e lement!", divColumnE lement); | |
| 307 | asse rtEquals(" Disapprova l Date", d ivColumnEl ement.getT ext()); | |
| 308 | ||
| 309 | WebE lement rea sonColumnE lement = d ataTableEl ement.find Element(By .id("reaso n")); | |
| 310 | asse rtNotNull( "The 'reas on' Column Header do es not exi st!", reas onColumnEl ement); | |
| 311 | ||
| 312 | divC olumnEleme nt = reaso nColumnEle ment.findE lement(By. tagName("d iv")); | |
| 313 | asse rtNotNull( "The 'reas on' Column Header do es not hav e a 'div' element!", divColumn Element); | |
| 314 | asse rtEquals(" Reason", d ivColumnEl ement.getT ext()); | |
| 315 | ||
| 316 | WebE lement exp lanationCo lumnElemen t = dataTa bleElement .findEleme nt(By.id(" explanatio n")); | |
| 317 | asse rtNotNull( "The 'expl anation' C olumn Head er does no t exist!", explanati onColumnEl ement); | |
| 318 | ||
| 319 | divC olumnEleme nt = expla nationColu mnElement. findElemen t(By.tagNa me("div")) ; | |
| 320 | asse rtNotNull( "The 'expl anation' C olumn Head er does no t have a ' div' eleme nt!", divC olumnEleme nt); | |
| 321 | asse rtEquals(" Explanatio n", divCol umnElement .getText() ); | |
| 322 | ||
| 323 | WebE lement com mentsColum nElement = dataTable Element.fi ndElement( By.id("com ments")); | |
| 324 | asse rtNotNull( "The 'comm ents' Colu mn Header does not e xist!", co mmentsColu mnElement) ; | |
| 325 | ||
| 326 | divC olumnEleme nt = comme ntsColumnE lement.fin dElement(B y.tagName( "div")); | |
| 327 | asse rtNotNull( "The 'comm ents' Colu mn Header does not h ave a 'div ' element! ", divColu mnElement) ; | |
| 328 | asse rtEquals(" Comments", divColumn Element.ge tText()); | |
| 329 | ||
| 330 | WebE lement his toryColumn Element = dataTableE lement.fin dElement(B y.id("hist ory")); | |
| 331 | asse rtNotNull( "The 'hist ory' Colum n Header d oes not ex ist!", com mentsColum nElement); | |
| 332 | ||
| 333 | divC olumnEleme nt = histo ryColumnEl ement.find Element(By .tagName(" div")); | |
| 334 | asse rtNotNull( "The 'hist ory' Colum n Header d oes not ha ve a 'div' element!" , divColum nElement); | |
| 335 | asse rtEquals(" History", divColumnE lement.get Text()); | |
| 336 | ||
| 337 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_3_I fRejectedC laimsTable Exists_Ver ifyColumns ExistAndNa mesAreCorr ect()"); | |
| 338 | } | |
| 339 | ||
| 340 | @T est | |
| 341 | pu blic void test_4_IfR ejectedCla imsTableEx ists_Verif yCorrectPa geSizeInit ialValueAn dLabelStri ng() throw s Exceptio n { | |
| 342 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_4 _IfRejecte dClaimsTab leExists_V erifyCorre ctPageSize InitialVal ueAndLabel String()") ; | |
| 343 | ||
| 344 | driv er.get(rej ectClaimsP ageUrl); | |
| 345 | Thre ad.sleep(4 000); | |
| 346 | ||
| 347 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 348 | asse rtNotNull( pageTitleE lement); | |
| 349 | ||
| 350 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 351 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 352 | ||
| 353 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 354 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 355 | ||
| 356 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 357 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 358 | ||
| 359 | WebE lement tab leComponen tElement = null; | |
| 360 | try { | |
| 361 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 362 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 363 | if ( tableCompo nentElemen t == null) { | |
| 364 | return ; | |
| 365 | } | |
| 366 | ||
| 367 | // M ake sure t here are t wo "Page S ize" label s... | |
| 368 | int numberOfPa geSizeLabe ls = 0; | |
| 369 | List <WebElemen t> labelEl ementsList = tableCo mponentEle ment.findE lements(By .tagName(" label")); | |
| 370 | asse rtNotNull( "No 'label ' elements found!", labelEleme ntsList); | |
| 371 | for (int i = 0 ; i < labe lElementsL ist.size() ; i++) { | |
| 372 | WebEle ment label Element = labelEleme ntsList.ge t(i); | |
| 373 | if ("P age Size". equals(lab elElement. getText()) ) { | |
| 374 | numberOf PageSizeLa bels++; | |
| 375 | } | |
| 376 | } | |
| 377 | asse rtEquals(" Incorrect number of 'Page Size ' labels!" , 2, numbe rOfPageSiz eLabels); | |
| 378 | ||
| 379 | // M ake sure t here are t wo "Page S ize" Selec t elements with thei r proper i nitial val ue... | |
| 380 | List <WebElemen t> pageSiz eSelectEle mentsList = tableCom ponentElem ent.findEl ements(By. tagName("s elect")); | |
| 381 | asse rtNotNull( "No 'selec t' element s found!", pageSizeS electEleme ntsList); | |
| 382 | asse rtEquals(" Incorrect number of 'select' e lements!", 2, pageSi zeSelectEl ementsList .size()); | |
| 383 | for (int i = 0 ; i < page SizeSelect ElementsLi st.size(); i++) { | |
| 384 | WebEle ment pageS izeSelectE lement = p ageSizeSel ectElement sList.get( i); | |
| 385 | assert Equals("In correct In itial Page Size Valu e!", "10", pageSizeS electEleme nt.getAttr ibute("ng- reflect-mo del")); | |
| 386 | } | |
| 387 | ||
| 388 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_4_I fRejectedC laimsTable Exists_Ver ifyCorrect PageSizeIn itialValue AndLabelSt ring()"); | |
| 389 | } | |
| 390 | ||
| 391 | @T est | |
| 392 | pu blic void test_5_IfR ejectedCla imsTableEx ists_Verif yCorrectNu mberOfResu ltsAndTabl eRows() th rows Excep tion { | |
| 393 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_5 _IfRejecte dClaimsTab leExists_V erifyCorre ctNumberOf ResultsAnd TableRows( )"); | |
| 394 | ||
| 395 | driv er.get(rej ectClaimsP ageUrl); | |
| 396 | Thre ad.sleep(4 000); | |
| 397 | ||
| 398 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 399 | asse rtNotNull( pageTitleE lement); | |
| 400 | ||
| 401 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 402 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 403 | ||
| 404 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 405 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 406 | ||
| 407 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 408 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 409 | ||
| 410 | WebE lement tab leComponen tElement = null; | |
| 411 | try { | |
| 412 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 413 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 414 | if ( tableCompo nentElemen t == null) { | |
| 415 | return ; | |
| 416 | } | |
| 417 | ||
| 418 | // N ote: Initi al Page Si ze of Tabl e will be equal to " 10". | |
| 419 | int initialPag eSizeOfTab le = 10; | |
| 420 | ||
| 421 | WebE lement num berOfResul tsTopEleme nt = table ComponentE lement.fin dElement(B y.id("numR esultsTop" )); | |
| 422 | asse rtNotNull( "No 'numRe sultsTop' element pr esent!", n umberOfRes ultsTopEle ment); | |
| 423 | Stri ng numberO fResultsTo pElementTe xt = numbe rOfResults TopElement .getText() ; | |
| 424 | asse rtEquals(" Incorrect text strin g value fo r 'numResu ltsTop' el ement!", " Number of Results: " , numberOf ResultsTop ElementTex t.substrin g(0, "Numb er of resu lts: ".len gth())); | |
| 425 | ||
| 426 | Stri ng numberO fResultsTo pInteger = numberOfR esultsTopE lementText .substring (numberOfR esultsTopE lementText .substring (0, "Numbe r of resul ts: ".leng th()).leng th()); | |
| 427 | int numberOfRe sultsTopIn t = Intege r.parseInt (numberOfR esultsTopI nteger); | |
| 428 | ||
| 429 | WebE lement num berOfResul tsBottomEl ement = ta bleCompone ntElement. findElemen t(By.id("n umResultsB ottom")); | |
| 430 | asse rtNotNull( "No 'numRe sultsBotto m' element present!" , numberOf ResultsBot tomElement ); | |
| 431 | Stri ng numberO fResultsBo ttomElemen tText = nu mberOfResu ltsBottomE lement.get Text(); | |
| 432 | asse rtEquals(" Incorrect text strin g value fo r 'numResu ltsBottom' element!" , "Number of Results : ", numbe rOfResults BottomElem entText.su bstring(0, "Number o f results: ".length( ))); | |
| 433 | ||
| 434 | Stri ng numberO fResultsBo ttomIntege r = number OfResultsB ottomEleme ntText.sub string(num berOfResul tsBottomEl ementText. substring( 0, "Number of result s: ".lengt h()).lengt h()); | |
| 435 | int numberOfRe sultsBotto mInt = Int eger.parse Int(number OfResultsB ottomInteg er); | |
| 436 | ||
| 437 | asse rtEquals(" 'Number of Results' text shoul d be the s ameo for b oth the to p and bott om 'Number of Result s'!", numb erOfResult sTopElemen tText, num berOfResul tsBottomEl ementText) ; | |
| 438 | asse rtEquals(" 'Number of Results' integer va lue should be the sa me for bot h the top and bottom 'Number o f Results' !", number OfResultsT opInt, num berOfResul tsBottomIn t); | |
| 439 | ||
| 440 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 441 | asse rtNotNull( "The 'data table' ele ment insid e of the ' table' ele ment does not exist! ", dataTab leElement) ; | |
| 442 | ||
| 443 | WebE lement dat aTableBody Element = dataTableE lement.fin dElement(B y.tagName( "tbody")); | |
| 444 | asse rtNotNull( "The 'body ' element inside of the 'datat able' elem ent does n ot exist!" , dataTabl eBodyEleme nt); | |
| 445 | ||
| 446 | List <WebElemen t> tableRo wElementsL ist = data TableBodyE lement.fin dElements( By.tagName ("tr")); | |
| 447 | asse rtNotNull( "No 'tr' e lement ins ide of the 'body' el ement of t he 'table' element!" , tableRow ElementsLi st); | |
| 448 | ||
| 449 | int numberOfRo wsInReject ClaimsTabl e = tableR owElements List.size( ); | |
| 450 | asse rtTrue("Mu st have on e or more rows in th e Reject C laims Tabl e!", numbe rOfRowsInR ejectClaim sTable > 0 ); | |
| 451 | ||
| 452 | if ( numberOfRe sultsTopIn t < initia lPageSizeO fTable) { | |
| 453 | assert Equals("Th e Number o f Rows in the table should equ al the 'Nu mber of Re sults' val ue!'", num berOfResul tsTopInt, numberOfRo wsInReject ClaimsTabl e); | |
| 454 | } el se { | |
| 455 | assert Equals("Th e Number o f Rows in the table should equ al the 'Pa ge Size' v alue!", in itialPageS izeOfTable , numberOf RowsInReje ctClaimsTa ble); | |
| 456 | } | |
| 457 | ||
| 458 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_5_I fRejectedC laimsTable Exists_Ver ifyCorrect NumberOfRe sultsAndTa bleRows()" ); | |
| 459 | } | |
| 460 | ||
| 461 | @T est | |
| 462 | pu blic void test_6_IfR ejectedCla imsTableEx ists_Verif yButtonsEx istAndAreI ntiallyDis abled() th rows Excep tion { | |
| 463 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_6 _IfRejecte dClaimsTab leExists_V erifyButto nsExistAnd AreIntiall yDisabled( )"); | |
| 464 | ||
| 465 | driv er.get(rej ectClaimsP ageUrl); | |
| 466 | Thre ad.sleep(4 000); | |
| 467 | ||
| 468 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 469 | asse rtNotNull( pageTitleE lement); | |
| 470 | ||
| 471 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 472 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 473 | ||
| 474 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 475 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 476 | ||
| 477 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 478 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 479 | ||
| 480 | WebE lement tab leComponen tElement = null; | |
| 481 | try { | |
| 482 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 483 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 484 | if ( tableCompo nentElemen t == null) { | |
| 485 | return ; | |
| 486 | } | |
| 487 | ||
| 488 | WebE lement but tonElement = driver. findElemen t(By.id("u pperOkDisa pprovalBut ton")); | |
| 489 | Stri ng disable dAttribute = buttonE lement.get Attribute( "disabled" ); | |
| 490 | asse rtNotNull( "Upper OK Disapprova l Button s hould be d isabled! N o 'disable d' attribu te present !", disabl edAttribut e); | |
| 491 | Stri ng classAt tribute = buttonElem ent.getAtt ribute("cl ass"); | |
| 492 | asse rtNotNull( "Upper OK Disapprova l Button h as no 'cla ss' attrib ute!", cla ssAttribut e); | |
| 493 | asse rtTrue("Up per OK Dis approval B utton does not conta in 'disabl ed' string !", classA ttribute.c ontains("d isabled")) ; | |
| 494 | ||
| 495 | butt onElement = driver.f indElement (By.id("up perReverse Disapprova lButton")) ; | |
| 496 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 497 | asse rtNotNull( "Upper Rev erse Disap proval But ton should be disabl ed! No 'di sabled' at tribute pr esent!", d isabledAtt ribute); | |
| 498 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 499 | asse rtNotNull( "Upper Rev erse Disap proval But ton has no 'class' a ttribute!" , classAtt ribute); | |
| 500 | asse rtTrue("Up per Revers e Disappro val Button does not contain 'd isabled' s tring!", c lassAttrib ute.contai ns("disabl ed")); | |
| 501 | ||
| 502 | butt onElement = driver.f indElement (By.id("lo werOkDisap provalButt on")); | |
| 503 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 504 | asse rtNotNull( "Lower OK Disapprova l Button s hould be d isabled! N o 'disable d' attribu te present !", disabl edAttribut e); | |
| 505 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 506 | asse rtNotNull( "Lower OK Disapprova l Button h as no 'cla ss' attrib ute!", cla ssAttribut e); | |
| 507 | asse rtTrue("Lo wer OK Dis approval B utton does not conta in 'disabl ed' string !", classA ttribute.c ontains("d isabled")) ; | |
| 508 | ||
| 509 | butt onElement = driver.f indElement (By.id("lo werReverse Disapprova lButton")) ; | |
| 510 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 511 | asse rtNotNull( "Lower Rev erse Disap proval But ton should be disabl ed! No 'di sabled' at tribute pr esent!", d isabledAtt ribute); | |
| 512 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 513 | asse rtNotNull( "Lower Rev erse Disap proval But ton has no 'class' a ttribute!" , classAtt ribute); | |
| 514 | asse rtTrue("Lo wer Revers e Disappro val Button does not contain 'd isabled' s tring!", c lassAttrib ute.contai ns("disabl ed")); | |
| 515 | ||
| 516 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_6_I fRejectedC laimsTable Exists_Ver ifyButtons ExistAndAr eIntiallyD isabled()" ); | |
| 517 | } | |
| 518 | ||
| 519 | @T est | |
| 520 | pu blic void test_7_IfR ejectedCla imsTableEx ists_Click OnSelectCh eckBoxColu mnAndVerif yButtonsEx istAndAreE nabled() t hrows Exce ption { | |
| 521 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_7 _IfRejecte dClaimsTab leExists_C lickOnSele ctCheckBox ColumnAndV erifyButto nsExistAnd AreEnabled ()"); | |
| 522 | ||
| 523 | driv er.get(rej ectClaimsP ageUrl); | |
| 524 | Thre ad.sleep(4 000); | |
| 525 | ||
| 526 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 527 | asse rtNotNull( pageTitleE lement); | |
| 528 | ||
| 529 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 530 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 531 | ||
| 532 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 533 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 534 | ||
| 535 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 536 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 537 | ||
| 538 | WebE lement tab leComponen tElement = null; | |
| 539 | try { | |
| 540 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 541 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 542 | if ( tableCompo nentElemen t == null) { | |
| 543 | return ; | |
| 544 | } | |
| 545 | ||
| 546 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 547 | asse rtNotNull( "The 'data table' ele ment insid e of the ' table' ele ment does not exist! ", dataTab leElement) ; | |
| 548 | ||
| 549 | WebE lement sel ectedColum nElement = dataTable Element.fi ndElement( By.id("sel ected")); | |
| 550 | asse rtNotNull( "The 'sele cted' Colu mn Header does not e xist!", se lectedColu mnElement) ; | |
| 551 | ||
| 552 | WebE lement col umnCheckBo xElement = dataTable Element.fi ndElement( By.name("c olcheckbox ")); | |
| 553 | colu mnCheckBox Element.cl ick(); | |
| 554 | Thre ad.sleep(2 000); | |
| 555 | ||
| 556 | WebE lement but tonElement = driver. findElemen t(By.id("u pperOkDisa pprovalBut ton")); | |
| 557 | Stri ng disable dAttribute = buttonE lement.get Attribute( "disabled" ); | |
| 558 | asse rtNull("Up per OK Dis approval B utton shou ld be enab led! The ' disabled' attribute is present !", disabl edAttribut e); | |
| 559 | Stri ng classAt tribute = buttonElem ent.getAtt ribute("cl ass"); | |
| 560 | asse rtNotNull( "Upper OK Disapprova l Button h as no 'cla ss' attrib ute!", cla ssAttribut e); | |
| 561 | asse rtFalse("U pper OK Di sapproval Button con tains 'dis abled' str ing!", cla ssAttribut e.contains ("disabled ")); | |
| 562 | ||
| 563 | butt onElement = driver.f indElement (By.id("up perReverse Disapprova lButton")) ; | |
| 564 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 565 | asse rtNull("Up per Revers e Disappro val Button should be enabled! The 'disab led' attri bute is pr esent!", d isabledAtt ribute); | |
| 566 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 567 | asse rtNotNull( "Upper Rev erse Disap proval But ton has no 'class' a ttribute!" , classAtt ribute); | |
| 568 | asse rtFalse("U pper Rever se Disappr oval Butto n contains 'disabled ' string!" , classAtt ribute.con tains("dis abled")); | |
| 569 | ||
| 570 | butt onElement = driver.f indElement (By.id("lo werOkDisap provalButt on")); | |
| 571 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 572 | asse rtNull("Lo wer OK Dis approval B utton shou ld be enab led! The ' disabled' attribute is present !", disabl edAttribut e); | |
| 573 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 574 | asse rtNotNull( "Lower OK Disapprova l Button h as no 'cla ss' attrib ute!", cla ssAttribut e); | |
| 575 | asse rtFalse("L ower OK Di sapproval Button con tains 'dis abled' str ing!", cla ssAttribut e.contains ("disabled ")); | |
| 576 | ||
| 577 | butt onElement = driver.f indElement (By.id("lo werReverse Disapprova lButton")) ; | |
| 578 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 579 | asse rtNull("Lo wer Revers e Disappro val Button should be enabled! The 'disab led' attri bute is pr esent!", d isabledAtt ribute); | |
| 580 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 581 | asse rtNotNull( "Lower Rev erse Disap proval But ton has no 'class' a ttribute!" , classAtt ribute); | |
| 582 | asse rtFalse("L ower Rever se Disappr oval Butto n contains 'disabled ' string!" , classAtt ribute.con tains("dis abled")); | |
| 583 | ||
| 584 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_7_I fRejectedC laimsTable Exists_Cli ckOnSelect CheckBoxCo lumnAndVer ifyButtons ExistAndAr eEnabled() "); | |
| 585 | } | |
| 586 | ||
| 587 | @T est | |
| 588 | pu blic void test_8_IfR ejectedCla imsTableEx ists_Click OnSelectCh eckBoxColu mnAndVerif yRowSelect ionBoxesAr eSelected( ) throws E xception { | |
| 589 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_8 _IfRejecte dClaimsTab leExists_C lickOnSele ctCheckBox ColumnAndV erifyRowSe lectionBox esAreSelec ted()"); | |
| 590 | ||
| 591 | driv er.get(rej ectClaimsP ageUrl); | |
| 592 | Thre ad.sleep(4 000); | |
| 593 | ||
| 594 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 595 | asse rtNotNull( pageTitleE lement); | |
| 596 | ||
| 597 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 598 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 599 | ||
| 600 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 601 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 602 | ||
| 603 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 604 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 605 | ||
| 606 | WebE lement tab leComponen tElement = null; | |
| 607 | try { | |
| 608 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 609 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 610 | if ( tableCompo nentElemen t == null) { | |
| 611 | return ; | |
| 612 | } | |
| 613 | ||
| 614 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 615 | asse rtNotNull( "The 'data table' ele ment insid e of the ' table' ele ment does not exist! ", dataTab leElement) ; | |
| 616 | ||
| 617 | WebE lement sel ectedColum nElement = dataTable Element.fi ndElement( By.id("sel ected")); | |
| 618 | asse rtNotNull( "The 'sele cted' Colu mn Header does not e xist!", se lectedColu mnElement) ; | |
| 619 | ||
| 620 | WebE lement col umnCheckBo xElement = selectedC olumnEleme nt.findEle ment(By.na me("colche ckbox")); | |
| 621 | colu mnCheckBox Element.cl ick(); | |
| 622 | Thre ad.sleep(2 000); | |
| 623 | ||
| 624 | WebE lement dat aTableBody Element = dataTableE lement.fin dElement(B y.tagName( "tbody")); | |
| 625 | asse rtNotNull( "The 'body ' element inside of the 'datat able' elem ent does n ot exist!" , dataTabl eBodyEleme nt); | |
| 626 | ||
| 627 | List <WebElemen t> tableRo wElementsL ist = data TableBodyE lement.fin dElements( By.tagName ("tr")); | |
| 628 | asse rtNotNull( "No 'tr' e lement ins ide of the 'body' el ement of t he 'table' element!" , tableRow ElementsLi st); | |
| 629 | ||
| 630 | int numberOfRo wsInReject ClaimsTabl e = tableR owElements List.size( ); | |
| 631 | asse rtTrue("Mu st have on e or more rows in th e Reject C laims Tabl e!", numbe rOfRowsInR ejectClaim sTable > 0 ); | |
| 632 | ||
| 633 | for (int i = 0 ; i < numb erOfRowsIn RejectClai msTable; i ++) { | |
| 634 | WebEle ment table RowElement = tableRo wElementsL ist.get(i) ; | |
| 635 | WebEle ment selec tedTdEleme nt = table RowElement .findEleme nt(By.id(" selected" + i)); | |
| 636 | WebEle ment rowCh eckBoxElem ent = sele ctedTdElem ent.findEl ement(By.n ame("rowch eckbox")); | |
| 637 | ||
| 638 | String ngReflect Model = ro wCheckBoxE lement.get Attribute( "ng-reflec t-model"); | |
| 639 | assert Equals("Se lect Check Box in ro w #" + i + " should be in sele cted/check ed state!" , "true", ngReflectM odel); | |
| 640 | } | |
| 641 | ||
| 642 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_8_I fRejectedC laimsTable Exists_Cli ckOnSelect CheckBoxCo lumnAndVer ifyRowSele ctionBoxes AreSelecte d()"); | |
| 643 | } | |
| 644 | ||
| 645 | @T est | |
| 646 | pu blic void test_9_IfR ejectedCla imsTableEx ists_Click OnSelectCh eckBoxInOn eOfTheRows AndVerifyB uttonsExis tAndAreEna bled() thr ows Except ion { | |
| 647 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: Be gin test_9 _IfRejecte dClaimsTab leExists_C lickOnSele ctCheckBox InOneOfThe RowsAndVer ifyButtons ExistAndAr eEnabled() "); | |
| 648 | ||
| 649 | driv er.get(rej ectClaimsP ageUrl); | |
| 650 | Thre ad.sleep(4 000); | |
| 651 | ||
| 652 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 653 | asse rtNotNull( pageTitleE lement); | |
| 654 | ||
| 655 | asse rtEquals(" Incorrect Page Title for Rejec t Claims P age!", | |
| 656 | "Reject Claims", p ageTitleEl ement.getT ext()); | |
| 657 | ||
| 658 | WebE lement sec tionHeader TitleEleme nt = drive r.findElem ent(By.id( "sectionHe aderTitle" )); | |
| 659 | asse rtNotNull( sectionHea derTitleEl ement); | |
| 660 | ||
| 661 | asse rtEquals(" Incorrect Section He ader Title for Rejec t Claims P age!", | |
| 662 | "Disappr oved Claim s", sectio nHeaderTit leElement. getText()) ; | |
| 663 | ||
| 664 | WebE lement tab leComponen tElement = null; | |
| 665 | try { | |
| 666 | tableC omponentEl ement = dr iver.findE lement(By. id("table" )); | |
| 667 | } ca tch (NoSuc hElementEx ception ex ) { } | |
| 668 | if ( tableCompo nentElemen t == null) { | |
| 669 | return ; | |
| 670 | } | |
| 671 | ||
| 672 | WebE lement dat aTableElem ent = tabl eComponent Element.fi ndElement( By.id("dat atable")); | |
| 673 | asse rtNotNull( "The 'data table' ele ment insid e of the ' table' ele ment does not exist! ", dataTab leElement) ; | |
| 674 | ||
| 675 | WebE lement dat aTableBody Element = dataTableE lement.fin dElement(B y.tagName( "tbody")); | |
| 676 | asse rtNotNull( "The 'body ' element inside of the 'datat able' elem ent does n ot exist!" , dataTabl eBodyEleme nt); | |
| 677 | ||
| 678 | List <WebElemen t> tableRo wElementsL ist = data TableBodyE lement.fin dElements( By.tagName ("tr")); | |
| 679 | asse rtNotNull( "No 'tr' e lement ins ide of the 'body' el ement of t he 'table' element!" , tableRow ElementsLi st); | |
| 680 | ||
| 681 | int numberOfRo wsInReject ClaimsTabl e = tableR owElements List.size( ); | |
| 682 | asse rtTrue("Mu st have on e or more rows in th e Reject C laims Tabl e!", numbe rOfRowsInR ejectClaim sTable > 0 ); | |
| 683 | ||
| 684 | WebE lement tab leRowEleme nt = table RowElement sList.get( 0); | |
| 685 | WebE lement sel ectedTdEle ment = tab leRowEleme nt.findEle ment(By.id ("selected 0")); | |
| 686 | WebE lement row CheckBoxEl ement = se lectedTdEl ement.find Element(By .name("row checkbox") ); | |
| 687 | ||
| 688 | rowC heckBoxEle ment.click (); | |
| 689 | Thre ad.sleep(2 000); | |
| 690 | ||
| 691 | WebE lement but tonElement = driver. findElemen t(By.id("u pperOkDisa pprovalBut ton")); | |
| 692 | Stri ng disable dAttribute = buttonE lement.get Attribute( "disabled" ); | |
| 693 | asse rtNull("Up per OK Dis approval B utton shou ld be enab led! The ' disabled' attribute is present !", disabl edAttribut e); | |
| 694 | Stri ng classAt tribute = buttonElem ent.getAtt ribute("cl ass"); | |
| 695 | asse rtNotNull( "Upper OK Disapprova l Button h as no 'cla ss' attrib ute!", cla ssAttribut e); | |
| 696 | asse rtFalse("U pper OK Di sapproval Button con tains 'dis abled' str ing!", cla ssAttribut e.contains ("disabled ")); | |
| 697 | ||
| 698 | butt onElement = driver.f indElement (By.id("up perReverse Disapprova lButton")) ; | |
| 699 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 700 | asse rtNull("Up per Revers e Disappro val Button should be enabled! The 'disab led' attri bute is pr esent!", d isabledAtt ribute); | |
| 701 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 702 | asse rtNotNull( "Upper Rev erse Disap proval But ton has no 'class' a ttribute!" , classAtt ribute); | |
| 703 | asse rtFalse("U pper Rever se Disappr oval Butto n contains 'disabled ' string!" , classAtt ribute.con tains("dis abled")); | |
| 704 | ||
| 705 | butt onElement = driver.f indElement (By.id("lo werOkDisap provalButt on")); | |
| 706 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 707 | asse rtNull("Lo wer OK Dis approval B utton shou ld be enab led! The ' disabled' attribute is present !", disabl edAttribut e); | |
| 708 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 709 | asse rtNotNull( "Lower OK Disapprova l Button h as no 'cla ss' attrib ute!", cla ssAttribut e); | |
| 710 | asse rtFalse("L ower OK Di sapproval Button con tains 'dis abled' str ing!", cla ssAttribut e.contains ("disabled ")); | |
| 711 | ||
| 712 | butt onElement = driver.f indElement (By.id("lo werReverse Disapprova lButton")) ; | |
| 713 | disa bledAttrib ute = butt onElement. getAttribu te("disabl ed"); | |
| 714 | asse rtNull("Lo wer Revers e Disappro val Button should be enabled! The 'disab led' attri bute is pr esent!", d isabledAtt ribute); | |
| 715 | clas sAttribute = buttonE lement.get Attribute( "class"); | |
| 716 | asse rtNotNull( "Lower Rev erse Disap proval But ton has no 'class' a ttribute!" , classAtt ribute); | |
| 717 | asse rtFalse("L ower Rever se Disappr oval Butto n contains 'disabled ' string!" , classAtt ribute.con tains("dis abled")); | |
| 718 | ||
| 719 | Syst em.out.pri ntln("Reje ctClaimsPa geTest: En d test_9_I fRejectedC laimsTable Exists_Cli ckOnSelect CheckBoxIn OneOfTheRo wsAndVerif yButtonsEx istAndAreE nabled()") ; | |
| 720 | } | |
| 721 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.