1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.common;
17
18 import org.junit.Test;
19 import org.openqa.selenium.By;
20
21 import static org.junit.Assert.assertEquals;
22
23
24
25
26
27
28
29 public abstract class AdminMenuBlanketAppLegacyITBase extends MenuLegacyITBase{
30
31
32
33
34
35 public abstract String blanketApprove() throws Exception;
36
37 @Override
38 protected String getMenuLinkLocator() {
39 return AdminMenuLegacyITBase.ADMIN_LOCATOR;
40 }
41
42 @Override
43 protected String getCreateNewLinkLocator() {
44 return AdminMenuLegacyITBase.CREATE_NEW_LOCATOR;
45 }
46
47 @Test
48 public void testBlanketApprove() throws Exception {
49 gotoCreateNew();
50 String docId = blanketApprove();
51 blanketApproveTest();
52 assertDocFinal(docId);
53 passed();
54 }
55
56 protected void assertBlanketApproveButtonsPresent() {
57 assertElementPresentByName("methodToCall.route");
58 assertElementPresentByName("methodToCall.save");
59 assertElementPresentByName("methodToCall.blanketApprove", "Blanket Approve botton not present does " + user + " have permssion?");
60 assertElementPresentByName("methodToCall.close");
61 assertElementPresentByName("methodToCall.cancel");
62 }
63
64 protected void assertDocFinal(String docId) throws InterruptedException {
65 waitFor(By.linkText("spreadsheet"));
66 if(isElementPresent(By.linkText(docId))){
67 assertEquals("FINAL", getDocStatus());
68 }else{
69 assertEquals(docId, driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[1]")));
70 assertEquals("FINAL", getDocStatus());
71 }
72 }
73
74 private String getDocStatus() {
75 return driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[4]")).getText();
76 }
77 }