package net.ihe.xcpd.init.common; import net.ihe.gazelle.common.test.ScreenShootingSelenium; /** * * @author abderrazek boufahja * */ public class CommonMethods { private String adminLogin = "admin"; private String adminPasswd = ""; private ScreenShootingSelenium selenium; private String applicationRoot; private String adminString; private String screenShotsRepositoryPath; public Integer maxRowNumberPerPage = 10; public CommonMethods(){ } /** * Sets all the parameters linked to Selenium screenshoting instance and * path for images, Gazelle administration login and password * * @param selenium * @param applicationRoot * @param adminString * @param adminPasswd * @param screenShotsRepositoryPath */ public void setCommonMethodsParameters(ScreenShootingSelenium selenium, String applicationRoot, String adminString, String adminPasswd, String screenShotsRepositoryPath) { this.selenium = selenium; this.applicationRoot = applicationRoot; this.adminString = adminString; this.adminPasswd = adminPasswd; this.screenShotsRepositoryPath = screenShotsRepositoryPath; this.selenium.setApplicationRoot(this.applicationRoot); } public void loginAsAdmin() throws Exception{ selenium.open("/XCPDINITSimulator/home.seam"); selenium.waitForElement("pageName", 1000L, 5); selenium.click("menuform:menuLoginId"); selenium.type("loginForm:username", TestsParametersConfiguration.xcpdInitAdminLogin); selenium.type("loginForm:password", TestsParametersConfiguration.xcpdInitAdminPasswd); selenium.click("loginForm:submit"); } public void userLogin(String login, String passwd) throws Exception{ selenium.open("/XCPDINITSimulator/home.seam"); selenium.waitForElement("pageName", 1000L, 5); selenium.click("menuform:menuLoginId"); selenium.type("loginForm:username", login); selenium.type("loginForm:password", passwd); selenium.click("loginForm:submit"); } public void userLogout(){ selenium.click("menuform:menuLogoutId"); } }