use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorMatch.
/**
* An author make a test with 2 matches. A match with "multiple selection"
* and score "all answers", a second with "single selection" and score
* "per answers".<br>
* A first user make the test, but doesn't answer all questions
* correctly, log out and a second user make the perfect test.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorMatch(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO melissa = new UserRestClient(deploymentUrl).createRandomUser("Melissa");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
String qtiTestTitle = "Match QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// start a blank test
qtiEditor.selectNode("Single choice").deleteNode();
// add a match, multiple selection
QTI21MatchEditorPage matchEditor = qtiEditor.addMatch();
matchEditor.setSource(0, "Eclipse").setSource(1, "vim").setTarget(0, "IDE").setTarget(1, "TextProcessor").addColumn().setTarget(2, "TextEditor").setMatch(0, 0, true).setMatch(1, 2, true).save();
// change max score
matchEditor.selectScores().setMaxScore("4").save();
// set some feedbacks
matchEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
// second match
matchEditor = qtiEditor.addMatch().setSingleChoices().setSource(0, "Java").setSource(1, "C").addRow().setSource(2, "PHP").setTarget(0, "CodeIgniter").setTarget(1, "VisualStudio").addColumn().setTarget(2, "Eclipse").setMatch(0, 2, true).setMatch(1, 1, true).setMatch(2, 0, true).save();
// select score "per answer" and set the scores
matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("6").setScore(0, 0, "0.0").setScore(0, 1, "0.0").setScore(0, 2, "2.0").setScore(1, 0, "0.0").setScore(1, 1, "3.0").setScore(1, 2, "0.0").setScore(2, 0, "1.0").setScore(2, 1, "0.0").setScore(2, 2, "0.0").save();
matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
qtiPage.clickToolbarBack();
// access to all
qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
// show results
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
// a user search the content package
LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
NavigationPage reiNavBar = new NavigationPage(participantBrowser);
reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
reiQtiPage.assertOnAssessmentItem().answerMatch("Eclipse", "IDE", true).answerMatch("vim", "IDE", true).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatch("vim", "IDE", false).answerMatch("vim", "TextEditor", true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", "Eclipse", true).answerMatch("C", "CodeIgniter", true).answerMatch("PHP", "VisualStudio", true).saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 2 from the second
6);
// a second user search the content package
LoginPage melLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
melLoginPage.loginAs(melissa.getLogin(), melissa.getPassword()).resume();
NavigationPage melNavBar = new NavigationPage(participantBrowser);
melNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerMatch("Eclipse", "IDE", true).answerMatch("vim", "TextEditor", true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", "Eclipse", true).answerMatch("C", "CodeIgniter", true).answerMatch("PHP", "VisualStudio", true).saveAnswer().answerMatch("C", "CodeIgniter", false).answerMatch("PHP", "VisualStudio", false).answerMatch("C", "VisualStudio", true).answerMatch("PHP", "CodeIgniter", true).saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 6 from the second
10);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorHottext.
/**
* An author make a test with a question with 2 hot texts, one checked,
* one not. A user make the test. The test is limited because I cannot
* edit the text within the hot text via the web driver.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorHottext(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
String qtiTestTitle = "Hottext QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// start a blank test
qtiEditor.selectNode("Single choice").deleteNode();
// add a hot text with score: all answers
QTI21HottextEditorPage hottextEditor = qtiEditor.addHottext().appendContent("I cannot modify the hottext ").addHottext().uncheck(2).check(1).save();
// change max score
hottextEditor.selectScores().setMaxScore("3").save();
// set some feedbacks
hottextEditor.selectFeedbacks().setHint("Hint", "This is an hint").setCorrectSolution("Correct solution", "First not, second yes").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
qtiPage.clickToolbarBack();
// access to all
qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
// show results
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
// a user search the content package
LoginPage userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
NavigationPage userNavBar = new NavigationPage(participantBrowser);
userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
ryomouQtiPage.assertOnAssessmentItem().answerHottext(2).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerHottext(1).answerHottext(// un select it
2).saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question
3);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorEssay.
/**
* An author make a test with an essai and its special feedback.<br>
* A user make the test and check the feedback.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorEssay(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// make a test
String qtiTestTitle = "Essai QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// start a blank test
qtiEditor.selectNode("Single choice").deleteNode();
// add an essay interaction
QTI21LobEditorPage essayEditor = qtiEditor.addEssay();
essayEditor.setQuestion("Write a small story").save().selectScores().setMaxScore("3.0").save();
essayEditor.selectFeedbacks().setHint("Hint", "Did you search inspiration?").setCorrectSolution("Correct solution", "It is very personal.").setAnsweredFeedback("Full", "Well done").setEmpytFeedback("Empty", "Please, a little effort.").save();
qtiPage.clickToolbarBack();
// access to all
qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
// show results
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
// a user search the content package
LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
NavigationPage reiNavBar = new NavigationPage(participantBrowser);
reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
reiQtiPage.assertOnAssessmentItem().saveAnswer().assertFeedback("Empty").hint().assertFeedback("Hint");
reiQtiPage.answerEssay("What can I write?").saveAnswer().assertFeedback("Full").endTest().assertOnAssessmentResults().assertOnAssessmentResultEssay("What");
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorKprim.
/**
* An author make a test with 2 kprims.<br>
* A first user make the test, but doesn't answer all questions
* correctly, log out and a second user make the perfect test.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorKprim(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO melissa = new UserRestClient(deploymentUrl).createRandomUser("Melissa");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
String qtiTestTitle = "Kprim QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// start a blank test
qtiEditor.selectNode("Single choice").deleteNode();
// add a kprim
QTI21KprimEditorPage kprimEditor = qtiEditor.addKprim();
kprimEditor.setAnswer(0, "Correct").setCorrect(0, true).setAnswer(1, "OkToo").setCorrect(1, true).setAnswer(2, "Faux").setCorrect(2, false).setAnswer(3, "Falsch").setCorrect(3, false).save();
// change max score
kprimEditor.selectScores().setMaxScore("4").save();
// set some feedbacks
kprimEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
// second kprim
kprimEditor = qtiEditor.addKprim().setAnswer(0, "OnlyRight").setCorrect(0, true).setAnswer(1, "NotRight").setCorrect(1, false).setAnswer(2, "NotAnswer").setCorrect(2, false).setAnswer(3, "TheWrongOne").setCorrect(3, false).save();
kprimEditor.selectScores().setMaxScore("2").save();
kprimEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
qtiPage.clickToolbarBack();
// access to all
qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
// show results
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
// a user search the content package
LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
NavigationPage reiNavBar = new NavigationPage(participantBrowser);
reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
reiQtiPage.assertOnAssessmentItem().answerCorrectKPrim("Correct", "OkToo", "Faux").answerIncorrectKPrim("Falsch").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerCorrectKPrim("Correct", "OkToo").answerIncorrectKPrim("Falsch", "Faux").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerIncorrectKPrim("OnlyRight", "NotRight", "NotAnswer", "TheWrongOne").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 1 from the second
5);
// a second user search the content package
LoginPage melLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
melLoginPage.loginAs(melissa.getLogin(), melissa.getPassword()).resume();
NavigationPage melNavBar = new NavigationPage(participantBrowser);
melNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerCorrectKPrim("Correct", "OkToo").answerIncorrectKPrim("Faux", "Falsch").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerCorrectKPrim("OnlyRight").answerIncorrectKPrim("NotRight", "NotAnswer", "TheWrongOne").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 3 from the second
6);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorNegativePoints.
/**
* An author make a test and use the negative points.<br>
* 3 users search the test, pass the test or not and
* check their results.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorNegativePoints(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
String qtiTestTitle = "Choices QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// customize the section
qtiEditor.selectSection().selectExpertOptions().sectionTitle(false).save();
// edit the default single choice
qtiEditor.selectItem("Single Choice");
QTI21SingleChoiceEditorPage scEditor = new QTI21SingleChoiceEditorPage(browser);
scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").save();
scEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("2.0").setMinScore("-1.0").setScore("Wrong", "-1").setScore("Correct", "2").setScore("Faux", "-1").save();
// add a multiple choice
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "Ok").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
mcEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("2.0").setMinScore("-2").setScore("Correct", "1").setScore("Ok", "1").setScore("Faux", "-2").setScore("Falsch", "-2").save();
// add an hotspot
QTI21HotspotEditorPage hotspotEditor = qtiEditor.addHotspot();
// 2 spots
URL backgroundImageUrl = JunitTestHelper.class.getResource("file_resources/house.jpg");
File backgroundImageFile = new File(backgroundImageUrl.toURI());
hotspotEditor.updloadBackground(backgroundImageFile).resizeCircle().moveCircle(300, 120).addRectangle().moveRectangle(150, 150).setCardinality(Cardinality.SINGLE).save();
hotspotEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("3.0").setMinScore("-2").setScore("1.", // circle
"3.0").setScore("2.", // rectangle
"-2").save();
qtiPage.clickToolbarBack();
// access to all
qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
// show results
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
// a user search the content package
LoginPage userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
NavigationPage userNavBar = new NavigationPage(participantBrowser);
userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test with all correct answers
QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
ryomouQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Ok").answerMultipleChoice("Correct").saveAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(7).assertOnAssessmentTestMaxScore(7);
// a second user search the content package
LoginPage asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test with all correct answers
QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
asukaQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Wrong").saveAnswer().answerMultipleChoice("Falsch").answerMultipleChoice("Faux").saveAnswer().answerHotspot("rect").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// -1 + -4 but never under 0
0).assertOnAssessmentTestMaxScore(7);
// a third user search the content package
LoginPage reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
NavigationPage reiNavBar = new NavigationPage(participantBrowser);
reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test with some correct answers
QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
reiQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Faux").saveAnswer().answerMultipleChoice("Ok").answerMultipleChoice("Correct").saveAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// -1 + 2 + 3 points
4).assertOnAssessmentTestMaxScore(7);
}
Aggregations