Skip to content
Snippets Groups Projects
Commit 3ce3a7ce authored by jkraehemann's avatar jkraehemann
Browse files

OO-296: Fixed filling in tags in wizard of adding artefacts to eportfolio....

OO-296: Fixed filling in tags in wizard of adding artefacts to eportfolio. Fixed functional methods to work with firefox.
parent a0e5bf3e
No related branches found
No related tags found
No related merge requests found
Showing
with 372 additions and 35 deletions
...@@ -33,6 +33,7 @@ import org.jboss.arquillian.test.api.ArquillianResource; ...@@ -33,6 +33,7 @@ import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.olat.restapi.support.vo.CourseVO; import org.olat.restapi.support.vo.CourseVO;
...@@ -61,7 +62,7 @@ public class FunctionalArtefactTest { ...@@ -61,7 +62,7 @@ public class FunctionalArtefactTest {
public final static String FORUM_POST_MESSAGE = "What multiplexing exists in operating systems?"; public final static String FORUM_POST_MESSAGE = "What multiplexing exists in operating systems?";
public final static String FORUM_ARTEFACT_TITLE = "multiplexing forum post"; public final static String FORUM_ARTEFACT_TITLE = "multiplexing forum post";
public final static String FORUM_ARTEFACT_DESCRIPTION = "Thread about multiplexing."; public final static String FORUM_ARTEFACT_DESCRIPTION = "Thread about multiplexing.";
public final static String FORUM_TAGS = "networking multiplexing operating systems virtual machine forum post"; public final static String[] FORUM_TAGS = {"networking", "multiplexing", "operating systems", "virtual machine", "forum", "post"};
public final static String FORUM_BINDER = BINDER_PROGRAMMING_THEORIE; public final static String FORUM_BINDER = BINDER_PROGRAMMING_THEORIE;
public final static String FORUM_PAGE = "operating systems"; public final static String FORUM_PAGE = "operating systems";
public final static String FORUM_STRUCTURE = "issue 1"; public final static String FORUM_STRUCTURE = "issue 1";
...@@ -70,7 +71,7 @@ public class FunctionalArtefactTest { ...@@ -70,7 +71,7 @@ public class FunctionalArtefactTest {
public final static String WIKI_ARTICLE_CONTENT = "==Time Multiplexing==\nscheduling a serially-reusable resource among several users\n\n==Space multiplexing==\ndividing a multiple-use resource up among several users"; public final static String WIKI_ARTICLE_CONTENT = "==Time Multiplexing==\nscheduling a serially-reusable resource among several users\n\n==Space multiplexing==\ndividing a multiple-use resource up among several users";
public final static String WIKI_ARTEFACT_TITLE = "multiplexing wiki"; public final static String WIKI_ARTEFACT_TITLE = "multiplexing wiki";
public final static String WIKI_ARTEFACT_DESCRIPTION = "wiki page about multiplexing"; public final static String WIKI_ARTEFACT_DESCRIPTION = "wiki page about multiplexing";
public final static String WIKI_TAGS = "networking multiplexing operating systems virtual machine wiki"; public final static String[] WIKI_TAGS = {"networking", "multiplexing", "operating systems", "virtual machine", "wiki"};
public final static String WIKI_BINDER = BINDER_PROGRAMMING_THEORIE; public final static String WIKI_BINDER = BINDER_PROGRAMMING_THEORIE;
public final static String WIKI_PAGE = "operating systems"; public final static String WIKI_PAGE = "operating systems";
public final static String WIKI_STRUCTURE = "issue 2"; public final static String WIKI_STRUCTURE = "issue 2";
...@@ -82,7 +83,7 @@ public class FunctionalArtefactTest { ...@@ -82,7 +83,7 @@ public class FunctionalArtefactTest {
public final static String BLOG_POST_CONTENT = "Operating Systems: Design & Implementation (by Andrew S. Tanenbaum)"; public final static String BLOG_POST_CONTENT = "Operating Systems: Design & Implementation (by Andrew S. Tanenbaum)";
public final static String BLOG_ARTEFACT_TITLE = "blog"; public final static String BLOG_ARTEFACT_TITLE = "blog";
public final static String BLOG_ARTEFACT_DESCRIPTION = "my personal blog"; public final static String BLOG_ARTEFACT_DESCRIPTION = "my personal blog";
public final static String BLOG_TAGS = "john smith blog"; public final static String[] BLOG_TAGS = {"john smith", "blog"};
public final static String BLOG_BINDER = BINDER_PROGRAMMING_THEORIE; public final static String BLOG_BINDER = BINDER_PROGRAMMING_THEORIE;
public final static String BLOG_PAGE = "operating systems"; public final static String BLOG_PAGE = "operating systems";
public final static String BLOG_STRUCTURE = "issue 3"; public final static String BLOG_STRUCTURE = "issue 3";
...@@ -90,7 +91,7 @@ public class FunctionalArtefactTest { ...@@ -90,7 +91,7 @@ public class FunctionalArtefactTest {
public final static String TEXT_ARTEFACT_CONTENT = "Bufferbloat is a phenomenon in a packet-switched computer network whereby excess buffering of packets inside the network causes high latency and jitter, as well as reducing the overall network throughput."; public final static String TEXT_ARTEFACT_CONTENT = "Bufferbloat is a phenomenon in a packet-switched computer network whereby excess buffering of packets inside the network causes high latency and jitter, as well as reducing the overall network throughput.";
public final static String TEXT_ARTEFACT_TITLE = "Definition bufferbloat"; public final static String TEXT_ARTEFACT_TITLE = "Definition bufferbloat";
public final static String TEXT_ARTEFACT_DESCRIPTION = "Definition bufferbloat"; public final static String TEXT_ARTEFACT_DESCRIPTION = "Definition bufferbloat";
public final static String TEXT_ARTEFACT_TAGS = "bufferbloat network latency jitter"; public final static String[] TEXT_ARTEFACT_TAGS = {"bufferbloat", "network", "latency", "jitter"};
public final static String TEXT_ARTEFACT_BINDER = BINDER_PROGRAMMING_THEORIE; public final static String TEXT_ARTEFACT_BINDER = BINDER_PROGRAMMING_THEORIE;
public final static String TEXT_ARTEFACT_PAGE = "networking"; public final static String TEXT_ARTEFACT_PAGE = "networking";
public final static String TEXT_ARTEFACT_STRUCTURE = "issue 1"; public final static String TEXT_ARTEFACT_STRUCTURE = "issue 1";
...@@ -98,14 +99,14 @@ public class FunctionalArtefactTest { ...@@ -98,14 +99,14 @@ public class FunctionalArtefactTest {
public final static String FILE_ARTEFACT_PATH = "/org/olat/portfolio/sfqcodel.cc"; public final static String FILE_ARTEFACT_PATH = "/org/olat/portfolio/sfqcodel.cc";
public final static String FILE_ARTEFACT_TITLE = "CoDel"; public final static String FILE_ARTEFACT_TITLE = "CoDel";
public final static String FILE_ARTEFACT_DESCRIPTION = "CoDel Algorithm"; public final static String FILE_ARTEFACT_DESCRIPTION = "CoDel Algorithm";
public final static String FILE_ARTEFACT_TAGS = "codel"; public final static String[] FILE_ARTEFACT_TAGS = {"codel", "sample code"};
public final static String FILE_ARTEFACT_BINDER = BINDER_PROGRAMMING_SAMPLES; public final static String FILE_ARTEFACT_BINDER = BINDER_PROGRAMMING_SAMPLES;
public final static String FILE_ARTEFACT_PAGE = "cpp"; public final static String FILE_ARTEFACT_PAGE = "cpp";
public final static String FILE_ARTEFACT_STRUCTURE = "issue 1"; public final static String FILE_ARTEFACT_STRUCTURE = "issue 1";
public final static String LEARNING_JOURNAL_TITLE = "Programming Topics"; public final static String LEARNING_JOURNAL_TITLE = "Programming Topics";
public final static String LEARNING_JOURNAL_DESCRIPTION = "Some hot programming topics"; public final static String LEARNING_JOURNAL_DESCRIPTION = "Some hot programming topics";
public final static String LEARNING_JOURNAL_TAGS = "programming c c++"; public final static String[] LEARNING_JOURNAL_TAGS = {"programming", "c", "c++"};
public final static String LEARNING_JOURNAL_BINDER = BINDER_PROGRAMMING_THEORIE; public final static String LEARNING_JOURNAL_BINDER = BINDER_PROGRAMMING_THEORIE;
public final static String LEARNING_JOURNAL_PAGE = "journal"; public final static String LEARNING_JOURNAL_PAGE = "journal";
public final static String LEARNING_JOURNAL_STRUCTURE = "2012/08/13"; public final static String LEARNING_JOURNAL_STRUCTURE = "2012/08/13";
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.util;
import com.thoughtworks.selenium.Selenium;
/**
*
* @author jkraehemann, joel.kraehemann@frentix.com, frentix.com
*/
public class FunctionalAdministrationSiteUtil {
public enum AdministrationSiteAction {
SYSTEM_ADMINISTRATION,
ADVANCED_PROPERTIES,
BOOKINGS
}
private FunctionalUtil functionalUtil;
public FunctionalAdministrationSiteUtil(FunctionalUtil functionalUtil){
this.functionalUtil = functionalUtil;
}
/**
* @param browser
* @param action
* @return true on success otherwise false
*
* Browse the administrations site's navigation.
*/
public boolean openActionByMenuTree(Selenium browser, Object action){
//TODO:JK: implement me
return(false);
}
public FunctionalUtil getFunctionalUtil() {
return functionalUtil;
}
public void setFunctionalUtil(FunctionalUtil functionalUtil) {
this.functionalUtil = functionalUtil;
}
}
...@@ -141,7 +141,7 @@ public class FunctionalCourseUtil { ...@@ -141,7 +141,7 @@ public class FunctionalCourseUtil {
* button. * button.
*/ */
public boolean addToEportfolio(Selenium browser, String binder, String page, String structure, public boolean addToEportfolio(Selenium browser, String binder, String page, String structure,
String title, String description, String tags, String title, String description, String[] tags,
FunctionalEPortfolioUtil functionalEPortfolioUtil){ FunctionalEPortfolioUtil functionalEPortfolioUtil){
/* open wizard */ /* open wizard */
......
...@@ -31,6 +31,7 @@ import org.apache.velocity.exception.ParseErrorException; ...@@ -31,6 +31,7 @@ import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.exception.ResourceNotFoundException;
import org.olat.util.FunctionalHomeSiteUtil.EPortfolioAction; import org.olat.util.FunctionalHomeSiteUtil.EPortfolioAction;
import org.olat.util.FunctionalUtil.OlatSite; import org.olat.util.FunctionalUtil.OlatSite;
import org.openqa.selenium.Keys;
import com.thoughtworks.selenium.Selenium; import com.thoughtworks.selenium.Selenium;
...@@ -604,14 +605,38 @@ public class FunctionalEPortfolioUtil { ...@@ -604,14 +605,38 @@ public class FunctionalEPortfolioUtil {
* *
* Fills in the open wizard's tags. * Fills in the open wizard's tags.
*/ */
protected boolean fillInTags(Selenium browser, String tags){ protected boolean fillInTags(Selenium browser, String[] tags){
StringBuffer locatorBuffer = new StringBuffer(); int i = 1;
locatorBuffer.append("xpath=//form//div[contains(@class, '")
.append(functionalUtil.getWizardCss())
.append("')]//input[@type='text']");
browser.type(locatorBuffer.toString(), tags); for(String tag: tags){
StringBuffer locatorBuffer = new StringBuffer();
locatorBuffer.append("xpath=(//form//div[contains(@class, '")
.append(functionalUtil.getWizardCss())
.append("')]//input[@type='text'])[" + i + "]");
functionalUtil.waitForPageToLoadElement(browser, locatorBuffer.toString());
browser.focus(locatorBuffer.toString());
// for(char c: (tag + ",").toCharArray()){
// browser.focus(locatorBuffer.toString());
// browser.keyDown(locatorBuffer.toString(), String.valueOf(c));
// browser.focus(locatorBuffer.toString());
// browser.keyPress(locatorBuffer.toString(), String.valueOf(c));
// browser.focus(locatorBuffer.toString());
// browser.keyUp(locatorBuffer.toString(), String.valueOf(c));
// }
browser.type(locatorBuffer.toString(), tag);
browser.focus(locatorBuffer.toString());
browser.fireEvent(locatorBuffer.toString(), "changed");
browser.keyDown(locatorBuffer.toString(), ","); //TODO:JK: "13" is really ugly way to press enter
browser.keyPress(locatorBuffer.toString(), ","); //TODO:JK: "13" is really ugly way to press enter
browser.keyUp(locatorBuffer.toString(), ","); //TODO:JK: "13" is really ugly way to press enter
browser.fireEvent(locatorBuffer.toString(), "changed");
browser.fireEvent(locatorBuffer.toString(), "blur");
i++;
}
functionalUtil.clickWizardNext(browser); functionalUtil.clickWizardNext(browser);
...@@ -629,7 +654,7 @@ public class FunctionalEPortfolioUtil { ...@@ -629,7 +654,7 @@ public class FunctionalEPortfolioUtil {
* Add a text artefact to a e-portfolio. * Add a text artefact to a e-portfolio.
*/ */
public boolean addTextArtefact(Selenium browser, String binder, String page, String structure, public boolean addTextArtefact(Selenium browser, String binder, String page, String structure,
String content, String title, String description, String tags){ String content, String title, String description, String[] tags){
/* create binder, page or structure if necessary */ /* create binder, page or structure if necessary */
if(!createElements(browser, binder, page, structure)) if(!createElements(browser, binder, page, structure))
return(false); return(false);
...@@ -693,7 +718,7 @@ public class FunctionalEPortfolioUtil { ...@@ -693,7 +718,7 @@ public class FunctionalEPortfolioUtil {
* Upload a file artefact to a e-portfolio. * Upload a file artefact to a e-portfolio.
*/ */
public boolean uploadFileArtefact(Selenium browser, String binder, String page, String structure, public boolean uploadFileArtefact(Selenium browser, String binder, String page, String structure,
URI file, String title, String description, String tags) throws MalformedURLException{ URI file, String title, String description, String[] tags) throws MalformedURLException{
if(!createElements(browser, binder, page, structure)) if(!createElements(browser, binder, page, structure))
return(false); return(false);
...@@ -723,6 +748,7 @@ public class FunctionalEPortfolioUtil { ...@@ -723,6 +748,7 @@ public class FunctionalEPortfolioUtil {
.append(functionalUtil.getWizardCss()) .append(functionalUtil.getWizardCss())
.append("')]//input[@type='file']"); .append("')]//input[@type='file']");
browser.focus(locatorBuffer.toString());
browser.type(locatorBuffer.toString(), file.toURL().getPath()); browser.type(locatorBuffer.toString(), file.toURL().getPath());
//browser.attachFile(locatorBuffer.toString(), file.toURL().toString()); //browser.attachFile(locatorBuffer.toString(), file.toURL().toString());
...@@ -767,7 +793,7 @@ public class FunctionalEPortfolioUtil { ...@@ -767,7 +793,7 @@ public class FunctionalEPortfolioUtil {
* Create a learnig journal for a e-portfolio. * Create a learnig journal for a e-portfolio.
*/ */
public boolean createLearningJournal(Selenium browser, String binder, String page, String structure, public boolean createLearningJournal(Selenium browser, String binder, String page, String structure,
String title, String description, String tags){ String title, String description, String[] tags){
if(!createElements(browser, binder, page, structure)) if(!createElements(browser, binder, page, structure))
return(false); return(false);
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.util;
import com.thoughtworks.selenium.Selenium;
/**
*
* @author jkraehemann, joel.kraehemann@frentix.com, frentix.com
*/
public class FunctionalGroupsSiteUtil {
public enum GroupsSiteAction {
MY_GROUPS,
PUBLISHED_GROUPS,
GROUPS_ADMINISTRATION
}
private FunctionalUtil functionalUtil;
public FunctionalGroupsSiteUtil(FunctionalUtil functionalUtil){
this.functionalUtil = functionalUtil;
}
/**
* @param browser
* @param action
* @return true on success otherwise false
*
* Browse the groups site's navigation.
*/
public boolean openActionByMenuTree(Selenium browser, Object action){
//TODO:JK: implement me
return(false);
}
public FunctionalUtil getFunctionalUtil() {
return functionalUtil;
}
public void setFunctionalUtil(FunctionalUtil functionalUtil) {
this.functionalUtil = functionalUtil;
}
}
...@@ -548,22 +548,22 @@ public class FunctionalHomeSiteUtil { ...@@ -548,22 +548,22 @@ public class FunctionalHomeSiteUtil {
} }
if(!checkCurrentAction || !checkCurrentAction(browser, action, 15000)){ if(!checkCurrentAction || !checkCurrentAction(browser, action, 15000)){
if(action instanceof EPortfolioAction){ StringBuffer selectorBuffer = new StringBuffer();
StringBuffer selectorBuffer = new StringBuffer();
selectorBuffer.append("xpath=//ul//li[contains(@class, '")
.append(selectedCss)
.append("')]//a");
if(action instanceof EPortfolioAction && !browser.isElementPresent(selectorBuffer.toString())){
StringBuffer actionSelectorBuffer = new StringBuffer();
selectorBuffer.append("xpath=//ul//div[@id='") actionSelectorBuffer.append("xpath=//ul//div[@id='")
.append(getEPortfolioParentId()) .append(getEPortfolioParentId())
.append("']//a"); .append("']//a");
browser.click(selectorBuffer.toString()); browser.click(actionSelectorBuffer.toString());
browser.waitForPageToLoad(functionalUtil.getWaitLimit()); browser.waitForPageToLoad(functionalUtil.getWaitLimit());
} }
StringBuffer selectorBuffer = new StringBuffer();
selectorBuffer.append("xpath=//ul//li[contains(@class, '")
.append(selectedCss)
.append("')]//a");
browser.click(selectorBuffer.toString()); browser.click(selectorBuffer.toString());
browser.waitForPageToLoad(functionalUtil.getWaitLimit()); browser.waitForPageToLoad(functionalUtil.getWaitLimit());
......
...@@ -345,7 +345,7 @@ public class FunctionalRepositorySiteUtil { ...@@ -345,7 +345,7 @@ public class FunctionalRepositorySiteUtil {
* *
* Browse the learning resources site's navigation. * Browse the learning resources site's navigation.
*/ */
public boolean activateMenuTreeAction(Selenium browser, Object action){ //activateMenuTreeAction(browser, action) public boolean openActionByMenuTree(Selenium browser, Object action){ //activateMenuTreeAction(browser, action)
String selectedCss = findCssClassOfAction(action); String selectedCss = findCssClassOfAction(action);
if(selectedCss == null){ if(selectedCss == null){
...@@ -389,7 +389,7 @@ public class FunctionalRepositorySiteUtil { ...@@ -389,7 +389,7 @@ public class FunctionalRepositorySiteUtil {
if(!functionalUtil.openSite(browser, OlatSite.LEARNING_RESOURCES)) if(!functionalUtil.openSite(browser, OlatSite.LEARNING_RESOURCES))
return(false); return(false);
if(!activateMenuTreeAction(browser, RepositorySiteAction.SEARCH_FORM)) if(!openActionByMenuTree(browser, RepositorySiteAction.SEARCH_FORM))
return(false); return(false);
//FIXME:JK: use CSS classes instead of ordinal //FIXME:JK: use CSS classes instead of ordinal
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.util;
import com.thoughtworks.selenium.Selenium;
/**
*
* @author jkraehemann, joel.kraehemann@frentix.com, frentix.com
*/
public class FunctionalUserManagementSiteUtil {
public enum UserManagementSiteAction {
USER_SEARCH,
CREATE_USER,
IMPORT_USER,
DELETE_USER,
DELETE_USER_IMMEDIATELY
}
private FunctionalUtil functionalUtil;
public FunctionalUserManagementSiteUtil(FunctionalUtil functionalUtil){
this.functionalUtil = functionalUtil;
}
/**
* @param browser
* @param action
* @return true on success otherwise false
*
* Browse the learning resources site's navigation.
*/
public boolean openActionByMenuTree(Selenium browser, Object action){
//TODO:JK: implement me
return(false);
}
public FunctionalUtil getFunctionalUtil() {
return functionalUtil;
}
public void setFunctionalUtil(FunctionalUtil functionalUtil) {
this.functionalUtil = functionalUtil;
}
}
...@@ -26,6 +26,12 @@ import java.util.Properties; ...@@ -26,6 +26,12 @@ import java.util.Properties;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.util.FunctionalAdministrationSiteUtil.AdministrationSiteAction;
import org.olat.util.FunctionalGroupsSiteUtil.GroupsSiteAction;
import org.olat.util.FunctionalHomeSiteUtil.HomeSiteAction;
import org.olat.util.FunctionalRepositorySiteUtil.RepositorySiteAction;
import org.olat.util.FunctionalUserManagementSiteUtil.UserManagementSiteAction;
import org.springframework.beans.factory.annotation.Autowired;
import com.thoughtworks.selenium.Selenium; import com.thoughtworks.selenium.Selenium;
...@@ -112,6 +118,13 @@ public class FunctionalUtil { ...@@ -112,6 +118,13 @@ public class FunctionalUtil {
private String mceContentBodyCss; private String mceContentBodyCss;
private FunctionalHomeSiteUtil functionalHomeSiteUtil;
private FunctionalGroupsSiteUtil functionalGroupsSiteUtil;
private FunctionalRepositorySiteUtil functionalRepositorySiteUtil;
private FunctionalUserManagementSiteUtil functionalUserManagementSiteUtil;
private FunctionalAdministrationSiteUtil functionalAdministrationSiteUtil;
public FunctionalUtil(){ public FunctionalUtil(){
Properties properties = new Properties(); Properties properties = new Properties();
...@@ -126,7 +139,7 @@ public class FunctionalUtil { ...@@ -126,7 +139,7 @@ public class FunctionalUtil {
username = "administrator"; username = "administrator";
password = "openolat"; password = "openolat";
// TODO Auto-generated catch block //TODO:JK: Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
...@@ -161,6 +174,12 @@ public class FunctionalUtil { ...@@ -161,6 +174,12 @@ public class FunctionalUtil {
wizardFinishCss = WIZARD_FINISH_CSS; wizardFinishCss = WIZARD_FINISH_CSS;
mceContentBodyCss = MCE_CONTENT_BODY_CSS; mceContentBodyCss = MCE_CONTENT_BODY_CSS;
functionalHomeSiteUtil = new FunctionalHomeSiteUtil(this);
functionalGroupsSiteUtil = new FunctionalGroupsSiteUtil(this);
functionalRepositorySiteUtil = new FunctionalRepositorySiteUtil(this);
functionalUserManagementSiteUtil = new FunctionalUserManagementSiteUtil(this);
functionalAdministrationSiteUtil = new FunctionalAdministrationSiteUtil(this);
} }
/** /**
...@@ -318,6 +337,54 @@ public class FunctionalUtil { ...@@ -318,6 +337,54 @@ public class FunctionalUtil {
return(false); return(false);
} }
/**
* @param browser
* @param site
* @return true on success
*
* Clicks the appropriate action on a site that it would be
* on it's initial state i.e. it looks like the user wouldn't
* have visited site before.
*/
private boolean resetSite(Selenium browser, OlatSite site){
boolean retval = false;
switch(site){
case HOME:
{
retval = functionalHomeSiteUtil.openActionByMenuTree(browser, HomeSiteAction.PORTAL);
}
break;
case GROUPS:
{
retval = functionalGroupsSiteUtil.openActionByMenuTree(browser, GroupsSiteAction.MY_GROUPS);
}
break;
case LEARNING_RESOURCES:
{
retval = functionalRepositorySiteUtil.openActionByMenuTree(browser, RepositorySiteAction.MY_ENTRIES);
}
break;
case USER_MANAGEMENT:
{
retval = functionalUserManagementSiteUtil.openActionByMenuTree(browser, UserManagementSiteAction.USER_SEARCH);
}
break;
case GROUP_ADMINISTRATION:
{
//FIXME:JK: need to be implemented
}
break;
case ADMINISTRATION:
{
retval = functionalAdministrationSiteUtil.openActionByMenuTree(browser, AdministrationSiteAction.SYSTEM_ADMINISTRATION);
}
break;
}
return(retval);
}
/** /**
* @param browser * @param browser
* @param site * @param site
...@@ -333,9 +400,14 @@ public class FunctionalUtil { ...@@ -333,9 +400,14 @@ public class FunctionalUtil {
} }
if(checkCurrentSite(browser, site, 15000)){ if(checkCurrentSite(browser, site, 15000)){
return(true); if(resetSite(browser, site)){
return(true);
}else{
return(false);
}
} }
/* open the appropriate site */
StringBuilder selectorBuffer = new StringBuilder(); StringBuilder selectorBuffer = new StringBuilder();
selectorBuffer.append("css=.") selectorBuffer.append("css=.")
...@@ -348,6 +420,9 @@ public class FunctionalUtil { ...@@ -348,6 +420,9 @@ public class FunctionalUtil {
browser.waitForPageToLoad(getWaitLimit()); browser.waitForPageToLoad(getWaitLimit());
waitForPageToLoadElement(browser, selectorBuffer.toString()); waitForPageToLoadElement(browser, selectorBuffer.toString());
/* set it to it's initial state */
resetSite(browser, site);
return(true); return(true);
} }
...@@ -691,9 +766,9 @@ public class FunctionalUtil { ...@@ -691,9 +766,9 @@ public class FunctionalUtil {
public boolean clickWizardFinish(Selenium browser){ public boolean clickWizardFinish(Selenium browser){
StringBuffer locatorBuffer = new StringBuffer(); StringBuffer locatorBuffer = new StringBuffer();
locatorBuffer.append("xpath=//form//a[contains(@class, ") locatorBuffer.append("xpath=//form//a[contains(@class, '")
.append(getWizardFinishCss()) .append(getWizardFinishCss())
.append(")]"); .append("')]");
browser.click(locatorBuffer.toString()); browser.click(locatorBuffer.toString());
...@@ -892,4 +967,49 @@ public class FunctionalUtil { ...@@ -892,4 +967,49 @@ public class FunctionalUtil {
public void setMceContentBodyCss(String mceContentBodyCss) { public void setMceContentBodyCss(String mceContentBodyCss) {
this.mceContentBodyCss = mceContentBodyCss; this.mceContentBodyCss = mceContentBodyCss;
} }
public FunctionalHomeSiteUtil getFunctionalHomeSiteUtil() {
return functionalHomeSiteUtil;
}
public void setFunctionalHomeSiteUtil(
FunctionalHomeSiteUtil functionalHomeSiteUtil) {
this.functionalHomeSiteUtil = functionalHomeSiteUtil;
}
public FunctionalGroupsSiteUtil getFunctionalGroupsSiteUtil() {
return functionalGroupsSiteUtil;
}
public void setFunctionalGroupsSiteUtil(
FunctionalGroupsSiteUtil functionalGroupsSiteUtil) {
this.functionalGroupsSiteUtil = functionalGroupsSiteUtil;
}
public FunctionalRepositorySiteUtil getFunctionalRepositorySiteUtil() {
return functionalRepositorySiteUtil;
}
public void setFunctionalRepositorySiteUtil(
FunctionalRepositorySiteUtil functionalRepositorySiteUtil) {
this.functionalRepositorySiteUtil = functionalRepositorySiteUtil;
}
public FunctionalUserManagementSiteUtil getFunctionalUserManagementSiteUtil() {
return functionalUserManagementSiteUtil;
}
public void setFunctionalUserManagementSiteUtil(
FunctionalUserManagementSiteUtil functionalUserManagementSiteUtil) {
this.functionalUserManagementSiteUtil = functionalUserManagementSiteUtil;
}
public FunctionalAdministrationSiteUtil getFunctionalAdministrationSiteUtil() {
return functionalAdministrationSiteUtil;
}
public void setFunctionalAdministrationSiteUtil(
FunctionalAdministrationSiteUtil functionalAdministrationSiteUtil) {
this.functionalAdministrationSiteUtil = functionalAdministrationSiteUtil;
}
} }
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
<configuration> <configuration>
<property name="workDir">target/arquillianDeployments</property> <property name="workDir">target/arquillianDeployments</property>
<property name="catalinaHome">target/arq-apache-tomcat-7.0.27</property> <property name="catalinaHome">target/arq-apache-tomcat-7.0.27</property>
<property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</property> <!-- <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</property> -->
</configuration> </configuration>
</container> </container>
<extension qualifier="selenium"> <extension qualifier="selenium">
<property name="browser">*googlechrome</property> <property name="browserCapabilities">firefox</property>
<property name="capabilityWebdriverFirefoxBin">/Applications/Firefox.app/Contents/MacOS/firefox-bin</property>
<!-- <property name="browser">*googlechrome</property> -->
</extension> </extension>
</arquillian> </arquillian>
\ No newline at end of file
File added
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