Index: lams_tool_assessment/test/java/org/lamsfoundation/lams/tool/assessment/selenium/TestAssessment.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/test/java/org/lamsfoundation/lams/tool/assessment/selenium/Attic/TestAssessment.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_assessment/test/java/org/lamsfoundation/lams/tool/assessment/selenium/TestAssessment.java 27 Jul 2009 21:19:39 -0000 1.1 @@ -0,0 +1,232 @@ +/**************************************************************** + * 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 + * **************************************************************** + */ + +/* $Id: TestAssessment.java,v 1.1 2009/07/27 21:19:39 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.assessment.selenium; + +import junit.framework.TestSuite; + +import org.lamsfoundation.lams.selenium.AbstractSeleniumTestCase; +import org.lamsfoundation.lams.selenium.SeleniumTestSuite; +import org.lamsfoundation.lams.tool.assessment.AssessmentConstants; + +public class TestAssessment extends AbstractSeleniumTestCase { + + protected String getToolSignature() { + return AssessmentConstants.TOOL_SIGNATURE; + } + + protected String getLearningDesignName() { + return "assessmentx"; + } + + public static TestSuite suite() { + String[] testSequence = {"testAuthoring", "testCreateNewLesson", "testLearning", "testMonitoring"}; + return new SeleniumTestSuite(TestAssessment.class, testSequence); + } + + public void testAuthoring() throws Exception { + loginToLams(); + setUpAuthoring(); + + assertEquals("Assessment Tool Authoring", selenium.getTitle()); + verifyTrue(selenium.isTextPresent("Assessment Tool")); + verifyEquals("Basic", selenium.getText("tab-middle-link-1")); + + assertEquals("Title", selenium.getText("//div[@id='tabbody1']/table/tbody/tr[1]/td/div")); + verifyEquals("Assessment", selenium.getValue("assessment.title")); + verifyTrue(selenium.isElementPresent("//span[@class='okIcon']")); + verifyTrue(selenium.isElementPresent("//span[@class='cancelIcon']")); + verifyEquals("Question List", selenium.getText("//div[@id='questionList']/h2")); + selenium.type("assessment.title", "Only for clever"); + selenium.runScript("FCKeditorAPI.GetInstance(\"assessment.instructions\").SetHTML(\"Show your best in mathematics\")"); + + selenium.click("tab-middle-link-2"); + assertTrue(selenium.isElementPresent("timeLimit")); + selenium.click("allowOverallFeedbackAfterQuestion"); + selenium.click("allowQuestionFeedback"); + selenium.click("allowRightWrongAnswersAfterQuestion"); + selenium.click("allowGradesAfterAttempt"); + selenium.click("allowHistoryResponsesAfterAttempt"); + + selenium.click("tab-middle-link-3"); + verifyTrue(selenium.isTextPresent("Save")); + selenium.type("assessment.onlineInstructions__textarea", "online instructions"); + + selenium.click("tab-middle-link-1"); + createMultipleChoice(); + verifyEquals("Easy one", selenium.getText("//table[@id='questionTable']/tbody/tr[2]/td[2]")); + + createTrueFalse(); + verifyEquals("Tasty question", selenium.getText("//table[@id='questionTable']/tbody/tr[3]/td[2]")); + + storeLearningDesign(); + } + + private void createMultipleChoice() throws InterruptedException { + selenium.click("newQuestionInitHref"); + selenium.selectFrame("TB_iframeContent"); + waitForElementPresent("title"); + + assertTrue(selenium.isTextPresent("Multiple choice")); + selenium.click("link=Add Multiple Choice"); + verifyTrue(selenium.isTextPresent("You have 3 errors in a form. They have been highlighted.")); + verifyTrue(selenium.isTextPresent("This field is required.")); + verifyTrue(selenium.isTextPresent("You should provide at least one possible answer.")); + verifyTrue(selenium.isTextPresent("One of the answers should have a grade of 100% so it is possible to get full marks for this question.")); + + selenium.type("title", "Easy one"); + selenium.runScript("FCKeditorAPI.GetInstance(\"question\").SetHTML(\"How much is 2+2?\")"); + selenium.runScript("FCKeditorAPI.GetInstance(\"generalFeedback\").SetHTML(\"You should better know this\")"); + verifyEquals("1", selenium.getValue("defaultGrade")); + verifyEquals("0.1", selenium.getValue("penaltyFactor")); + selenium.click("link=Add Multiple Choice"); + verifyTrue(selenium.isTextPresent("You have 2 errors in a form. They have been highlighted.")); + // verifyFalse(selenium.isTextPresent("This field is required.")); + + selenium.runScript("FCKeditorAPI.GetInstance(\"optionString0\").SetHTML(\"4\")"); + selenium.select("optionGrade0", "label=100 %"); + selenium.type("optionFeedback0__lamstextarea", "good boy"); + selenium.runScript("FCKeditorAPI.GetInstance(\"optionString1\").SetHTML(\"2\")"); + selenium.select("optionGrade1", "label=None"); + selenium.type("optionFeedback1__lamstextarea", "bad girl"); + selenium.select("optionGrade2", "label=20 %"); + selenium.runScript("FCKeditorAPI.GetInstance(\"optionString2\").SetHTML(\"5\")"); + selenium.type("optionFeedback2__lamstextarea", "Tt could be so, on Mars"); + selenium.click("link=Add Multiple Choice"); + + // TODO may be get rid of this thing + selenium.selectWindow("openToolId"); + waitForElementPresent("link=Save"); + } + + private void createTrueFalse() throws InterruptedException { + selenium.select("questionType", "label=True/False"); + selenium.click("newQuestionInitHref"); + selenium.selectFrame("TB_iframeContent"); + waitForElementPresent("title"); + + assertTrue(selenium.isTextPresent("True/False Question")); + selenium.click("link=Add True/False"); + verifyTrue(selenium.isTextPresent("You have 1 error in a form. It has been highlighted.")); + + selenium.type("title", "Tasty question"); + selenium.runScript("FCKeditorAPI.GetInstance(\"question\").SetHTML(\"
apple + apple = apple pie. Is this correct?
\")"); + selenium.runScript("FCKeditorAPI.GetInstance(\"generalFeedback\").SetHTML(\"You're ready to become a cook if you know this\")"); + verifyEquals("1", selenium.getValue("defaultGrade")); + verifyEquals("0.1", selenium.getValue("penaltyFactor")); + + selenium.runScript("FCKeditorAPI.GetInstance(\"feedbackOnCorrect\").SetHTML(\"Unfortunately, this is not true\")"); + selenium.runScript("FCKeditorAPI.GetInstance(\"feedbackOnIncorrect\").SetHTML(\"Correct!!\")"); + selenium.click("link=Add True/False"); + + selenium.selectWindow("openToolId"); + waitForElementPresent("link=Save"); + } + + public void testCreateNewLesson() throws Exception { + createNewLesson(); + } + + public void testLearning() throws InterruptedException { + setUpLearning(); + // assertEquals("Assessment Learning", selenium.getTitle()); + assertTrue(selenium.isTextPresent("Only for clever")); + verifyFalse(selenium.isTextPresent("Started on")); + verifyTrue(selenium.isElementPresent("question0")); + selenium.click("//input[@name='question0' and @value='1']"); + selenium.click("question1"); + + selenium.click("submitAll"); + selenium.waitForPageToLoad("30000"); + assertEquals("Started on", selenium.getText("//div[@id='content']/table/tbody/tr[1]/th")); + verifyTrue(selenium.isTextPresent("0 out of a maximum of 2")); + verifyTrue(selenium.isTextPresent("bad girl")); + verifyTrue(selenium.isTextPresent("You should better know this")); + verifyTrue(selenium.isElementPresent("//form[@id='answers']/table/tbody/tr[2]/td[2]/table/tbody/tr[1]/td[1]/img")); + verifyTrue(selenium.isElementPresent("//form[@id='answers']/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[1]/img")); + verifyTrue(selenium.isTextPresent("Unfortunately, this is not true")); + verifyTrue(selenium.isTextPresent("You're ready to become a cook if you know this")); + + selenium.click("link=Next Activity"); + selenium.waitForPageToLoad("30000"); + assertTrue(selenium.isTextPresent("Congratulations, you have finished.")); + verifyFalse(selenium.isElementPresent("Only for clever")); + tearDownLearning(); + + setUpLearning(); + assertTrue(selenium.isTextPresent("Congratulations, you have finished.")); + assertFalse(selenium.isTextPresent("Only for clever")); + tearDownLearning(); + } + + public void testMonitoring() throws InterruptedException { + setUpMonitoring(); + + assertTrue(selenium.isTextPresent("Assessment Tool")); + verifyTrue(selenium.isTextPresent("Summary")); + verifyEquals("1", selenium.getText("//tr[@id='1']/td[1]")); + verifyEquals("Morgan, Mary", selenium.getText("//tr[@id='1']/td[4]")); + verifyEquals("0", selenium.getText("//tr[@id='1']/td[5]")); + verifyEquals("0", selenium.getText("//tr[@id='1']/td[6]")); + verifyEquals("0.00", selenium.getText("//tr[@id='1']/td[7]")); + // verifyFalse(selenium.isElementPresent("//div[4]/table/tbody/tr[2]/td[1]")); + + selenium.click("//tr[@id='1']/td[4]"); + waitForElementPresent("//div[4]/table/tbody/tr[2]/td[1]"); + // verifyEquals("1", selenium.getText("//div[4]/table/tbody/tr[2]/td[1]")); + verifyEquals("Easy one", selenium.getText("//div[4]/table/tbody/tr[2]/td[3]")); + verifyEquals("2", selenium.getText("//tr[@id='1']/td[4]/div")); + verifyEquals("0", selenium.getText("//div[4]/table/tbody/tr[2]/td[5]")); + verifyEquals("2", selenium.getText("//tr[@id='2']/td[1]")); + verifyEquals("Tasty question", selenium.getText("//tr[@id='2']/td[3]")); + verifyEquals("true", selenium.getText("//tr[@id='2']/td[4]")); + verifyEquals("0", selenium.getText("//tr[@id='2']/td[5]")); + + selenium.doubleClick("//tr[@id='1']/td[4]"); + selenium.selectFrame("TB_iframeContent"); + waitForElementPresent("link=Ok"); + assertTrue(selenium.isTextPresent("User's history of responses")); + verifyEquals("1", selenium.getText("//div[@id='content']/table/tbody/tr[2]/td")); + assertTrue(selenium.isTextPresent("How much is 2+2?")); + selenium.click("link=Ok"); + selenium.selectWindow("monitorId"); + waitForElementPresent("link=Export summary"); + + selenium.select("questionUid", "label=Easy one"); + selenium.selectFrame("TB_iframeContent"); + waitForElementPresent("link=Ok"); + assertEquals("1", selenium.getText("//div[@id='content']/table/tbody/tr[3]/td")); + assertEquals("0.1", selenium.getText("//div[@id='content']/table/tbody/tr[4]/td")); + assertEquals("Morgan, Mary", selenium.getText("//tr[@id='1']/td[2]")); + assertEquals("2", selenium.getText("//tr[@id='1']/td[3]/div")); + assertEquals("0", selenium.getText("//tr[@id='1']/td[4]")); + selenium.click("//tr[@id='1']/td[4]"); + selenium.type("1_grade", "12"); + selenium.click("link=Ok"); + selenium.selectWindow("monitorId"); + waitForElementPresent("link=Export summary"); + + tearDownMonitoring(); + } + +} Fisheye: Tag 1.4 refers to a dead (removed) revision in file `lams_tool_assessment/test/java/org/lamsfoundation/lams/tool/assessment/tests/TestAssessment.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/selenium/TestForum.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/selenium/Attic/TestForum.java,v diff -u -r1.2 -r1.3 --- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/selenium/TestForum.java 20 Jul 2009 02:21:15 -0000 1.2 +++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/selenium/TestForum.java 27 Jul 2009 21:19:42 -0000 1.3 @@ -23,8 +23,11 @@ import java.util.Map; +import junit.framework.TestSuite; + import org.jfree.util.Log; import org.lamsfoundation.lams.selenium.AbstractSeleniumTestCase; +import org.lamsfoundation.lams.selenium.SeleniumTestSuite; import org.lamsfoundation.lams.tool.forum.util.ForumConstants; /** @@ -57,32 +60,19 @@ private static final String TOPIC4_TITLE = "Learner Topic"; private static final String TOPIC4_MESSAGE = "Created in learner"; - private Map contentDetails; - protected String getToolSignature() { return ForumConstants.TOOL_SIGNATURE; } protected String getLearningDesignName() { return LEARNING_DESIGN_TITLE; } - - @Override - public void testEntireTool() throws Exception { + + public static TestSuite suite() { + String[] testSequence = {"testAuthor", "testStartLesson", "testLearner", "testMonitor"}; + return new SeleniumTestSuite(TestForum.class, testSequence); } - @Override - protected void learningTest() throws InterruptedException { - } - - @Override - protected void monitoringTest() { - } - - @Override - protected void authoringTest() throws Exception { - } - /** * Testing the wiki author module */ @@ -91,7 +81,7 @@ // Logging in and opening authoring loginToLams(); - contentDetails = setUpAuthoring(); + setUpAuthoring(); // check the author page has loaded the default content assertTrue("Default content is not present", selenium.isTextPresent(DEFAULT_TOPIC)); @@ -117,7 +107,7 @@ // TODO: Test conditions tab - storeLearningDesign(contentDetails); + storeLearningDesign(); } catch (Exception e) { Log.error(e); fail(e.getMessage()); @@ -130,7 +120,6 @@ */ public void testStartLesson() { try { - loginToLams(); createNewLesson(); } catch (Exception e) { fail(e.getMessage()); @@ -142,7 +131,6 @@ */ public void testLearner() { try { - loginToLams(); setUpLearning(); assertEquals("LAMS Learner", selenium.isElementPresent("//a[@id='finishButton']")); @@ -154,7 +142,8 @@ // Testing creating a topic testCreateTopicLearner(TOPIC4_TITLE, TOPIC4_MESSAGE); - + + tearDownLearning(); } catch (Exception e) { Log.error(e); fail(e.getMessage()); @@ -166,14 +155,13 @@ */ public void testMonitor() { try { - loginToLams(); - openToolMonitor(); + setUpMonitoring(); // TODO: Work out how to access the forum page, which is opened in a _blank page selenium.close(); selenium.selectWindow(null); - closeToolMonitor(); + tearDownMonitoring(); } catch (Exception e) { fail(e.getMessage()); } Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/selenium/TestNotebook.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/selenium/Attic/TestNotebook.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/selenium/TestNotebook.java 27 Jul 2009 21:19:36 -0000 1.1 @@ -0,0 +1,98 @@ +/**************************************************************** + * 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 + * **************************************************************** + */ + +/* $Id: TestNotebook.java,v 1.1 2009/07/27 21:19:36 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.notebook.selenium; + + +import java.lang.reflect.InvocationTargetException; +import java.util.Map; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.lamsfoundation.lams.selenium.AbstractSeleniumTestCase; +import org.lamsfoundation.lams.selenium.SeleniumTestSuite; +import org.lamsfoundation.lams.tool.notebook.util.NotebookConstants; + +public class TestNotebook extends AbstractSeleniumTestCase { + + protected String getToolSignature() { + return NotebookConstants.TOOL_SIGNATURE; + } + + protected String getLearningDesignName() { + return "bueno"; + } + + public static TestSuite suite() { + String[] testSequence = {"testAuthoring", "testCreateNewLesson", "testLearning", "testMonitoring"}; + return new SeleniumTestSuite(TestNotebook.class, testSequence); + } + + public void testAuthoring() throws Exception { + loginToLams(); + setUpAuthoring(); + + assertEquals("Notebook", selenium.getTitle()); + + selenium.type("title", "leave your comment2222"); + selenium.runScript("FCKeditorAPI.GetInstance(\"instructions\").SetHTML(\"invent a new way of using Flash\")"); + selenium.click("tab-middle-link-2"); + selenium.click("lockOnFinished"); + selenium.click("tab-middle-link-3"); + selenium.type("onlineInstruction__lamstextarea", "online instructions"); + + storeLearningDesign(); + } + + public void testCreateNewLesson() throws Exception { + createNewLesson(); + } + + public void testLearning() throws Exception { + setUpLearning(); + // assertEquals("Notebook", selenium.getTitle()); + assertEquals("LAMS Learner", selenium.isElementPresent("//a[@id='finishButton']")); + selenium.type("entryText", "have fun"); + selenium.click("//a[@id='finishButton']/span"); + selenium.waitForPageToLoad("30000"); + // assertTrue(selenium.isTextPresent("Congratulations")); + assertFalse(selenium.isElementPresent("entryText")); + tearDownLearning(); + + setUpLearning(); + // assertTrue(selenium.isTextPresent("Congratulations")); + assertFalse(selenium.isElementPresent("entryText")); + tearDownLearning(); + } + + public void testMonitoring() { + setUpMonitoring(); + + assertEquals("Notebook", selenium.getTitle()); + + tearDownMonitoring(); + } + +} Fisheye: Tag 1.7 refers to a dead (removed) revision in file `lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebook.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/wiki/selenium/TestWiki.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/wiki/selenium/Attic/TestWiki.java,v diff -u -r1.2 -r1.3 --- lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/wiki/selenium/TestWiki.java 16 Jul 2009 05:39:44 -0000 1.2 +++ lams_tool_wiki/test/java/org/lamsfoundation/lams/tool/wiki/selenium/TestWiki.java 27 Jul 2009 21:19:34 -0000 1.3 @@ -21,9 +21,10 @@ */ package org.lamsfoundation.lams.tool.wiki.selenium; -import java.util.Map; +import junit.framework.TestSuite; import org.lamsfoundation.lams.selenium.AbstractSeleniumTestCase; +import org.lamsfoundation.lams.selenium.SeleniumTestSuite; import org.lamsfoundation.lams.tool.wiki.util.WikiConstants; /** @@ -50,32 +51,19 @@ private static final String WIKI_BODY6 = "Dummy Body"; private static final String LOCK_ON_FINISH_MESSAGE = "Note: After you click on \"Next Activity\" and you come back to this Wiki, you won't be able to continue editing."; - private Map contentDetails; - protected String getToolSignature() { return WikiConstants.TOOL_SIGNATURE; } protected String getLearningDesignName() { return LEARNING_DESIGN_TITLE; } + + public static TestSuite suite() { + String[] testSequence = {"testAuthor", "testStartLesson", "testLearner", "testMonitor"}; + return new SeleniumTestSuite(TestWiki.class, testSequence); + } - @Override - public void testEntireTool() throws Exception { - } - - @Override - protected void learningTest() throws InterruptedException { - } - - @Override - protected void monitoringTest() { - } - - @Override - protected void authoringTest() throws Exception { - } - /** * Testing the wiki author module */ @@ -84,7 +72,7 @@ // Logging in and opening authoring loginToLams(); - contentDetails = setUpAuthoring(); + setUpAuthoring(); // Testing wiki edit page testEdit(WIKI_TITLE1, WIKI_BODY1); @@ -109,7 +97,7 @@ selenium.click("tab-middle-link-3"); selenium.type("onlineInstruction__lamstextarea", "online instructions"); - storeLearningDesign(contentDetails); + storeLearningDesign(); } catch (Exception e) { fail(e.getMessage()); } @@ -121,7 +109,6 @@ */ public void testStartLesson() { try { - loginToLams(); createNewLesson(); } catch (Exception e) { fail(e.getMessage()); @@ -133,7 +120,6 @@ */ public void testLearner() { try { - loginToLams(); setUpLearning(); assertEquals("LAMS Learner", selenium.isElementPresent("//a[@id='finishButton']")); @@ -164,6 +150,7 @@ // Removing the wiki page so it can be made again in the next test testRemove(WIKI_TITLE3, true); + tearDownLearning(); } catch (Exception e) { fail(e.getMessage()); } @@ -174,8 +161,7 @@ */ public void testMonitor() { try { - loginToLams(); - openToolMonitor(); + setUpMonitoring(); assertTrue("Montor page did not load properly", selenium.isTextPresent("Wiki Sessions")); @@ -204,7 +190,7 @@ selenium.close(); selenium.selectWindow(null); - closeToolMonitor(); + tearDownMonitoring(); } catch (Exception e) { fail(e.getMessage()); }