Advertisement
Guest User

Untitled

a guest
Aug 12th, 2015
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 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. import java.util.concurrent.TimeUnit;
  10.  
  11. import static org.junit.Assert.assertEquals;
  12.  
  13. /**
  14.  * Created by kokoshkata on 10.08.2015.
  15.  */
  16. public class AbvTest {
  17.     private WebDriver firefoxDriver;
  18.  
  19.     @Before
  20.     public void setUp() {
  21.         firefoxDriver = new FirefoxDriver();
  22.         firefoxDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  23.     }
  24.  
  25.  
  26.     @Test
  27.     public void TestLogin_ValidCredentials_ShouldLoginCorrectly() {
  28.         firefoxDriver.get("http://abv.bg");
  29.  
  30.         String validUserName = "qatester";
  31.         String validPassword = "ceca12345";
  32.  
  33.         WebElement usernameField = firefoxDriver.findElement(By.id("username"));
  34.         WebElement passwordField = firefoxDriver.findElement(By.id("password"));
  35.  
  36.         usernameField.clear();
  37.         usernameField.sendKeys(validUserName);
  38.  
  39.         passwordField.clear();
  40.         passwordField.sendKeys(validPassword);
  41.  
  42.         WebElement loginButtonField = firefoxDriver.findElement(By.id("loginBut"));
  43.  
  44.  
  45.         loginButtonField.click();
  46.         assertEquals("https://nm50.abv.bg/Mail.html", firefoxDriver.getCurrentUrl());
  47.  
  48.         String validFullName = "Камен Дамянов";
  49.  
  50.         WebElement fullName = By.id("validFullName").findElement(firefoxDriver);
  51.         assertEquals("Камен Дамянов", fullName.getText());
  52.  
  53.     }
  54.  
  55.     @After
  56.     public void terDown() {
  57.  
  58.  
  59.     }
  60.  
  61.  
  62.  
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement