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 | StationMaintenanceAddContactInfoTest.java | Fri Dec 8 17:53:04 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\Testing\src\testing | StationMaintenanceAddContactInfoTest.java | Fri Dec 8 19:18:05 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 1106 |
| Changed | 2 | 4 |
| 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 | package te sting; | |
| 2 | ||
| 3 | import sta tic org.ju nit.Assert .*; | |
| 4 | ||
| 5 | import jav a.io.File; | |
| 6 | import jav a.util.Lis t; | |
| 7 | import jav a.util.con current.Ti meUnit; | |
| 8 | ||
| 9 | import org .junit.Aft er; | |
| 10 | import org .junit.Aft erClass; | |
| 11 | import org .junit.Bef ore; | |
| 12 | import org .junit.Bef oreClass; | |
| 13 | import org .junit.Fix MethodOrde r; | |
| 14 | import org .junit.run ners.Metho dSorters; | |
| 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.By; | |
| 20 | import org .openqa.se lenium.Key s; | |
| 21 | import org .openqa.se lenium.NoS uchElement Exception; | |
| 22 | import org .openqa.se lenium.Web Driver; | |
| 23 | import org .openqa.se lenium.Web Element; | |
| 24 | import org .openqa.se lenium.ie. InternetEx plorerDriv er; | |
| 25 | import org .openqa.se lenium.sup port.ui.Se lect; | |
| 26 | ||
| 27 | /** | |
| 28 | * @author DN S PEREZF | |
| 29 | * | |
| 30 | */ | |
| 31 | @FixMethod Order(Meth odSorters. NAME_ASCEN DING) | |
| 32 | public cla ss Station Maintenanc eAddContac tInfoTest { | |
| 33 | ||
| 34 | pr ivate WebD river driv er; | |
| 35 | pr ivate Stri ng baseUrl ; | |
| 36 | pr ivate Stri ng searchS tationPage Url; | |
| 37 | ||
| 38 | pu blic stati c void mai n(String a rgs[]) { | |
| 39 | JUni tCore juni t = new JU nitCore(); | |
| 40 | juni t.addListe ner(new Te xtListener (System.ou t)); | |
| 41 | Resu lt result = junit.ru n(StationM aintenance AddContact InfoTest.c lass); // Replace "S ampleTest" with the name of yo ur class | |
| 42 | if ( result.get FailureCou nt() > 0) { | |
| 43 | System.out .println(" Test faile d.\n" + re sult); | |
| 44 | System.exi t(1); | |
| 45 | } el se { | |
| 46 | System.out .println(" Test finis hed succes sfully."); | |
| 47 | System.exi t(0); | |
| 48 | } | |
| 49 | } | |
| 50 | ||
| 51 | /* * | |
| 52 | * @throws j ava.lang.E xception | |
| 53 | * / | |
| 54 | @B eforeClass | |
| 55 | pu blic stati c void set UpBeforeCl ass() thro ws Excepti on { | |
| 56 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin setUpBefor eClass()") ; | |
| 57 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End se tUpBeforeC lass()"); | |
| 58 | } | |
| 59 | ||
| 60 | /* * | |
| 61 | * @throws j ava.lang.E xception | |
| 62 | * / | |
| 63 | @A fterClass | |
| 64 | pu blic stati c void tea rDownAfter Class() th rows Excep tion { | |
| 65 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin tearDownAf terClass() "); | |
| 66 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te arDownAfte rClass()") ; | |
| 67 | } | |
| 68 | ||
| 69 | /* * | |
| 70 | * @throws j ava.lang.E xception | |
| 71 | * / | |
| 72 | @B efore | |
| 73 | pu blic void setUp() th rows Excep tion { | |
| 74 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin setUp()"); | |
| 75 | ||
| 76 | File file = ne w File("dr ivers/IEDr iverServer .exe"); | |
| 77 | Syst em.setProp erty("webd river.ie.d river", fi le.getAbso lutePath() ); | |
| 78 | driv er = new I nternetExp lorerDrive r(); | |
| 79 | ||
| 80 | // baseUrl = "http:/ / SERVER : PORT /"; | |
| 81 | base Url = "htt p://localh ost:3000/" ; | |
| 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 | // G o to the S earch Stat ion Page. | |
| 89 | sear chStationP ageUrl = b aseUrl + " searchStat ion"; | |
| 90 | driv er.get(sea rchStation PageUrl); | |
| 91 | Thre ad.sleep(5 000); | |
| 92 | ||
| 93 | // V erify that it is the Search St ation Page . | |
| 94 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 95 | asse rtNotNull( pageTitleE lement); | |
| 96 | asse rtEquals(" Incorrect Page Title for Searc h Station Page!", | |
| 97 | "Station Maintenan ce | Sea rch Statio ns", pageT itleElemen t.getText( )); | |
| 98 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Verifi ed we are in the Sea rch Statio n Page!"); | |
| 99 | ||
| 100 | // G et access to the Mod ify button of intere st... | |
| 101 | WebE lement dat aTableElem ent = driv er.findEle ment(By.id ("datatabl e")); | |
| 102 | asse rtNotNull( dataTableE lement); | |
| 103 | WebE lement mod ifyTdEleme nt = dataT ableElemen t.findElem ent(By.id( "edit2")); | |
| 104 | asse rtNotNull( modifyTdEl ement); | |
| 105 | WebE lement mod ifyButtonE lement = m odifyTdEle ment.findE lement(By. tagName("b utton")); | |
| 106 | asse rtNotNull( modifyButt onElement) ; | |
| 107 | ||
| 108 | // C lick on th e Modify B utton | |
| 109 | modi fyButtonEl ement.clic k(); | |
| 110 | // m odifyButto nElement.s endKeys(Ke ys.ENTER); | |
| 111 | Thre ad.sleep(5 000); | |
| 112 | ||
| 113 | // V erify that we are no w in the " Station Ma intenance | Edit" Pa ge. | |
| 114 | page TitleEleme nt = drive r.findElem ent(By.id( "pageTitle ")); | |
| 115 | asse rtNotNull( pageTitleE lement); | |
| 116 | asse rtEquals(" Incorrect Page Title for Stati on Mainten ance Edit Page!", | |
| 117 | "Station Maintenan ce | Edi t", pageTi tleElement .getText() ); | |
| 118 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Verifi ed we are in the Sta tion Maint enance Edi t Page!"); | |
| 119 | ||
| 120 | // C lick on th e Contact Info Tab E lement | |
| 121 | WebE lement con tactInfoTa bElement = driver.fi ndElement( By.id("tab 1")); | |
| 122 | cont actInfoTab Element.cl ick(); | |
| 123 | Thre ad.sleep(2 000); | |
| 124 | WebE lement add ContactInf oElement = driver.fi ndElement( By.id("add ContactInf o")); | |
| 125 | addC ontactInfo Element.cl ick(); | |
| 126 | Thre ad.sleep(5 000); | |
| 127 | ||
| 128 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End se tUp()"); | |
| 129 | } | |
| 130 | ||
| 131 | pr ivate void clickSetA ctiveButto n() throws Exception { | |
| 132 | WebE lement set ActiveButt on = drive r.findElem ent(By.id( "setActive ")); | |
| 133 | asse rtNotNull( setActiveB utton); | |
| 134 | setA ctiveButto n.click(); | |
| 135 | // s etActiveBu tton.submi t(); // No t inside o f a "form" element. | |
| 136 | setA ctiveButto n.sendKeys (Keys.ENTE R); | |
| 137 | Thre ad.sleep(3 000); | |
| 138 | } | |
| 139 | ||
| 140 | pr ivate void goToLogin PageAndCli ckLoginBut ton() thro ws Excepti on { | |
| 141 | driv er.get(bas eUrl); | |
| 142 | WebE lement log inButton = driver.fi ndElement( By.id("log inAdminBtn ")); | |
| 143 | asse rtNotNull( loginButto n); | |
| 144 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Login Button exi sts!"); | |
| 145 | ||
| 146 | // S elect the ADMIN Role . | |
| 147 | Sele ct roleSel ectBox = n ew Select( driver.fin dElement(B y.id("sele ctRole2")) ); | |
| 148 | asse rtNotNull( roleSelect Box); | |
| 149 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Role S elect Box exists!"); | |
| 150 | role SelectBox. selectByVi sibleText( "ADMIN"); | |
| 151 | Thre ad.sleep(2 000); | |
| 152 | ||
| 153 | // C lick the L ogin Butto n. Had to do this as advised b y Joshua L one | |
| 154 | // t o get this to work t o forward to next pa ge. | |
| 155 | logi nButton.cl ick(); | |
| 156 | logi nButton.su bmit(); | |
| 157 | logi nButton.se ndKeys(Key s.ENTER); | |
| 158 | } | |
| 159 | ||
| 160 | /* * | |
| 161 | * @throws j ava.lang.E xception | |
| 162 | * / | |
| 163 | @A fter | |
| 164 | pu blic void tearDown() throws Ex ception { | |
| 165 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin tearDown() "); | |
| 166 | ||
| 167 | Thre ad.sleep(5 000); | |
| 168 | driv er.close() ; | |
| 169 | driv er.quit(); | |
| 170 | Thre ad.sleep(5 000); | |
| 171 | Syst em.out.pri ntln("End Executing 'tearDown' method"); | |
| 172 | ||
| 173 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te arDown()") ; | |
| 174 | } | |
| 175 | ||
| 176 | @T est | |
| 177 | pu blic void test_1_Ver ify_Statio nMaintenan ceAddConta ctInfoPage _Appears() throws Ex ception { | |
| 178 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_1_Ver ify_Statio nMaintenan ceAddConta ctInfoPage _Appears() "); | |
| 179 | ||
| 180 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 181 | asse rtNotNull( pageTitleE lement); | |
| 182 | ||
| 183 | asse rtEquals(" Incorrect Page Title for Stati on Mainten ance Add C ontact Inf o Page!", | |
| 184 | "Station Maintenan ce | Add Contact I nfo", page TitleEleme nt.getText ()); | |
| 185 | ||
| 186 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_1_Verif y_StationM aintenance AddContact InfoPage_A ppears()") ; | |
| 187 | } | |
| 188 | ||
| 189 | @T est | |
| 190 | pu blic void test_2_Ver ifyContact NameTextFi eldExists( ) { | |
| 191 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_2_Ver ifyContact NameTextFi eldExists( )"); | |
| 192 | ||
| 193 | WebE lement con tactNameTe xtElement = driver.f indElement (By.id("co ntactName" )); | |
| 194 | asse rtNotNull( contactNam eTextEleme nt); | |
| 195 | ||
| 196 | Stri ng contact NameTextEl ementTagNa me = conta ctNameText Element.ge tTagName() ; | |
| 197 | asse rtNotNull( contactNam eTextEleme ntTagName) ; | |
| 198 | asse rtEquals(" Incorrect Tag Name f or the Con tact Name Text Eleme nt!", | |
| 199 | "input", contactNa meTextElem entTagName ); | |
| 200 | ||
| 201 | Stri ng contact NameTextEl ementTypeA ttributeSt r = contac tNameTextE lement.get Attribute( "type"); | |
| 202 | asse rtNotNull( contactNam eTextEleme ntTypeAttr ibuteStr); | |
| 203 | asse rtEquals(" Incorrect Type for t he Contact Name Text Element!" , | |
| 204 | "text", contactNam eTextEleme ntTypeAttr ibuteStr); | |
| 205 | ||
| 206 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_2_Verif yContactNa meTextFiel dExists()" ); | |
| 207 | } | |
| 208 | ||
| 209 | @T est | |
| 210 | pu blic void test_3_Ver ifyAddress LineOneTex tFieldExis ts() { | |
| 211 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_3_Ver ifyAddress LineOneTex tFieldExis ts()"); | |
| 212 | ||
| 213 | WebE lement add ressLineOn eTextEleme nt = drive r.findElem ent(By.id( "addressLi neOne")); | |
| 214 | asse rtNotNull( addressLin eOneTextEl ement); | |
| 215 | ||
| 216 | Stri ng address LineOneTex tElementTa gName = ad dressLineO neTextElem ent.getTag Name(); | |
| 217 | asse rtNotNull( addressLin eOneTextEl ementTagNa me); | |
| 218 | asse rtEquals(" Incorrect Tag Name f or the Add ress Line 1 Text Ele ment!", | |
| 219 | "input", addressLi neOneTextE lementTagN ame); | |
| 220 | ||
| 221 | Stri ng address LineOneTex tElementTy peAttribut eStr = add ressLineOn eTextEleme nt.getAttr ibute("typ e"); | |
| 222 | asse rtNotNull( addressLin eOneTextEl ementTypeA ttributeSt r); | |
| 223 | asse rtEquals(" Incorrect Type for t he Address Line 1 Te xt Element !", | |
| 224 | "text", addressLin eOneTextEl ementTypeA ttributeSt r); | |
| 225 | ||
| 226 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_3_Verif yAddressLi neOneTextF ieldExists ()"); | |
| 227 | } | |
| 228 | ||
| 229 | @T est | |
| 230 | pu blic void test_4_Ver ifyAddress LineTwoTex tFieldExis ts() { | |
| 231 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_4_Ver ifyAddress LineTwoTex tFieldExis ts()"); | |
| 232 | ||
| 233 | WebE lement add ressLineTw oTextEleme nt = drive r.findElem ent(By.id( "addressLi neTwo")); | |
| 234 | asse rtNotNull( addressLin eTwoTextEl ement); | |
| 235 | ||
| 236 | Stri ng address LineTwoTex tElementTa gName = ad dressLineT woTextElem ent.getTag Name(); | |
| 237 | asse rtNotNull( addressLin eTwoTextEl ementTagNa me); | |
| 238 | asse rtEquals(" Incorrect Tag Name f or the Add ress Line 2 Text Ele ment!", | |
| 239 | "input", addressLi neTwoTextE lementTagN ame); | |
| 240 | ||
| 241 | Stri ng address LineTwoTex tElementTy peAttribut eStr = add ressLineTw oTextEleme nt.getAttr ibute("typ e"); | |
| 242 | asse rtNotNull( addressLin eTwoTextEl ementTypeA ttributeSt r); | |
| 243 | asse rtEquals(" Incorrect Type for t he Address Line 2 Te xt Element !", | |
| 244 | "text", addressLin eTwoTextEl ementTypeA ttributeSt r); | |
| 245 | ||
| 246 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_4_Verif yAddressLi neTwoTextF ieldExists ()"); | |
| 247 | } | |
| 248 | ||
| 249 | @T est | |
| 250 | pu blic void test_5_Ver ifyCityTex tFieldExis ts() { | |
| 251 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_5_Ver ifyCityTex tFieldExis ts()"); | |
| 252 | ||
| 253 | WebE lement cit yTextEleme nt = drive r.findElem ent(By.id( "city")); | |
| 254 | asse rtNotNull( cityTextEl ement); | |
| 255 | ||
| 256 | Stri ng cityTex tElementTa gName = ci tyTextElem ent.getTag Name(); | |
| 257 | asse rtNotNull( cityTextEl ementTagNa me); | |
| 258 | asse rtEquals(" Incorrect Tag Name f or the Cit y Text Ele ment!", | |
| 259 | "input", cityTextE lementTagN ame); | |
| 260 | ||
| 261 | Stri ng cityTex tElementTy peAttribut eStr = cit yTextEleme nt.getAttr ibute("typ e"); | |
| 262 | asse rtNotNull( cityTextEl ementTypeA ttributeSt r); | |
| 263 | asse rtEquals(" Incorrect Type for t he City Te xt Element !", | |
| 264 | "text", cityTextEl ementTypeA ttributeSt r); | |
| 265 | ||
| 266 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_5_Verif yCityTextF ieldExists ()"); | |
| 267 | } | |
| 268 | ||
| 269 | @T est | |
| 270 | pu blic void test_6_Ver ifyZipText FieldExist s() { | |
| 271 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_6_Ver ifyZipText FieldExist s()"); | |
| 272 | ||
| 273 | WebE lement zip CodeTextEl ement = dr iver.findE lement(By. id("zipCod e")); | |
| 274 | asse rtNotNull( zipCodeTex tElement); | |
| 275 | ||
| 276 | Stri ng zipCode TextElemen tTagName = zipCodeTe xtElement. getTagName (); | |
| 277 | asse rtNotNull( zipCodeTex tElementTa gName); | |
| 278 | asse rtEquals(" Incorrect Tag Name f or the Zip Text Elem ent!", | |
| 279 | "input", zipCodeTe xtElementT agName); | |
| 280 | ||
| 281 | Stri ng zipCode TextElemen tTypeAttri buteStr = zipCodeTex tElement.g etAttribut e("type"); | |
| 282 | asse rtNotNull( zipCodeTex tElementTy peAttribut eStr); | |
| 283 | asse rtEquals(" Incorrect Type for t he Zip Tex t Element! ", | |
| 284 | "text", zipCodeTex tElementTy peAttribut eStr); | |
| 285 | ||
| 286 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_6_Verif yZipTextFi eldExists( )"); | |
| 287 | } | |
| 288 | ||
| 289 | @T est | |
| 290 | pu blic void test_7_Ver ifyEmailTe xtFieldExi sts() { | |
| 291 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_7_Ver ifyEmailTe xtFieldExi sts()"); | |
| 292 | ||
| 293 | WebE lement ema ilTextElem ent = driv er.findEle ment(By.id ("email")) ; | |
| 294 | asse rtNotNull( emailTextE lement); | |
| 295 | ||
| 296 | Stri ng emailTe xtElementT agName = e mailTextEl ement.getT agName(); | |
| 297 | asse rtNotNull( emailTextE lementTagN ame); | |
| 298 | asse rtEquals(" Incorrect Tag Name f or the Ema il Text El ement!", | |
| 299 | "input", emailText ElementTag Name); | |
| 300 | ||
| 301 | Stri ng emailTe xtElementT ypeAttribu teStr = em ailTextEle ment.getAt tribute("t ype"); | |
| 302 | asse rtNotNull( emailTextE lementType AttributeS tr); | |
| 303 | asse rtEquals(" Incorrect Type for t he Zip Tex t Element! ", | |
| 304 | "text", emailTextE lementType AttributeS tr); | |
| 305 | ||
| 306 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_7_Verif yEmailText FieldExist s()"); | |
| 307 | } | |
| 308 | ||
| 309 | @T est | |
| 310 | pu blic void test_8_Ver ifyFaxText FieldExist s() { | |
| 311 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_8_Ver ifyFaxText FieldExist s()"); | |
| 312 | ||
| 313 | WebE lement fax TextElemen t = driver .findEleme nt(By.id(" fax")); | |
| 314 | asse rtNotNull( faxTextEle ment); | |
| 315 | ||
| 316 | Stri ng faxText ElementTag Name = fax TextElemen t.getTagNa me(); | |
| 317 | asse rtNotNull( faxTextEle mentTagNam e); | |
| 318 | asse rtEquals(" Incorrect Tag Name f or the Fax Text Elem ent!", | |
| 319 | "input", faxTextEl ementTagNa me); | |
| 320 | ||
| 321 | Stri ng faxText ElementTyp eAttribute Str = faxT extElement .getAttrib ute("type" ); | |
| 322 | asse rtNotNull( faxTextEle mentTypeAt tributeStr ); | |
| 323 | asse rtEquals(" Incorrect Type for t he Fax Tex t Element! ", | |
| 324 | "text", faxTextEle mentTypeAt tributeStr ); | |
| 325 | ||
| 326 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_8_Verif yFaxTextFi eldExists( )"); | |
| 327 | } | |
| 328 | ||
| 329 | @T est | |
| 330 | pu blic void test_9_Ver ifyPhoneTe xtFieldExi sts() { | |
| 331 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_9_Ver ifyPhoneTe xtFieldExi sts()"); | |
| 332 | ||
| 333 | WebE lement pho neTextElem ent = driv er.findEle ment(By.id ("phone")) ; | |
| 334 | asse rtNotNull( phoneTextE lement); | |
| 335 | ||
| 336 | Stri ng phoneTe xtElementT agName = p honeTextEl ement.getT agName(); | |
| 337 | asse rtNotNull( phoneTextE lementTagN ame); | |
| 338 | asse rtEquals(" Incorrect Tag Name f or the Pho ne Text El ement!", | |
| 339 | "input", phoneText ElementTag Name); | |
| 340 | ||
| 341 | Stri ng phoneTe xtElementT ypeAttribu teStr = ph oneTextEle ment.getAt tribute("t ype"); | |
| 342 | asse rtNotNull( phoneTextE lementType AttributeS tr); | |
| 343 | asse rtEquals(" Incorrect Type for t he Phone T ext Elemen t!", | |
| 344 | "text", phoneTextE lementType AttributeS tr); | |
| 345 | ||
| 346 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_9_Verif yPhoneText FieldExist s()"); | |
| 347 | } | |
| 348 | ||
| 349 | @T est | |
| 350 | pu blic void test_10_Ve rifyContac tTypeTextF ieldExists _And_IsMan datory() t hrows Exce ption { | |
| 351 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_10_Ve rifyContac tTypeTextF ieldExists _And_IsMan datory()") ; | |
| 352 | ||
| 353 | WebE lement con tactTypeTe xtFieldEle ment = dri ver.findEl ement(By.i d("contact Type")); | |
| 354 | asse rtNotNull( contactTyp eTextField Element); | |
| 355 | ||
| 356 | Stri ng require dAttribute Str = cont actTypeTex tFieldElem ent.getAtt ribute("re quired"); | |
| 357 | asse rtNotNull( requiredAt tributeStr ); | |
| 358 | ||
| 359 | Stri ng contact TypeElemen tTagName = contactTy peTextFiel dElement.g etTagName( ); | |
| 360 | asse rtNotNull( contactTyp eElementTa gName); | |
| 361 | asse rtEquals(" Incorrect Tag Name f or the Con tact Type Text Field Element!" , | |
| 362 | "input", contactTy peElementT agName); | |
| 363 | ||
| 364 | Stri ng contact TypeTextEl ementTypeA ttributeSt r = contac tTypeTextF ieldElemen t.getAttri bute("type "); | |
| 365 | asse rtNotNull( contactTyp eTextEleme ntTypeAttr ibuteStr); | |
| 366 | asse rtEquals(" Incorrect Type for t he Contact Type Text Field Ele ment!", | |
| 367 | "text", contactTyp eTextEleme ntTypeAttr ibuteStr); | |
| 368 | ||
| 369 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_10_Veri fyContactT ypeTextFie ldExists_A nd_IsManda tory()"); | |
| 370 | } | |
| 371 | ||
| 372 | // Franklin Perez (11/ 6/2017): C ontact Typ e no longe r a Select Box. | |
| 373 | /* | |
| 374 | @T est | |
| 375 | pu blic void test_11_Ve rifyContac tTypeSelec tField_Can ChangeValu es() throw s Exceptio n { | |
| 376 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_11_Ve rifyContac tTypeSelec tField_Can ChangeValu es()"); | |
| 377 | ||
| 378 | Sele ct contact TypeSelect Box = new Select(dri ver.findEl ement(By.i d("contact Type"))); | |
| 379 | asse rtNotNull( contactTyp eSelectBox ); | |
| 380 | ||
| 381 | List <WebElemen t> contact TypeSelect edOptionEl ements = c ontactType SelectBox. getAllSele ctedOption s(); | |
| 382 | asse rtEquals(" Contact Ty pe Select Box should have only one selec ted value! ", 1, cont actTypeSel ectedOptio nElements. size()); | |
| 383 | asse rtEquals(" Contact Ty pe Inital Value is i ncorrect!" , "OMNH - OUTPATIENT CLINIC/NU RSING HOME ", contact TypeSelect edOptionEl ements.get (0).getTex t()); | |
| 384 | ||
| 385 | cont actTypeSel ectBox.sel ectByValue ("CEM"); | |
| 386 | Thre ad.sleep(1 000); | |
| 387 | ||
| 388 | cont actTypeSel ectedOptio nElements = contactT ypeSelectB ox.getAllS electedOpt ions(); | |
| 389 | asse rtEquals(" Contact Ty pe Select Box should have only one selec ted value! ", 1, cont actTypeSel ectedOptio nElements. size()); | |
| 390 | asse rtEquals(" Contact Ty pe Set Val ue is inco rrect!", " CEM - CEME TERY", con tactTypeSe lectedOpti onElements .get(0).ge tText()); | |
| 391 | ||
| 392 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_11_Veri fyContactT ypeSelectF ield_CanCh angeValues ()"); | |
| 393 | } | |
| 394 | */ | |
| 395 | ||
| 396 | @T est | |
| 397 | pu blic void test_12_Ve rify_Cance lButtonExi sts() thro ws Excepti on { | |
| 398 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_12_Ve rify_Cance lButtonExi sts()"); | |
| 399 | ||
| 400 | WebE lement can celButtonE lement = d river.find Element(By .id("cance l")); | |
| 401 | asse rtNotNull( cancelButt onElement) ; | |
| 402 | ||
| 403 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_12_Veri fy_CancelB uttonExist s()"); | |
| 404 | } | |
| 405 | ||
| 406 | @T est | |
| 407 | pu blic void test_13_Ve rify_Cance lButtonCli ck_Forward sBackTo_St ationMaint enanceEdit Page() thr ows Except ion { | |
| 408 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_3_Ver ify_Cancel ButtonClic k_Forwards BackTo_Sta tionMainte nanceEditP age()"); | |
| 409 | ||
| 410 | WebE lement can celButtonE lement = d river.find Element(By .id("cance l")); | |
| 411 | asse rtNotNull( cancelButt onElement) ; | |
| 412 | ||
| 413 | canc elButtonEl ement.clic k(); | |
| 414 | Thre ad.sleep(3 000); | |
| 415 | ||
| 416 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 417 | asse rtNotNull( pageTitleE lement); | |
| 418 | asse rtEquals(" Incorrect Page Title for Stati on Mainten ance Edit Page!", | |
| 419 | "Station Maintenan ce | Edi t", pageTi tleElement .getText() ); | |
| 420 | ||
| 421 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_3_Verif y_CancelBu ttonClick_ ForwardsBa ckTo_Stati onMaintena nceEditPag e()"); | |
| 422 | } | |
| 423 | ||
| 424 | @T est | |
| 425 | pu blic void test_13a_V erify_Save ButtonExis ts_AndIsIn itiallyDis abled() th rows Excep tion { | |
| 426 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_13a_V erify_Save ButtonExis ts_AndIsIn itiallyDis abled()"); | |
| 427 | ||
| 428 | WebE lement sav eButtonEle ment = dri ver.findEl ement(By.i d("save")) ; | |
| 429 | asse rtNotNull( saveButton Element); | |
| 430 | ||
| 431 | Stri ng disable dAttribute Str = save ButtonElem ent.getAtt ribute("di sabled"); | |
| 432 | asse rtNotNull( disabledAt tributeStr ); | |
| 433 | Syst em.out.pri ntln(" d isabledAtt ributeStr = " + disa bledAttrib uteStr); | |
| 434 | ||
| 435 | Stri ng classAt tributeStr = saveBut tonElement .getAttrib ute("class "); | |
| 436 | asse rtNotNull( classAttri buteStr); | |
| 437 | Syst em.out.pri ntln(" c lassAttrib uteStr = " + classAt tributeStr ); | |
| 438 | asse rtTrue("Th e class at tribute va lue on the Save butt on should contain th e disabled string", classAttri buteStr.co ntains("di sabled")); | |
| 439 | ||
| 440 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_13a_Ver ify_SaveBu ttonExists _AndIsInit iallyDisab led()"); | |
| 441 | } | |
| 442 | ||
| 443 | @T est | |
| 444 | pu blic void test_13b_V erify_Save ButtonBeco mesEnabled WhenContac tTypeTextF ieldValueI sEntered() throws Ex ception { | |
| 445 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_13b_V erify_Save ButtonBeco mesEnabled WhenContac tTypeTextF ieldValueI sEntered() "); | |
| 446 | ||
| 447 | WebE lement con tactTypeTe xtElement = driver.f indElement (By.id("co ntactType" )); | |
| 448 | asse rtNotNull( contactTyp eTextEleme nt); | |
| 449 | ||
| 450 | cont actTypeTex tElement.s endKeys("A "); | |
| 451 | ||
| 452 | WebE lement sav eButtonEle ment = dri ver.findEl ement(By.i d("save")) ; | |
| 453 | asse rtNotNull( saveButton Element); | |
| 454 | ||
| 455 | Stri ng disable dAttribute Str = save ButtonElem ent.getAtt ribute("di sabled"); | |
| 456 | asse rtNull(dis abledAttri buteStr); | |
| 457 | Syst em.out.pri ntln(" d isabledAtt ributeStr = " + disa bledAttrib uteStr); | |
| 458 | ||
| 459 | Stri ng classAt tributeStr = saveBut tonElement .getAttrib ute("class "); | |
| 460 | asse rtNotNull( classAttri buteStr); | |
| 461 | Syst em.out.pri ntln(" c lassAttrib uteStr = " + classAt tributeStr ); | |
| 462 | asse rtFalse("T he class a ttribute v alue on th e Save but ton should NOT conta in the dis abled stri ng", class AttributeS tr.contain s("disable d")); | |
| 463 | ||
| 464 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_13b_Ver ify_SaveBu ttonBecome sEnabledWh enContactT ypeTextFie ldValueIsE ntered()") ; | |
| 465 | } | |
| 466 | ||
| 467 | @T est | |
| 468 | pu blic void test_14_Ve rify_Succe ssfulConta ctInfoSave _WithOnlyM inimalRequ iredSettin gs() throw s Exceptio n { | |
| 469 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_14_Ve rify_Succe ssfulConta ctInfoSave _WithOnlyM inimalRequ iredSettin gs()"); | |
| 470 | ||
| 471 | WebE lement con tactTypeTe xtElement = driver.f indElement (By.id("co ntactType" )); | |
| 472 | asse rtNotNull( contactTyp eTextEleme nt); | |
| 473 | cont actTypeTex tElement.s endKeys("A BCD"); | |
| 474 | ||
| 475 | WebE lement sav eButtonEle ment = dri ver.findEl ement(By.i d("save")) ; | |
| 476 | asse rtNotNull( saveButton Element); | |
| 477 | Thre ad.sleep(1 000); | |
| 478 | ||
| 479 | save ButtonElem ent.click( ); | |
| 480 | Thre ad.sleep(3 000); | |
| 481 | ||
| 482 | // M ake sure y ou are bac k at the " Station Ma intenance | Edit" Page. | |
| 483 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 484 | asse rtNotNull( pageTitleE lement); | |
| 485 | asse rtEquals(" Incorrect Page Title for Stati on Mainten ance Edit Page!", | |
| 486 | "Station Maintenan ce | Edi t", pageTi tleElement .getText() ); | |
| 487 | ||
| 488 | WebE lement add ContactInf oSuccessMe ssageEleme nt = drive r.findElem ent(By.id( "addContac tInfoSucce ssMessage" )); | |
| 489 | asse rtNotNull( addContact InfoSucces sMessageEl ement); | |
| 490 | ||
| 491 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_14_Veri fy_Success fulContact InfoSave_W ithOnlyMin imalRequir edSettings ()"); | |
| 492 | } | |
| 493 | ||
| 494 | @T est | |
| 495 | pu blic void test_15_Ve rify_Succe ssfulConta ctInfoSave _WithDataI nAllFields () throws Exception { | |
| 496 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: Begin test_15_Ve rify_Succe ssfulConta ctInfoSave _WithDataI nAllFields ()"); | |
| 497 | ||
| 498 | WebE lement con tactNameTe xtElement = driver.f indElement (By.id("co ntactName" )); | |
| 499 | asse rtNotNull( contactNam eTextEleme nt); | |
| 500 | cont actNameTex tElement.s endKeys("J oey Thai") ; | |
| 501 | ||
| 502 | WebE lement con tactTypeTe xtElement = driver.f indElement (By.id("co ntactType" )); | |
| 503 | asse rtNotNull( contactTyp eTextEleme nt); | |
| 504 | cont actTypeTex tElement.s endKeys("C EM"); | |
| 505 | ||
| 506 | WebE lement add ressLineOn eTextEleme nt = drive r.findElem ent(By.id( "addressLi neOne")); | |
| 507 | asse rtNotNull( addressLin eOneTextEl ement); | |
| 508 | addr essLineOne TextElemen t.sendKeys ("123 Elm Street"); | |
| 509 | ||
| 510 | WebE lement add ressLineTw oTextEleme nt = drive r.findElem ent(By.id( "addressLi neTwo")); | |
| 511 | asse rtNotNull( addressLin eTwoTextEl ement); | |
| 512 | addr essLineTwo TextElemen t.sendKeys ("Apartmen t 890"); | |
| 513 | ||
| 514 | WebE lement cit yTextEleme nt = drive r.findElem ent(By.id( "city")); | |
| 515 | asse rtNotNull( cityTextEl ement); | |
| 516 | city TextElemen t.sendKeys ("Melbourn e"); | |
| 517 | ||
| 518 | WebE lement zip CodeTextEl ement = dr iver.findE lement(By. id("zipCod e")); | |
| 519 | asse rtNotNull( zipCodeTex tElement); | |
| 520 | zipC odeTextEle ment.sendK eys("90210 "); | |
| 521 | ||
| 522 | WebE lement ema ilTextElem ent = driv er.findEle ment(By.id ("email")) ; | |
| 523 | asse rtNotNull( emailTextE lement); | |
| 524 | emai lTextEleme nt.sendKey s("larrysu mmers@ftc- llc.com"); | |
| 525 | ||
| 526 | WebE lement fax TextElemen t = driver .findEleme nt(By.id(" fax")); | |
| 527 | asse rtNotNull( faxTextEle ment); | |
| 528 | faxT extElement .sendKeys( "321-678-5 621"); | |
| 529 | ||
| 530 | WebE lement pho neTextElem ent = driv er.findEle ment(By.id ("phone")) ; | |
| 531 | asse rtNotNull( phoneTextE lement); | |
| 532 | phon eTextEleme nt.sendKey s("321-999 -9999"); | |
| 533 | ||
| 534 | WebE lement sav eButtonEle ment = dri ver.findEl ement(By.i d("save")) ; | |
| 535 | asse rtNotNull( saveButton Element); | |
| 536 | ||
| 537 | Thre ad.sleep(1 000); | |
| 538 | save ButtonElem ent.click( ); | |
| 539 | Thre ad.sleep(3 000); | |
| 540 | ||
| 541 | // M ake sure y ou are bac k at the " Station Ma intenance | Edit" Page. | |
| 542 | WebE lement pag eTitleElem ent = driv er.findEle ment(By.id ("pageTitl e")); | |
| 543 | asse rtNotNull( pageTitleE lement); | |
| 544 | asse rtEquals(" Incorrect Page Title for Stati on Mainten ance Edit Page!", | |
| 545 | "Station Maintenan ce | Edi t", pageTi tleElement .getText() ); | |
| 546 | ||
| 547 | WebE lement add ContactInf oSuccessMe ssageEleme nt = drive r.findElem ent(By.id( "addContac tInfoSucce ssMessage" )); | |
| 548 | asse rtNotNull( addContact InfoSucces sMessageEl ement); | |
| 549 | ||
| 550 | Syst em.out.pri ntln("Stat ionMainten anceAddCon tactInfoTe st: End te st_15_Veri fy_Success fulContact InfoSave_W ithDataInA llFields() "); | |
| 551 | } | |
| 552 | ||
| 553 | // Franklin Perez (11/ 1/2017): D o not know how to te st for fai lure of Co ntact Info Addition due to not knowing | |
| 554 | // how to excite sys tem to ret urn back f ailure of Add Contac t Info. | |
| 555 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.