コード例 #1
0
 /*Check the availibility of elements*/
 @SuppressWarnings("deprecation")
 public boolean checkVisibility(By by) {
   try {
     driver.findElement(by);
     Log.info("ERROR: " + driver.findElement(by).getText());
     return true;
   } catch (NoSuchElementException e) {
     return false;
   }
 }
コード例 #2
0
 @SuppressWarnings("deprecation")
 @Test
 public void firstNameFieldTestWithSpacesInInput() {
   Log.info("Test for first name input with spaces");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.textOperations("firstNameField", "firstnameWithSpaces");
   driver.findElement(By.id("l_name")).click();
   Assert.assertFalse(checkVisibility(By.cssSelector("label.error")));
 }
コード例 #3
0
 @SuppressWarnings("deprecation")
 @Test
 public void firstNameFieldTestForOutOfBoundInput() {
   Log.info("Test for out of bound first name input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.textOperations("firstNameField", "firstnameOutOfBound");
   driver.findElement(By.id("l_name")).click();
   Assert.assertTrue(checkVisibility(By.cssSelector("label.error")));
 }
コード例 #4
0
 @SuppressWarnings("deprecation")
 @Test
 public void emailFieldTestForInValidInput() throws InterruptedException {
   Log.info("Test for invalid email input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.textOperations("emailInputRegistrationForm", "emailInValid");
   driver.findElement(By.id("f_name")).click();
   Assert.assertTrue(checkVisibility(By.cssSelector("label.error")));
 }
コード例 #5
0
 @SuppressWarnings("deprecation")
 @Test
 public void testEnterValidPostCode() {
   Log.info("Test for valid postcode input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.textOperations("postalCodeField", "postcodeValid");
   driver.findElement(By.id("f_name")).click();
   Assert.assertEquals(false, checkVisibility(By.cssSelector("label.error")));
 }
コード例 #6
0
 /*overriding setup method*/
 @SuppressWarnings("deprecation")
 @BeforeClass
 public void setUp() throws Exception {
   FirefoxProfile profile = new FirefoxProfile();
   profile.setEnableNativeEvents(true);
   driver = new FirefoxDriver(profile);
   baseUrl = "https://www.easyfinancial.com";
   driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
   Log.info(
       "Lets Begin the test!!--------------------------------------------------------------------");
 }
コード例 #7
0
 @SuppressWarnings("deprecation")
 @Test
 public void testSelectPhoneType() {
   Log.info("Test for selecting phone type input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.selectPhoneType("MOBILE");
   Assert.assertEquals("MOBILE", driver.findElement(By.name("phoneType")).getAttribute("value"));
   Assert.assertFalse(checkVisibility(By.cssSelector("label.error")));
 }
コード例 #8
0
 @SuppressWarnings("deprecation")
 @Test
 public void lastNameFieldTestForInValidInput() {
   Log.info("Test for invalid last name input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.textOperations("lastNameField", "lastnameWithSpecialChar");
   driver.findElement(By.id("f_name")).click();
   Assert.assertTrue(checkVisibility(By.cssSelector("label.error")));
 }
コード例 #9
0
 @SuppressWarnings({"deprecation"})
 @Test
 public void testEnterInValidPhoneNumber() {
   Log.info("Test for invalid phone number input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.selectPhoneType("MOBILE");
   obj.enterText(By.id(getVal.getProp("phoneTextField")), getVal.getProp("invalidPhoneNumber"));
   driver.findElement(By.id("f_name")).click();
   Assert.assertTrue(checkVisibility(By.cssSelector("label.error")));
 }
コード例 #10
0
 @SuppressWarnings("deprecation")
 @Test
 public void testDisappearanceOfErrorMessageLastNameInput() throws InterruptedException {
   Log.info("Test checking the disappearance of error code on entering correct input");
   driver.get(baseUrl);
   pageClass obj = new pageClass(driver);
   obj.goToRegistrationForm();
   obj.disappearanceOfErrorMessage(
       By.id(getVal.getProp("lastNameField")),
       By.id(getVal.getProp("firstNameField")),
       "90980dwf",
       "handur");
   Assert.assertFalse(checkVisibility(By.cssSelector("label.error")));
 }