Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.junit.*;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.firefox.FirefoxDriver;
- import sun.management.snmp.jvminstr.JvmThreadInstanceEntryImpl;
- import java.util.concurrent.TimeUnit;
- import static org.junit.Assert.*;
- /**
- * Created by kokoshkata on 10/6/2015.
- */
- public class JustCodeQASoftUni {
- private WebDriver selenium;
- @Before
- public void setUp(){
- selenium = new FirefoxDriver();
- selenium.manage().window().maximize();
- selenium.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
- }
- @Test
- public void testLogin(){
- selenium.get("http://softuni.bg");
- WebElement loginAvatar = selenium.findElement(By.className("user-avatar"));
- loginAvatar.click();
- assertEquals("https://softuni.bg/login", selenium.getCurrentUrl());
- WebElement loginButton = selenium.findElement(By.id("LoginUserName"));
- loginButton.clear();
- loginButton.click();
- loginButton.sendKeys("testtest".toLowerCase());
- WebElement loginPassword = selenium.findElement(By.id("LoginPassword"));
- loginPassword.clear();
- loginPassword.click();
- loginPassword.sendKeys("testtest".toLowerCase());
- WebElement enterButton = selenium.findElement(By.xpath(("/html/body/div[2]/div[2]/div/div[1]/form/input[4]")));
- enterButton.click();
- assertEquals("https://softuni.bg/users/profile/show", selenium.getCurrentUrl());
- WebElement dropDownName = selenium.findElement(By.xpath("/html/body/div[2]/div[2]/div[1]/div/div[1]/div/div/div[1]/div/div[2]/h2/strong"));
- assertEquals("testtest (testtest)", dropDownName.getText().trim());
- }
- @After
- public void endTest(){
- // selenium.quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement