1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package edu.samplu.travel.krad.test;
17  
18  import com.thoughtworks.selenium.DefaultSelenium;
19  import com.thoughtworks.selenium.Selenium;
20  import edu.samplu.common.UpgradedSeleniumITBase;
21  import org.junit.After;
22  import org.junit.Before;
23  import org.junit.Test;
24  
25  import static org.junit.Assert.assertEquals;
26  import static org.junit.Assert.assertTrue;
27  
28  
29  
30  
31  
32  
33  public class WatermarkValidationIT extends UpgradedSeleniumITBase {
34      @Override
35      public String getTestUrl() {
36          return PORTAL;
37      }
38  
39      @Test
40      
41  
42  
43  
44      public void testWatermarking() throws Exception {
45  
46  
47  
48  
49  		selenium.click("link=KRAD");
50  		selenium.waitForPageToLoad("50000");
51  		selenium.click("link=Uif Components (Kitchen Sink)");
52  		selenium.waitForPageToLoad("100000");
53  
54          selenium.focus("id=u73_control");
55  		selenium.type("id=u73_control", "something");
56          selenium.focus("id=u103_control");
57          selenium.type("id=u103_control", "something else");
58          assertEquals("something", selenium.getValue("xpath=//*[@id=\"u73_control\"]"));
59  		selenium.chooseCancelOnNextConfirmation();
60          
61  		selenium.click("id=u29");
62  		assertTrue(selenium.getConfirmation().matches("^Form has unsaved data\\. Do you want to leave anyway[\\s\\S]$"));
63      }
64  
65      public void clearText(String field) throws Exception {
66          selenium.focus(field);
67          selenium.type(field, "");  
68          Thread.sleep(100); 
69      }
70  }