package
com.softwaretesting_guru.help;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import
org.openqa.selenium.server.SeleniumServer;
import
com.thoughtworks.selenium.DefaultSelenium;
import
com.thoughtworks.selenium.SeleneseTestCase;
@SuppressWarnings("deprecation")
public class Assertions extends SeleneseTestCase{
@SuppressWarnings("deprecation")
@Before
public void setUp() throws Exception {
//Starting the
server
SeleniumServer
ss=new SeleniumServer();
ss.start();
selenium=new DefaultSelenium("localhost",4444,"firefox","http://www.gmail.com");
selenium.start();
}
@After
public void tearDown() throws Exception {
}
@SuppressWarnings("deprecation")
@Test
public void test() throws InterruptedException
{
selenium.open("/");
selenium.waitForPageToLoad("70000");
Thread.sleep(4000);
selenium.windowMaximize();
//Verifying the
signin button
assertTrue(selenium.isElementPresent("id=signIn"));
//Click on the
signin button
//the below line
will pause for 4000 seconds for each line from here
selenium.setSpeed("4000");
selenium.click("id=signIn");
//Verifying the
warning message displayed when username is not given.
assertEquals("Enter your
email address.",selenium.getText("id=errormsg_0_Email"));
//Verifying whether
the username control is present or not..
assertTrue(selenium.isElementPresent("id=Email"));
//Entering the
username to username field
selenium.type("id=Email","selenium");
//verify whether
entered username has been displayed or not by getting the username
assertEquals("selenium",selenium.getValue("id=Email"));
//Click on sigin
button
selenium.click("id=signIn");
//Verifying the
warning message displayed when password is not given.
assertEquals("Enter your
password.",selenium.getText("id=errormsg_0_Passwd"));
//Verifying whether
the password control is present or not..
assertTrue(selenium.isElementPresent("id=Passwd"));
//Entering the
password to password field
selenium.type("id=Passwd","selenium");
//verify whether
entered password has been displayed or not by getting the password
assertEquals("selenium",selenium.getValue("id=Passwd"));
}
}