Index: lams_tool_wiki/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/.classpath,v diff -u -r1.5 -r1.6 --- lams_tool_wiki/.classpath 2 Jul 2009 13:02:55 -0000 1.5 +++ lams_tool_wiki/.classpath 13 Jul 2009 04:39:59 -0000 1.6 @@ -1,13 +1,23 @@ + - + + + + + + + + + + Index: lams_tool_wiki/.project =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/.project,v diff -u -r1.1 -r1.2 --- lams_tool_wiki/.project 8 Oct 2008 05:33:01 -0000 1.1 +++ lams_tool_wiki/.project 13 Jul 2009 04:39:59 -0000 1.2 @@ -5,6 +5,41 @@ + + com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator + + + + + com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator + + + + + com.ibm.etools.validation.validationbuilder + + + + + com.ibm.sse.model.structuredbuilder + + + + + com.genuitec.eclipse.hibernate.HibernateBuilder + + + org.eclipse.jdt.core.javanature Index: lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/selenium/TestWiki.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/selenium/Attic/TestWiki.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/selenium/TestWiki.java 13 Jul 2009 04:39:59 -0000 1.1 @@ -0,0 +1,169 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +package org.lamsfoundation.lams.tool.selenium; + +import java.util.Map; + +import org.lamsfoundation.lams.selenium.AbstractSeleniumTestCase; +import org.lamsfoundation.lams.tool.wiki.util.WikiConstants; + +public class TestWiki extends AbstractSeleniumTestCase { + + private static final String LEARNING_DESIGN_TITLE ="Wiki Test"; + private static final String WIKI_TITLE1 = "Dog Wiki"; + private static final String WIKI_TITLE2 = "Blue Healers"; + private static final String WIKI_BODY1 = "Dogs come in many breeds."; + private static final String WIKI_BODY2 = "Blue Healers are small dogs origninally bred for farming and hunting"; + private static final String WIKI_BODY3 = "Dogs come in many breeds, please attach a wiki page about a breed."; + + private Map contentDetails; + + protected String getToolSignature() { + return WikiConstants.TOOL_SIGNATURE; + } + + protected String getLearningDesignName() { + return LEARNING_DESIGN_TITLE; + } + + @Override + public void testEntireTool() throws Exception { + } + + @Override + protected void learningTest() throws InterruptedException { + } + + @Override + protected void monitoringTest() { + } + + @Override + protected void authoringTest() throws Exception { + } + + // ************************************************************************* + // Wiki author tests + // ************************************************************************* + + /** + * Testing the wiki author module + */ + public void testAuthor() { + try { + + // Logging in and opening authoring + loginToLams(); + contentDetails = setUpAuthoring(); + + // Testing wiki edit page + testAuthorEdit(WIKI_TITLE1, WIKI_BODY1); + + // Testing wiki add page + testAuthorAdd(WIKI_TITLE2, WIKI_BODY2); + + // Testing author edit again + selenium.runScript("changeWikiPage('" + WIKI_TITLE1 + "')"); + selenium.waitForPageToLoad("30000"); + testAuthorEdit(WIKI_TITLE1, WIKI_BODY3); + + // Test history + testAuthorHistory(WIKI_TITLE1); + + // Testing other tabs + selenium.click("tab-middle-link-2"); + selenium.click("lockOnFinished"); + selenium.click("tab-middle-link-3"); + selenium.type("onlineInstruction__lamstextarea", "online instructions"); + + storeLearningDesign(contentDetails); + } catch (Exception e) { + fail(e.getMessage()); + } + + } + + /** + * Tests editing the wiki page in author + */ + private void testAuthorEdit(String title, String body) { + + // Go to the edit tab + selenium.runScript("changeDiv('edit')"); + + // Set the wiki title and body, then save + selenium.type("title", title); + selenium.runScript("FCKeditorAPI.GetInstance(\"wikiBody\").SetHTML(\"" + body + "\")"); + selenium.runScript("doEditOrAdd('editPage')"); + selenium.waitForPageToLoad("30000"); + + assertTrue("Title is not present on page: " + title, selenium.isTextPresent(title)); + assertTrue("Wiki body is not present on page: " + body, selenium.isTextPresent(body)); + } + + /** + * Tests editing the wiki page in author + */ + private void testAuthorAdd(String title, String body) { + // Go to the edit tab + selenium.runScript("changeDiv('add')"); + + // Set the wiki title and body, then save + selenium.type("newPageTitle", title); + selenium.runScript("FCKeditorAPI.GetInstance(\"newPageWikiBody\").SetHTML(\"" + body + "\")"); + selenium.runScript("doEditOrAdd('addPage')"); + selenium.waitForPageToLoad("30000"); + + selenium.runScript("changeWikiPage('" + title + "')"); + selenium.waitForPageToLoad("30000"); + + assertTrue("Title is not present on page: " + title, selenium.isTextPresent(title)); + assertTrue("Wiki body is not present on page: " + body, selenium.isTextPresent(body)); + } + + private void testAuthorHistory(String title) { + selenium.runScript("changeWikiPage('" + title + "')"); + selenium.waitForPageToLoad("30000"); + + // Go to the history tab + selenium.runScript("changeDiv('history'" + "" + ")"); + assertTrue("Revision is not present on edited page: " + title, selenium.isTextPresent("Revert")); + + // TODO: Test the compare feature + } + + // ************************************************************************* + // Wiki learner tests + // ************************************************************************* + + public void testLearner() { + try { + loginToLams(); + createNewLesson(); + setUpLearning(); + assertEquals("LAMS Learner", selenium.isElementPresent("//a[@id='finishButton']")); + } catch (Exception e) { + fail(e.getMessage()); + } + } + +}