1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.travel.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
27
28
29
30
31
32 public class FiscalOfficerInfoMaintenanceNewIT extends UpgradedSeleniumITBase {
33 @Override
34 public String getTestUrl() {
35 return PORTAL;
36 }
37
38 @Test
39 public void testUntitled() throws Exception {
40 selenium.click("link=KRAD");
41 selenium.waitForPageToLoad("50000");
42 selenium.click("//a[@title='FiscalOfficerInfo Maintenance (New)']");
43 selenium.waitForPageToLoad("50000");
44 selenium.selectFrame("iframeportlet");
45
46 String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
47 selenium.type("//input[@name='document.documentHeader.documentDescription']", "New FO Doc");
48 selenium.type("//input[@name='document.newMaintainableObject.dataObject.id']", "5");
49 selenium.type("//input[@name='document.newMaintainableObject.dataObject.userName']", "Jigar");
50
51
52
53
54
55
56
57
58
59
60
61
62 selenium.click("//button[@value='save']");
63
64 int docIdInt = Integer.valueOf(docId).intValue();
65
66 selenium.waitForPageToLoad("50000");
67 selenium.selectFrame("relative=up");
68 selenium.click("//img[@alt='action list']");
69 selenium.waitForPageToLoad("50000");
70 selenium.selectFrame("iframeportlet");
71 if(selenium.isElementPresent("link=Last")){
72 selenium.click("link=Last");
73 selenium.waitForPageToLoad("50000");
74 selenium.click("link="+docIdInt);
75 } else {
76 selenium.click("link="+docIdInt);
77 }
78
79 Thread.sleep(5000);
80 String[] windowTitles = selenium.getAllWindowTitles();
81 selenium.selectWindow(windowTitles[1]);
82 selenium.windowFocus();
83 assertEquals(windowTitles[1], selenium.getTitle());
84
85
86 selenium.selectFrame("relative=up");
87 selenium.click("//button[@value='submit']");
88 selenium.waitForPageToLoad("50000");
89 selenium.close();
90
91
92
93 selenium.selectWindow("null");
94 selenium.windowFocus();
95 selenium.click("//img[@alt='doc search']");
96 selenium.waitForPageToLoad("50000");
97 assertEquals(windowTitles[0], selenium.getTitle());
98 selenium.selectFrame("iframeportlet");
99 selenium.click("//input[@name='methodToCall.search' and @value='search']");
100 selenium.waitForPageToLoad("50000");
101
102
103
104 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
105 selenium.selectFrame("relative=up");
106 selenium.click("link=Main Menu");
107 selenium.waitForPageToLoad("50000");
108 assertEquals(windowTitles[0], selenium.getTitle());
109 System.out.println("---------------------- :: Test complete :: ----------------------");
110
111
112 }
113 }