Skip to content
Snippets Groups Projects
Commit 15503280 authored by Joël Krähemann's avatar Joël Krähemann
Browse files

OO-348: fixed TestCase.

parent ba228846
No related branches found
No related tags found
No related merge requests found
...@@ -305,7 +305,7 @@ public class FunctionalInstantMessagingTest { ...@@ -305,7 +305,7 @@ public class FunctionalInstantMessagingTest {
return(false); return(false);
} }
}else if(conversationPartner instanceof GroupVO){ }else if(conversationPartner instanceof GroupVO){
if(!functionalInstantMessagingUtil.sendMessageToGroup(browser, if(!functionalGroupsSiteUtil.sendMessageToGroup(browser,
((GroupVO) conversationPartner).getName(), ((GroupVO) conversationPartner).getName(),
message)){ message)){
return(false); return(false);
......
...@@ -26,7 +26,7 @@ if(document.querySelector){ ...@@ -26,7 +26,7 @@ if(document.querySelector){
} }
} }
offset = (i - 2) - (item.length - 1); offset = (i + 1) / 2 - (item.length - 1) - 1;
} }
offset; offset;
...@@ -885,6 +885,8 @@ public class FunctionalCourseUtil { ...@@ -885,6 +885,8 @@ public class FunctionalCourseUtil {
return(null); return(null);
} }
functionalUtil.idle(browser);
/* /*
* Determine best matching item by using regular expressions * Determine best matching item by using regular expressions
*/ */
...@@ -903,6 +905,12 @@ public class FunctionalCourseUtil { ...@@ -903,6 +905,12 @@ public class FunctionalCourseUtil {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
Integer offset = null; Integer offset = null;
StringBuffer locatorBuffer = new StringBuffer();
locatorBuffer.append("xpath=")
.append(itemLocator.toString());
functionalUtil.waitForPageToLoadElement(browser, locatorBuffer.toString());
try { try {
engine.evaluate(context, sw, "catalogTreeEntryPosition", FunctionalEPortfolioUtil.class.getResourceAsStream("CatalogTreeEntryPosition.vm")); engine.evaluate(context, sw, "catalogTreeEntryPosition", FunctionalEPortfolioUtil.class.getResourceAsStream("CatalogTreeEntryPosition.vm"));
......
...@@ -237,7 +237,9 @@ public class FunctionalGroupsSiteUtil { ...@@ -237,7 +237,9 @@ public class FunctionalGroupsSiteUtil {
private String groupParticipantsCss; private String groupParticipantsCss;
private String accessControlTokenEntryCss; private String accessControlTokenEntryCss;
private String instantMessagingChatCss;
private FunctionalUtil functionalUtil; private FunctionalUtil functionalUtil;
public FunctionalGroupsSiteUtil(FunctionalUtil functionalUtil){ public FunctionalGroupsSiteUtil(FunctionalUtil functionalUtil){
...@@ -269,6 +271,8 @@ public class FunctionalGroupsSiteUtil { ...@@ -269,6 +271,8 @@ public class FunctionalGroupsSiteUtil {
this.accessControlTokenEntryCss = ACCESS_CONTROL_TOKEN_ENTRY_CSS; this.accessControlTokenEntryCss = ACCESS_CONTROL_TOKEN_ENTRY_CSS;
this.instantMessagingChatCss = FunctionalInstantMessagingUtil.INSTANT_MESSAGING_CHAT_CSS;
this.functionalUtil = functionalUtil; this.functionalUtil = functionalUtil;
} }
...@@ -1037,6 +1041,53 @@ public class FunctionalGroupsSiteUtil { ...@@ -1037,6 +1041,53 @@ public class FunctionalGroupsSiteUtil {
return(true); return(true);
} }
/**
* Opens the chat of the appropriate group.
*
* @param browser
* @param groupName
* @return
*/
public boolean openGroupChat(Selenium browser, String groupName){
if(!openMyGroup(browser, groupName)){
return(false);
}
if(!openActionByMenuTree(browser, GroupsTabAction.CHAT)){
return(false);
}
StringBuffer selectorBuffer = new StringBuffer();
selectorBuffer.append("xpath=//div[contains(@class, '")
.append(functionalUtil.getContentCss())
.append("')]//a[contains(@class, '")
.append(functionalUtil.getButtonCss())
.append("')]");
functionalUtil.waitForPageToUnloadElement(browser, selectorBuffer.toString());
browser.click(selectorBuffer.toString());
return(true);
}
public boolean sendMessageToGroup(Selenium browser, String groupName, String message){
if(!openGroupChat(browser, groupName)){
return(false);
}
StringBuffer selectorBuffer = new StringBuffer();
selectorBuffer.append("xpath=//div[contains(@class, '")
.append(getInstantMessagingChatCss())
.append("')]//input[@type='text']");
functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString());
browser.type(selectorBuffer.toString(), message);
return(true);
}
public FunctionalUtil getFunctionalUtil() { public FunctionalUtil getFunctionalUtil() {
return functionalUtil; return functionalUtil;
} }
...@@ -1198,4 +1249,12 @@ public class FunctionalGroupsSiteUtil { ...@@ -1198,4 +1249,12 @@ public class FunctionalGroupsSiteUtil {
public void setAccessControlTokenEntryCss(String accessControlTokenEntryCss) { public void setAccessControlTokenEntryCss(String accessControlTokenEntryCss) {
this.accessControlTokenEntryCss = accessControlTokenEntryCss; this.accessControlTokenEntryCss = accessControlTokenEntryCss;
} }
public String getInstantMessagingChatCss() {
return instantMessagingChatCss;
}
public void setInstantMessagingChatCss(String instantMessagingChatCss) {
this.instantMessagingChatCss = instantMessagingChatCss;
}
} }
...@@ -425,7 +425,7 @@ public class FunctionalInstantMessagingUtil { ...@@ -425,7 +425,7 @@ public class FunctionalInstantMessagingUtil {
.append(getInstantMessagingGroupCss()) .append(getInstantMessagingGroupCss())
.append("') and text()='") .append("') and text()='")
.append(groupName) .append(groupName)
.append("']"); .append("']//a");
functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString());
browser.click(selectorBuffer.toString()); browser.click(selectorBuffer.toString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment