Advertisement
Atanasov_88

Untitled

Aug 15th, 2015
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.76 KB | None | 0 0
  1. import org.junit.After;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4. import org.openqa.selenium.By;
  5. import org.openqa.selenium.WebDriver;
  6. import org.openqa.selenium.WebElement;
  7. import org.openqa.selenium.firefox.FirefoxDriver;
  8.  
  9. public class SupertoysAutomationTest {
  10.  
  11.     private WebDriver firefoxdriver;
  12.  
  13.     @Before
  14.     public void setUp(){
  15.         firefoxdriver = new FirefoxDriver();
  16.  
  17.     }
  18.  
  19.     @Test
  20.     public void Testing_Login_Form(){
  21.  
  22.         firefoxdriver.get("http://supertoys.bg/admin123");
  23.  
  24.         String validUserName = "test";
  25.         String validPasswordField = "testtest123";
  26.  
  27.         WebElement userName = firefoxdriver.findElement(By.id("username"));
  28.         WebElement password = firefoxdriver.findElement(By.id("login"));
  29.  
  30.         userName.clear();
  31.         userName.sendKeys(validUserName);
  32.  
  33.         password.clear();
  34.         password.sendKeys(validPasswordField);
  35.  
  36.         WebElement loginFormButton = firefoxdriver.findElement(By.xpath("/html/body/div/div/form/div/div[5]/input"));
  37.         loginFormButton.click();
  38.  
  39.  
  40.         WebElement logOutButton = firefoxdriver.findElement(By.className("link-logout"));
  41.         logOutButton.click();
  42.  
  43.     }
  44.  
  45.      @Test
  46.     public void Forgotten_Password_APS(){
  47.         this.Testing_Login_Form();
  48.  
  49.        WebElement forgottenPasswordKey = firefoxdriver.findElement(By.xpath("/html/body/div/div/form/div/div[5]/a"));
  50.         forgottenPasswordKey.click();
  51.  
  52.        WebElement actualPassword = firefoxdriver.findElement(By.id("email"));
  53.          actualPassword.clear();
  54.          actualPassword.sendKeys("qatester@abv.bg");
  55.  
  56.        WebElement submitEmailButton = firefoxdriver.findElement(By.xpath("/html/body/div/div/form/fieldset/div[4]/button"));
  57.          submitEmailButton.click();
  58.  
  59.  
  60.     }
  61.  
  62.     @Test
  63.     public void New_Password_in_ABV_Post() {
  64.         this.Forgotten_Password_APS();
  65.  
  66.         firefoxdriver.get("www.abv.bg");
  67.  
  68.         String validUserName = "qatester";
  69.         String validPassword = "ceca12345";
  70.  
  71.         WebElement usernameFieldABV = firefoxdriver.findElement(By.id("username"));
  72.         WebElement passwordFieldABV = firefoxdriver.findElement(By.id("password"));
  73.  
  74.         usernameFieldABV.clear();
  75.         usernameFieldABV.sendKeys(validUserName);
  76.  
  77.         passwordFieldABV.clear();
  78.         passwordFieldABV.sendKeys(validPassword);
  79.  
  80.         WebElement loginButtonFieldABV = firefoxdriver.findElement(By.id("loginBut"));
  81.         loginButtonFieldABV.click();
  82.  
  83.         WebElement inboxKeyABV = firefoxdriver.findElement(By.xpath("/html/body/div[1]/div/div[4]/div/div[4]/div/div[2]/div/div[2]/div/div[4]/div/div[2]/div/div/div/table/tbody[1]/tr[1]/td/div/div"));
  84.         inboxKeyABV.click();
  85.  
  86.  
  87.     }
  88.  
  89.     @After
  90.     public void EndTesting(){
  91.  
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement