package test_classes; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; import org.testng.annotations.BeforeMethod; import org.testng.Assert; //import org.testng.AssertJUnit; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import abstract_classes.FrontEnd_BasePage; import qsf_page_object_pattern.FrontEnd.FrontEnd_MyAccountPage; import qsf_page_object_pattern.FrontEnd.FrontEnd_RegistrationPage; import tools.Settings; public class registration_test { private WebDriver driver; private String startUrl; private Settings settings = new Settings(); @BeforeMethod public void SetUp(){ driver = new FirefoxDriver(); /*File file = new File("C:/install/selenium/chromedriver.exe"); System.setProperty("webdriver.chrome.driver", file.getAbsolutePath()); driver = new ChromeDriver();*/ /*File file = new File("C:/install/selenium/IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); WebDriver driver = new InternetExplorerDriver();*/ startUrl = settings.http + ((settings.httpUser != "") ? (settings.httpUser + ":" + settings.httpPassword + "@") : "") + settings.siteUrl; //startUrl = "http://demo2:demo2@demo.adaptainc.com/release4-for-tests/www/admin/"; //startUrl = "http://demo.adaptainc.com/release4-for-tests/www/admin/"; driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.get(startUrl); } @Test public void RegistrationTest(){ FrontEnd_BasePage fe_basePage = new FrontEnd_BasePage(driver); fe_basePage.mouseOver(By.linkText("Log In")); FrontEnd_RegistrationPage fe_registrationPage = fe_basePage.openRegistrationPage(); Map personal = new HashMap(); personal.put("firstName", "Vitaly"); personal.put("lastName", "Povar"); personal.put("phone", "1231231234123"); personal.put("email", "vitaliy.povar2@gmail.com"); personal.put("password", "qwerty"); personal.put("confirmPassword", "qwerty"); Map billing = new HashMap(); billing.put("firstName", "Vitaly1"); billing.put("lastName", "Povar2"); billing.put("address", "1231231234123"); billing.put("city", "Washinghton"); billing.put("state", "DC"); billing.put("zip", "60001"); Map shipping = new HashMap(); shipping.put("firstName", "Vitaly1"); shipping.put("lastName", "Povar2"); shipping.put("address", "1231231234123"); shipping.put("city", "Washinghton"); shipping.put("state", "DC"); shipping.put("zip", "60001"); fe_registrationPage.EnterUserData(personal, billing, shipping); FrontEnd_MyAccountPage fe_myAccountPage = fe_registrationPage.Submit(); Assert.assertTrue (fe_myAccountPage.GetAlertFromDiv().contains("Thank you! Your registration has been successfully completed."), "123"); //fe_basePage.mouseOver("Log In"); } @AfterMethod public void tearDown(){ driver.quit(); //driver.close(); } }