Changeset 3592 for devel/testlink/automation/src/test/java/br/gov/serpro/cte/common/BaseTestCase.java
- Timestamp:
- 12/15/10 08:44:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/testlink/automation/src/test/java/br/gov/serpro/cte/common/BaseTestCase.java
r3543 r3592 24 24 */ 25 25 public class BaseTestCase extends SeleneseTestCase { 26 private Properties config; 26 27 private Properties mensagens; 27 28 private Properties campos; … … 30 31 @Before 31 32 public void setUp() throws Exception { 33 this.config = this.load("br/gov/serpro/cte/common/config.properties"); 32 34 this.mensagens = this 33 35 .load("br/gov/serpro/cte/common/mensagens.properties"); 34 36 this.campos = this.load("br/gov/serpro/cte/common/campos.properties"); 35 37 this.valores = this.load("br/gov/serpro/cte/common/valores.properties"); 36 String url = "https://cte.serpro.gov.br";38 String url = getConfig("url"); 37 39 DAOSelenium conn = new DAOSelenium("localhost", 4444, "*firefox", url); 38 40 selenium = conn.newConnection(); 39 41 } 40 42 43 public String getConfig(String key) { 44 return this.config.getProperty(key); 45 } 46 41 47 public String getMensagem(String key) { 42 48 return this.mensagens.getProperty(key); … … 48 54 49 55 public String getCampo(String key, Object... args) { 50 return MessageFormat.format(getCampo( "email.responder.todos"), args);56 return MessageFormat.format(getCampo(key), args); 51 57 } 52 58 … … 67 73 public void login() { 68 74 selenium.open("/login.php"); 69 selenium.type("user", "luiz-fernando.estivalet");70 selenium.type("passwd", "senha");75 selenium.type("user", getConfig("user")); 76 selenium.type("passwd", getConfig("passwd")); 71 77 selenium.click("submitit"); 72 selenium.waitForPageToLoad( "30000");78 selenium.waitForPageToLoad(getConfig("waitPage")); 73 79 } 74 80 … … 78 84 public void logout() { 79 85 selenium.click("logout_id"); 80 selenium.waitForPageToLoad( "30000");86 selenium.waitForPageToLoad(getConfig("waitPage")); 81 87 } 82 88 … … 120 126 public void waitForElement(String element, boolean click) throws Exception { 121 127 for (int second = 0;; second++) { 122 if (second >= 60)128 if (second >= Integer.parseInt(getConfig("timeout"))) 123 129 fail("timeout"); 124 130 try { … … 127 133 } catch (Exception e) { 128 134 } 129 Thread.sleep(100 0);135 Thread.sleep(100); 130 136 } 131 137 if (click) { … … 193 199 194 200 private Object createObject(Constructor<?> constructor, Object[] arguments) { 195 196 System.out.println("Constructor: " + constructor.toString());197 201 Object object = null; 198 202 199 203 try { 200 204 object = constructor.newInstance(arguments); 201 System.out.println("Object: " + object.toString());202 205 return object; 203 206 } catch (InstantiationException e) {
Note: See TracChangeset
for help on using the changeset viewer.