// Test Case 6: Password Empty - Error private void profileSetUpPasswordEmpty() throws InterruptedException { profilePage1(); driver.findElement(By.id("nickName")).click(); driver.findElement(By.id("nickName")).clear(); driver.findElement(By.id("nickName")).sendKeys("Neel"); new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January"); driver.findElement(By.cssSelector("option[value=\"01\"]")).click(); new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04"); driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click(); new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994"); driver.findElement(By.cssSelector("option[value=\"1994\"]")).click(); driver.findElement(By.id("email")).click(); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("*****@*****.**"); driver.findElement(By.id("emailConfirmation")).click(); driver.findElement(By.id("emailConfirmation")).clear(); driver.findElement(By.id("emailConfirmation")).sendKeys("*****@*****.**"); driver.findElement(By.id("password")).click(); driver.findElement(By.id("password")).clear(); Thread.sleep(3000); driver.findElement(By.cssSelector("input.submitButton.green")).click(); Thread.sleep(3000); System.out.println("ERROR: Password Missing"); }
// Method checking if the edited profile is displayed back to the user and if illegal string like // URL and email id are stripped off from "profile essay" sections private void verifyChanges() { List<WebElement> allElements = driver.findElements(By.cssSelector("div[id='about_myself'] p")); for (WebElement element1 : allElements) { if (element1.getText().contains("www.") || element1.getText().contains(".com")) ; ripOffTextAboutMe++; } List<WebElement> allElements2 = driver.findElements(By.cssSelector("div[id='who_im_looking_for'] p")); for (WebElement element2 : allElements2) { if (element2.getText().contains("www.") || element2.getText().contains(".com")) ; ripOffTextPartnerSearch++; } List<WebElement> allElement3 = driver.findElements(By.cssSelector("ul[class='profileInformation'] li")); for (WebElement element3 : allElement3) { // System.out.println(element3.getText()); if (element3.getText().contains("Mixed") || element3.getText().contains("4ft. 10in.")) profileChangeCheck++; } if (profileChangeCheck > 0) System.out.println("SUCCESS: The changes made in the basic profile are visible"); if (ripOffTextAboutMe != 0) System.out.println( "SUCCESS: The About Myself section has ripped off any illegal strings like URL and Email id"); if (ripOffTextPartnerSearch != 0) System.out.println( "SUCCESS: The What I am Looking For section has ripped off any illegal strings like URL and Email id"); }
// *** l'utilisation des données "......" // ** et des données de longeurs de "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn" // pour le champ nom // * l'impossibilité de modifier l'id d'un motif de remplacemnt une fois enregistré @Test public void testSSV8VALDEBTA008cIntegrationTests() throws Exception { driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml"); Thread.sleep(1000); findElement(By.id("j_username")).clear(); findElement(By.id("j_username")).sendKeys("usercenter"); Thread.sleep(1000); findElement(By.id("j_password")).clear(); findElement(By.id("j_password")).sendKeys("pwd8888"); findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click(); optionalClick(By.xpath("//span/a")); findElement(By.id("form:table:1:sdksds")).click(); findElement(By.xpath("(//img[@alt='English'])[4]")).click(); findElement(By.xpath("(//a[contains(text(),'Card Replacement Motif')])[2]")).click(); new Select(findElement(By.id("globalCardReplacementMotifForm:bank"))) .selectByVisibleText("banque test 3"); Thread.sleep(1000); findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img")) .click(); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys(".........."); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_031"); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img")) .click(); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_031"); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")) .sendKeys("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img")) .click(); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_033"); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_033"); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement( By.id( "globalCardReplacementMotifForm:searchCardDesignFeesResultsId:0:scxqsjhvcqjshcvhqsceee")) .click(); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement(By.xpath("(//img[@alt='English'])[2]")).click(); }
@Test public void testIncorrectIncorrect() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Log In")).click(); driver.findElement(By.id("navbar_username")).clear(); driver.findElement(By.id("navbar_username")).sendKeys("wrong"); driver.findElement(By.id("navbar_password")).clear(); driver.findElement(By.id("navbar_password")).sendKeys("wrong"); driver.findElement(By.cssSelector("input.button")).click(); assertEquals("Log In", driver.findElement(By.linkText("Log In")).getText()); driver.findElement(By.cssSelector("img[alt=\"Myth-Weavers\"]")).click(); }
@Test public void testOtsi() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Kandidaadid")).click(); // Warning: waitForTextPresent may require manual changes for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")) break; } catch (Exception e) { } Thread.sleep(1000); } driver.findElement(By.id("nimi")).clear(); driver.findElement(By.id("nimi")).sendKeys("Magdalena"); try { assertEquals("Magdalena", driver.findElement(By.id("nimi")).getAttribute("value")); } catch (Error e) { verificationErrors.append(e.toString()); } driver.findElement(By.id("sButton")).click(); // Warning: waitForTextPresent may require manual changes for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Magdalena Malejeva[\\s\\S]*$")) break; } catch (Exception e) { } Thread.sleep(1000); } // Warning: verifyTextNotPresent may require manual changes try { assertFalse( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } }
// Delete CSR @Test public void Test5() throws Exception { driver.get(baseUrl + "/#/host/magehostmanager.magemojo.com/configuration/ssl"); driver.findElement(By.xpath("//a[contains(text(),'www.Testing5.com')]")).click(); assertEquals( "Download CSR www.Testing5.com", driver.findElement(By.xpath("//legend[4]")).getText()); driver.findElement(By.xpath("(//button[@type='button'])[8]")).click(); assertEquals( "Confirmation Window", driver.findElement(By.cssSelector("h3.modal-title.ng-binding")).getText()); assertTrue(isElementPresent(By.xpath("//div[3]/button[2]"))); driver.findElement(By.xpath("//div[3]/button")).click(); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if ("Successfully deleted the CSR." .equals(driver.findElement(By.xpath("//div[@id='toast-container']/div")).getText())) break; } catch (Exception e) { } Thread.sleep(1000); } for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (!isElementPresent(By.xpath("//a[contains(text(),'www.Testing5.com')]"))) break; } catch (Exception e) { } Thread.sleep(1000); } }
@Test public void testTemp() throws Exception { driver.get("http://cse.unl.edu/~mouna/WebApps/AddressBook/addressbookv3.4.7/index.php"); driver .findElement( By.cssSelector( "html > body > table > tbody > tr:nth-child(2) > td:nth-child(3) > form > table:nth-child(2) > tbody > tr:nth-child(1) > td:nth-child(7) > a > img")) .click(); driver.findElement(By.name("firstname")).clear(); driver.findElement(By.name("firstname")).sendKeys("JamesEDIT"); driver.findElement(By.name("lastname")).clear(); driver.findElement(By.name("lastname")).sendKeys("PittEDIT"); driver.findElement(By.name("address")).clear(); driver.findElement(By.name("address")).sendKeys("44545 R street EDIT"); driver.findElement(By.name("home")).clear(); driver.findElement(By.name("home")).sendKeys("454545455 8989"); driver.findElement(By.name("mobile")).clear(); driver.findElement(By.name("mobile")).sendKeys("454554555 2398"); driver.findElement(By.name("work")).clear(); driver.findElement(By.name("work")).sendKeys("455455555 32323"); driver.findElement(By.name("email")).clear(); driver.findElement(By.name("email")).sendKeys("[email protected] EDIT"); driver.findElement(By.name("email2")).clear(); driver.findElement(By.name("email2")).sendKeys("[email protected] EDIT"); driver.findElement(By.name("address2")).clear(); driver.findElement(By.name("address2")).sendKeys("EDIT"); driver.findElement(By.name("phone2")).clear(); driver.findElement(By.name("phone2")).sendKeys("EDIT"); driver.findElement(By.name("update")).click(); }
// *** Supression des risques de banques @Test public void testSSV8VALDEBTA997IntegrationTests() throws Exception { driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml"); Thread.sleep(1000); findElement(By.id("j_username")).clear(); findElement(By.id("j_username")).sendKeys("usercenter"); Thread.sleep(1000); findElement(By.id("j_password")).clear(); findElement(By.id("j_password")).sendKeys("pwd8888"); findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click(); optionalClick(By.xpath("//span/a")); findElement(By.id("form:table:0:sdksds")).click(); findElement(By.xpath("(//img[@alt='English'])[11]")).click(); findElement(By.linkText("Managing Risk")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 1"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 2"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[2]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[2]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[2]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 3"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 2"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("(//img[@alt='English'])[2]")).click(); }
@Test public void testEditProfile() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click(); driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click(); driver.findElement(By.id("email")).click(); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("*****@*****.**"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("Eliandtyler1"); driver.findElement(By.id("submit-button")).click(); driver.findElement(By.id("submit-button")).click(); driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click(); driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click(); driver.findElement(By.linkText("Edit Profile & Settings")).click(); driver.findElement(By.linkText("Edit Profile & Settings")).click(); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); }
@Test public void testWeather() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Edmonton")).click(); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (isElementPresent(By.id("cityjump"))) break; } catch (Exception e) { } Thread.sleep(1000); } // Warning: verifyTextPresent may require manual changes try { assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Current Conditions[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } // Warning: verifyTextPresent may require manual changes try { assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Forecast[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } // Warning: verifyTextPresent may require manual changes try { assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Edmonton City Centre Airport[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } }
@Test public void testAltaDePrestamo1() throws Exception { driver.get( baseUrl + "/proyectoBiblioteca/Prestamos?action=new&id=1"); // El 1 es el id del ejemplar, debe // estar disponible para que // funcione la prueba new Select(driver.findElement(By.name("prestamoLocal"))).selectByVisibleText("No"); driver.findElement(By.name("idSocio")).clear(); driver.findElement(By.name("idSocio")).sendKeys("5"); // id de gonza, está inhabilitado driver.findElement(By.id("fecha")).clear(); driver .findElement(By.id("fecha")) .sendKeys(Utilidades.getSimpleDate(new Date())); // pongo la fecha de hoy driver.findElement(By.cssSelector("button.btn.btn-success")).click(); assertEquals( "Préstamo no creado. El socio ingresado no se encuentra habilitado para recibir préstamos.", driver.findElement(By.cssSelector("div.alert.alert-info")).getText()); }
@Test public void testBookSearch5() throws Exception { driver.get(baseUrl + "/proyectoBiblioteca/"); new Select(driver.findElement(By.name("type"))).selectByVisibleText("Editorial"); driver.findElement(By.name("search")).clear(); driver.findElement(By.name("search")).sendKeys("De Bolsillo"); driver.findElement(By.xpath("//button[@type='submit']")).click(); assertEquals( "Libros Encontrados", driver.findElement(By.cssSelector("div.panel-heading")).getText()); }
@Test public void test35() throws Exception { driver.get(baseUrl + "/accountType/list"); driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click(); driver.findElement(By.cssSelector("a.submit.edit > span")).click(); driver.findElement(By.id("creditLimitAsDecimal")).clear(); driver.findElement(By.id("creditLimitAsDecimal")).sendKeys("300.00"); driver.findElement(By.cssSelector("a.submit.save > span")).click(); driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click(); driver.findElement(By.cssSelector("a.submit.edit > span")).click(); driver.findElement(By.id("creditLimitAsDecimal")).clear(); driver.findElement(By.id("creditLimitAsDecimal")).sendKeys("200.00"); driver.findElement(By.cssSelector("a.submit.save > span")).click(); driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click(); Assert.assertEquals(driver.getPageSource().contains("US$200.00"), true); }
@Test public void testAssigneUsScrumMaster2() throws Exception { driver.get(baseUrl + "/login.html"); driver.findElement(By.name("j_username")).clear(); driver.findElement(By.name("j_username")).sendKeys("*****@*****.**"); driver.findElement(By.name("j_password")).clear(); driver.findElement(By.name("j_password")).sendKeys("product"); driver.findElement(By.xpath("//input[@value='Login']")).click(); driver.findElement(By.cssSelector("input.btn.btn-success")).click(); driver.findElement(By.id("tag_input")).clear(); driver.findElement(By.id("tag_input")).sendKeys("Crea Git"); driver.findElement(By.id("description_input")).clear(); driver.findElement(By.id("description_input")).sendKeys("Creation Depot git"); driver.findElement(By.id("priority_input")).clear(); driver.findElement(By.id("priority_input")).sendKeys("1"); driver.findElement(By.id("difficulty_input")).clear(); driver.findElement(By.id("difficulty_input")).sendKeys("5"); new Select(driver.findElement(By.id("master_input"))).selectByVisibleText("Scrum1 Master1"); driver.findElement(By.cssSelector("button.btn.btn-success")).click(); driver.findElement(By.linkText("Sign out")).click(); }
@Test public void testUntitled() throws Exception { driver.get(baseUrl + "en/login"); driver.findElement(By.id("signin_username")).clear(); driver.findElement(By.id("signin_username")).sendKeys("admin"); driver.findElement(By.id("signin_password")).clear(); driver.findElement(By.id("signin_password")).sendKeys("admin"); driver.findElement(By.cssSelector("button.button")).click(); driver.get(baseUrl + "/en/profile/edit"); driver.findElement(By.xpath("(//img[@alt='Leave this community'])[3]")).click(); assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$")); driver.findElement(By.xpath("(//img[@alt='Leave this community'])[2]")).click(); assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$")); driver.findElement(By.cssSelector("a[alt=\"Leave\"]")).click(); assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$")); driver.findElement(By.id("profile_community_comunity")).click(); new Select(driver.findElement(By.id("profile_community_community"))) .selectByVisibleText("My Sample Community #1"); driver.findElement(By.cssSelector("button")).click(); new Select(driver.findElement(By.id("profile_community_community"))) .selectByVisibleText("My Sample Community #2"); driver.findElement(By.cssSelector("button")).click(); new Select(driver.findElement(By.id("profile_community_community"))) .selectByVisibleText("CAPS"); driver.findElement(By.cssSelector("button")).click(); driver.findElement(By.cssSelector("button.button.submitButton")).click(); }
@Test public void testCreateFilm() throws Exception { driver.findElement(By.cssSelector("img[alt=\"Add movie\"]")).click(); driver.findElement(By.name("name")).clear(); driver.findElement(By.name("name")).sendKeys("Новый фильм"); driver.findElement(By.name("year")).clear(); driver.findElement(By.name("year")).sendKeys("1999"); driver.findElement(By.name("duration")).clear(); driver.findElement(By.name("duration")).sendKeys("90"); driver.findElement(By.id("own_no")).click(); driver.findElement(By.id("seen_no")).click(); driver.findElement(By.id("submit")).click(); }
@Test public void testScenario4() throws Exception { driver.get(baseUrl + "/recipe/index.php"); driver.findElement(By.xpath("//div[@id='nav']/table/tbody/tr[7]/td/a/strong")).click(); driver.findElement(By.name("title")).clear(); driver.findElement(By.name("title")).sendKeys("Chicken Ramen"); driver.findElement(By.name("shortdesc")).clear(); driver.findElement(By.name("shortdesc")).sendKeys("Classic Ramen noodles"); driver.findElement(By.name("ingredients")).clear(); driver.findElement(By.name("ingredients")).sendKeys("Ramen package, 2 cups water"); driver.findElement(By.name("directions")).clear(); driver .findElement(By.name("directions")) .sendKeys( "Bring water to boil. Add noodles from package. Boil 7 minutes. Add flavor package."); driver.findElement(By.cssSelector("#main > form > input[type=\"submit\"]")).click(); // Warning: assertTextPresent may require manual changes assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Recipe posted[\\s\\S]*$")); }
@Test public void testGoal() throws Exception { driver.get(baseUrl + "/ubercoaching/logout"); driver.findElement(By.linkText("Login")).click(); driver.findElement(By.name("username")).clear(); driver.findElement(By.name("username")).sendKeys("test"); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys("test"); driver.findElement(By.name("commit")).click(); driver.findElement(By.xpath("(//a[contains(text(),'PROCEED »')])[4]")).click(); driver.findElement(By.name("weight")).clear(); driver.findElement(By.name("weight")).sendKeys("75"); driver.findElement(By.name("width")).clear(); driver.findElement(By.name("width")).sendKeys("60"); driver.findElement(By.cssSelector("input[type=\"submit\"]")).click(); driver.findElement(By.name("goalWeight")).clear(); driver.findElement(By.name("goalWeight")).sendKeys("70"); driver.findElement(By.name("goalDate")).clear(); driver.findElement(By.name("goalDate")).sendKeys("20/05/2016"); driver.findElement(By.xpath("//input[@value='Set Goal']")).click(); }
@Test public void testAddCampaign() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")).sendKeys("test"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("test"); driver.findElement(By.cssSelector("button.btn.btn-default")).click(); driver.findElement(By.linkText("Campaigns")).click(); driver.findElement(By.cssSelector("button.btn.btn-default")).click(); driver.findElement(By.xpath("(//button[@type='button'])[2]")).click(); driver.findElement(By.cssSelector("div.input-group > input.form-control")).clear(); driver.findElement(By.cssSelector("div.input-group > input.form-control")).sendKeys("test2"); driver.findElement(By.cssSelector("span.input-group-btn > button.btn.btn-default")).click(); new Select(driver.findElement(By.cssSelector("select.form-control"))) .selectByVisibleText("test2"); driver.findElement(By.xpath("//button[@type='button']")).click(); }
// Test Case 1: Postal Code Missing - Error private void newProfilePostalCodeEmpty() throws InterruptedException { driver.manage().window().maximize(); driver.findElement(By.cssSelector("li")).click(); new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman"); driver.findElement(By.cssSelector("option[value=\"3\"]")).click(); new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man"); driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click(); driver.findElement(By.id("profileLookingMinAge")).click(); new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20"); driver.findElement(By.cssSelector("option[value=\"20\"]")).click(); new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36"); driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click(); driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click(); driver.findElement(By.id("submit")).click(); System.out.println("ERROR: Postal Code is Empty"); Thread.sleep(5000); }
// Profile creation - step 1 private void profilePage1() throws InterruptedException { driver.manage().window().maximize(); driver.findElement(By.cssSelector("li")).click(); new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman"); driver.findElement(By.cssSelector("option[value=\"3\"]")).click(); new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man"); driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click(); driver.findElement(By.id("profileLookingMinAge")).click(); new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20"); driver.findElement(By.cssSelector("option[value=\"20\"]")).click(); new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36"); driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click(); driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click(); driver.findElement(By.id(("postalCode"))).click(); driver.findElement(By.id(("postalCode"))).clear(); driver.findElement(By.id(("postalCode"))).sendKeys("H3S1H4"); driver.findElement(By.id("submit")).click(); Thread.sleep(5000); }
@Test public void testMap2() throws Exception { driver.get(baseUrl + "/ModSolarPlatform/login.jsp;jsessionid=F33B6C551CBA0A359E87354993539EFA"); driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")).sendKeys("christianqa"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("qa"); driver.findElement(By.name("submit")).click(); driver.findElement(By.cssSelector("div.newLeadList")).click(); driver.findElement(By.id("tabResidential")).click(); driver.findElement(By.id("firstNameResidential")).clear(); driver.findElement(By.id("firstNameResidential")).sendKeys("christian"); driver.findElement(By.id("lastNameResidential")).clear(); driver.findElement(By.id("lastNameResidential")).sendKeys("Mabila"); driver.findElement(By.id("addressResidential")).clear(); driver.findElement(By.id("addressResidential")).sendKeys("600 Clipper rd"); driver.findElement(By.id("cityResidential")).clear(); driver.findElement(By.id("cityResidential")).sendKeys("Belmont"); new Select(driver.findElement(By.id("stateResidential"))).selectByVisibleText("California"); // driver.findElement(By.id("zipCodeResidential")).clear(); // driver.findElement(By.id("zipCodeResidential")).sendKeys("90042"); driver.findElement(By.cssSelector("#zipCodeResidential")).clear(); driver.findElement(By.cssSelector("#zipCodeResidential")).sendKeys("90042"); Thread.sleep(1500); driver.findElement(By.id("emailResidential")).clear(); driver.findElement(By.id("emailResidential")).sendKeys("*****@*****.**"); driver.findElement(By.id("utilityTaxRateInputAddressResidential")).clear(); driver.findElement(By.id("utilityTaxRateInputAddressResidential")).sendKeys("1.2"); driver.findElement(By.id("averageMonthlyBillResidential")).clear(); driver.findElement(By.id("averageMonthlyBillResidential")).sendKeys("225"); driver.findElement(By.id("nextBtn")).click(); Thread.sleep(1000); WebElement mainCanvas = driver.findElement(By.xpath(".//*[@id='mapCanvas']/div/div[1]/div[2]")); Actions mouseAction = new Actions(driver); mouseAction.moveToElement(mainCanvas); mouseAction.contextClick(mainCanvas); mouseAction.moveByOffset(5, 25); mouseAction.sendKeys(Keys.ARROW_DOWN); mouseAction.sendKeys(Keys.RETURN); // mouseAction.keyDown(Keys.ARROW_DOWN); // mouseAction.moveToElement(subMenu); mouseAction.click(); mouseAction.perform(); WebElement mainCanvas2 = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); Actions mouseAction2 = new Actions(driver); mouseAction2.moveToElement(mainCanvas2); mouseAction2.contextClick(mainCanvas2); mouseAction2.moveByOffset(70, 50); mouseAction2.sendKeys(Keys.ARROW_DOWN); mouseAction2.sendKeys(Keys.RETURN); // mouseAction.keyDown(Keys.ARROW_DOWN); // mouseAction.moveToElement(subMenu); mouseAction2.click(); mouseAction2.perform(); WebElement mainCanvas3 = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); Actions mouseAction3 = new Actions(driver); mouseAction3.moveToElement(mainCanvas3); mouseAction3.contextClick(mainCanvas3); mouseAction3.moveToElement(mainCanvas2, 500, 220); mouseAction3.sendKeys(Keys.ARROW_DOWN); mouseAction3.sendKeys(Keys.RETURN); // mouseAction.keyDown(Keys.ARROW_DOWN); // mouseAction.moveToElement(subMenu); mouseAction3.click(); mouseAction3.perform(); // Clicking inside the Triangle WebElement e = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); new Actions(driver).moveToElement(e, 0, 0).moveByOffset(520, 255).click().build().perform(); driver.findElement(By.cssSelector("div.pgNext.right > input.btn")).click(); driver.findElement(By.xpath("//div[@id='accordion']")).click(); driver.findElement(By.id("regionsPaneTitle")).click(); // Clicking inside the Triangle 1 WebElement eI = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); new Actions(driver).moveToElement(eI, 0, 0).moveByOffset(520, 255).click().build().perform(); Thread.sleep(1000); // Clicking inside the Triangle 1 WebElement eS = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); new Actions(driver).moveToElement(eS, 0, 0).moveByOffset(520, 255).click().build().perform(); Thread.sleep(1000); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click(); //// // driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")).click(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .clear(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .sendKeys("52"); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .click(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .clear(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .sendKeys("18"); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .click(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .clear(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .sendKeys("45"); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click(); driver.findElement(By.cssSelector("label.overTxtLabel")).click(); driver.findElement(By.id("proposalName")).sendKeys("AUTOMATION TEST"); driver.findElement(By.id("regionsPaneTitle")).click(); driver.findElement(By.id("regionsPaneTitle")).click(); Thread.sleep(500); /// driver.findElement(By.id("squareUpButton2")).click(); driver.findElement(By.xpath("//input[@id='snapAzimuthButton1']")).click(); driver.findElement(By.xpath("//input[@id='applySetbacksButton1']")).click(); /// assertEquals("Setbacks cannot be less than zero.", closeAlertAndGetItsText()); //// driver.findElement(By.id("delPolygonButton2")).click(); Thread.sleep(1000); /// driver.findElement(By.id("squareUpButton3")).click(); /// driver.findElement(By.id("squareUpButton3")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.cssSelector("div[title=\"Pan up\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Pan right\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Pan down\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Pan left\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Zoom out\"] > img")).click(); driver.findElement(By.cssSelector("div[title=\"Zoom in\"] > img")).click(); driver.findElement(By.id("accordion")).click(); ///// ///// //// /// no need driver.findElement(By.xpath("//div[@id='solutionCategory']/ul/li[2]/h3")).click(); /// no need driver.findElement(By.cssSelector("span.arrow")).click(); driver.findElement(By.xpath("//input[@value='Next']")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("accordionTitleText")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("nextButton")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("contentUsagePaneTitle")).click(); driver.findElement(By.id("accordion")).click(); Thread.sleep(1000); // click on Inverters driver.findElement(By.xpath("//h3[text()= 'Inverters']")).click(); // Click on Arrow driver.findElement(By.xpath("//span[@class = 'arrow']")).click(); Thread.sleep(1000); // Default Invert select driver.findElement(By.xpath("html/body/ul/li[2]/span")).click(); // Click on Arrow driver.findElement(By.xpath("//span[@class = 'arrow']")).click(); Thread.sleep(2000); // Click on Next button driver.findElement(By.xpath("//input[@value='Next']")).click(); Thread.sleep(2000); ////// errror--- driver.findElement(By.id("supplyLeadDetailsBtn1")).click(); driver.findElement(By.id("accordion")).click(); ///// driver.findElement(By.id("accordion")).click(); ////// driver.findElement(By.id("accordion")).click(); Thread.sleep(1500); ///// driver.findElement(By.id("backBtn")).click(); //// driver.findElement(By.cssSelector("label > input[type=\"button\"]")).click(); // Click on Next button driver.findElement(By.xpath("//input[@id='nextButton']")).click(); /// PREVIEW PAGE STARTS HERE Thread.sleep(2000); driver.findElement(By.id("accordion")).click(); Thread.sleep(250); driver.findElement(By.cssSelector("#buyForCashCheckbox")).click(); Thread.sleep(250); driver.findElement(By.cssSelector("#nextButton")).click(); Thread.sleep(1000); // ERROR: Caught exception [unknown command []] }
@Test public void testVip7day() throws Exception { driver .manage() .timeouts() .implicitlyWait(30, TimeUnit.SECONDS); // неявное ожидание при каждом поиске элементов driver.get("http://mylove.ru"); driver.findElement(By.id("mprofile_link")).click(); driver.findElement(By.cssSelector("#isvip")).click(); if (isElementPresent(By.xpath("//*[@id='settings']"))) { driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click(); } Pattern pat = Pattern.compile("[-]?[0-9]+(.[0-9]+)?"); // String Str1= driver.findElement(By.cssSelector("div.vipend > i")).getText(); String Str1 = driver .findElement( By.cssSelector("#body > div.window.pay_window > div > div.paymay > div.vipend > i")) .getText(); Matcher matcher1 = pat.matcher(Str1); while (matcher1.find()) Str1 = matcher1.group(); // что-то происходит Str1 = Str1.replaceAll(" ", ""); Integer i1 = Integer.valueOf(Str1); // driver.findElement(By.xpath("//*[@id=\"vip_settings\"]/div[2]/a[1]")).click(); тоже верно driver.findElement(By.cssSelector("#vip_settings div.pcols > a")).click(); Thread.sleep( 1000); /// без ожидания не успевает измениться выбранное значение дней, потом заменить на // явное ожидание с условием driver .findElement(By.cssSelector("div.pay_variant.pay_bill.pay_variant_cash > a")) .click(); // Платим со счета WebDriverWait wait = new WebDriverWait(driver, 20); wait.until( ExpectedConditions.stalenessOf( driver.findElement( By.cssSelector( "#isvip")))); // подождем когда какой то DOM исчезнет(( чтобы посмотреть сколько // теперь дней до окончания випа, долго работает driver.findElement(By.cssSelector("#isvip")).click(); driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click(); String Str2 = driver.findElement(By.cssSelector("div.vipend > i")).getText(); Matcher matcher2 = pat.matcher(Str2); while (matcher2.find()) Str2 = matcher2.group(); Str2 = Str2.replaceAll(" ", ""); // если дней больше 1000 то строка с пробелами Integer i2 = Integer.valueOf(Str2); i1 = i1 + 7; // Проверим что количество дней випа увеличилось на 7 assertEquals(i2, i1); };
// Test Case 8: Validating the view and edit profile - Changing fields in mini-profile to see the // changes displayed private void profileEditViewSetUp() throws InterruptedException { profilePage1(); String emailShuffled = shuffleEmail(email); driver.findElement(By.id("nickName")).click(); driver.findElement(By.id("nickName")).clear(); driver.findElement(By.id("nickName")).sendKeys("Neel"); new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January"); driver.findElement(By.cssSelector("option[value=\"01\"]")).click(); new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04"); driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click(); new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994"); driver.findElement(By.cssSelector("option[value=\"1994\"]")).click(); driver.findElement(By.id("email")).click(); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys(emailShuffled + "@def.com"); driver.findElement(By.id("emailConfirmation")).click(); driver.findElement(By.id("emailConfirmation")).clear(); driver.findElement(By.id("emailConfirmation")).sendKeys(emailShuffled + "@def.com"); driver.findElement(By.id("password")).click(); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("target"); Thread.sleep(3000); driver.findElement(By.cssSelector("input.submitButton.green")).click(); driver.findElement(By.id("headline")).click(); driver.findElement(By.id("headline")).clear(); driver.findElement(By.id("headline")).sendKeys("I am fine!!!"); driver.findElement(By.id("country")).click(); new Select(driver.findElement(By.id("country"))).selectByVisibleText("Canada"); driver.findElement(By.cssSelector("option[value=\"39\"]")).click(); driver.findElement(By.id("postalCode")).click(); driver.findElement(By.id("postalCode")).clear(); driver.findElement(By.id("postalCode")).sendKeys("H3S1H4"); new Select(driver.findElement(By.id("education"))).selectByVisibleText("Graduate degree"); driver.findElement(By.cssSelector("#education > option[value=\"7\"]")).click(); new Select(driver.findElement(By.id("occupation"))).selectByVisibleText("Artist"); driver.findElement(By.cssSelector("#occupation > option[value=\"15\"]")).click(); new Select(driver.findElement(By.id("relationship"))).selectByVisibleText("Single"); driver.findElement(By.cssSelector("#relationship > option[value=\"3\"]")).click(); // driver.findElement(By.id("income")).click(); new Select(driver.findElement(By.id("income"))).selectByVisibleText("$25,000-$50,000"); driver.findElement(By.cssSelector("#income > option[value=\"4\"]")).click(); // driver.findElement(By.id("religion")).click(); new Select(driver.findElement(By.id("religion"))).selectByVisibleText("Other"); driver.findElement(By.cssSelector("#religion > option[value=\"3\"]")).click(); // driver.findElement(By.id("fbCloseButton")).click(); new Select(driver.findElement(By.id("height"))).selectByVisibleText("5ft. 6in."); driver.findElement(By.cssSelector("#height > option[value=\"166\"]")).click(); // driver.findElement(By.id("ethnicity")).click(); new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Asian"); driver.findElement(By.cssSelector("#ethnicity > option[value=\"5\"]")).click(); // driver.findElement(By.id("bodyType")).click(); new Select(driver.findElement(By.id("bodyType"))).selectByVisibleText("Average"); driver.findElement(By.cssSelector("#bodyType > option[value=\"5\"]")).click(); // driver.findElement(By.id("eyeColor")).click(); new Select(driver.findElement(By.id("eyeColor"))).selectByVisibleText("Black"); driver.findElement(By.cssSelector("#eyeColor > option[value=\"8\"]")).click(); // driver.findElement(By.id("hairColor")).click(); new Select(driver.findElement(By.id("hairColor"))).selectByVisibleText("Black"); driver.findElement(By.cssSelector("#hairColor > option[value=\"7\"]")).click(); // driver.findElement(By.id("smoking")).click(); new Select(driver.findElement(By.id("smoking"))).selectByVisibleText("Often"); driver.findElement(By.cssSelector("#smoking > option[value=\"5\"]")).click(); // driver.findElement(By.id("alcohol")).click(); new Select(driver.findElement(By.id("alcohol"))).selectByVisibleText("Occasionally"); driver.findElement(By.cssSelector("#alcohol > option[value=\"4\"]")).click(); driver.findElement(By.cssSelector("input.submitButton.green")).click(); Thread.sleep(3000); driver.findElement(By.linkText("I promise to upload a photo later")).click(); Thread.sleep(3000); driver.findElement(By.linkText("close")).click(); viewEditProfile(); }