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.SeleneseTestBase;
19  import edu.samplu.common.Failable;
20  import edu.samplu.common.ITUtil;
21  import edu.samplu.common.WebDriverLegacyITBase;
22  
23  
24  
25  
26  
27  
28  public abstract class DirtyFieldsAbstractSmokeTestBase extends WebDriverLegacyITBase {
29  
30      
31  
32  
33      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
34  
35      protected void bookmark() {
36          open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
37      }
38  
39      
40  
41  
42  
43  
44  
45      @Override
46      public String getTestUrl() {
47          return ITUtil.PORTAL;
48      }
49  
50      protected void navigation() throws InterruptedException {
51          waitAndClickKRAD();
52          waitAndClickByLinkText(UIF_COMPONENTS_KITCHEN_SINK_LINK_TEXT);
53          switchToWindow(KUALI_UIF_COMPONENTS_WINDOW_XPATH);
54      }
55  
56      protected void testDirtyFieldsCheckNav(Failable failable) throws Exception {
57          navigation();
58          testDirtyFieldsCheck();
59          passed();
60      }
61  
62      protected void testDirtyFieldsCheckBookmark(Failable failable) throws Exception {
63          testDirtyFieldsCheck();
64          passed();
65      }
66  
67  
68      protected void testDirtyFieldsCheck() throws Exception {
69          checkForIncidentReport(getTestUrl());
70          waitAndClickByLinkText("Text Controls");
71          waitAndTypeByName("field1", "test 1");
72          waitAndTypeByName("field102", "test 2");
73          assertCancelConfirmation();
74  
75          
76          waitForElementPresentByName("field100");
77          waitAndTypeByName("field100", "here");
78          waitAndTypeByName("field103", "there");
79  
80          
81          assertCancelConfirmation();
82  
83          
84          waitForElementPresentByName("field106");
85  
86          
87          
88          SeleneseTestBase.assertTrue(waitAndGetAttributeByName("field112", "style").contains("text-transform: uppercase;"));
89          assertCancelConfirmation();
90          waitForElementPresentByName("field101");
91          SeleneseTestBase.assertEquals("val", waitAndGetAttributeByName("field101", "value"));
92          clearTextByName("field101");
93          waitAndTypeByName("field101", "1");
94          waitAndTypeByName("field104", "");
95          SeleneseTestBase.assertEquals("1", waitAndGetAttributeByName("field101", "value"));
96          waitAndTypeByName("field104", "2");
97  
98          
99          assertCancelConfirmation();
100     }
101 }