Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
4049ef14
Commit
4049ef14
authored
6 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: add selenium test for self-test
parent
ec0595f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/java/org/olat/selenium/ImsQTI21Test.java
+105
-0
105 additions, 0 deletions
src/test/java/org/olat/selenium/ImsQTI21Test.java
src/test/java/org/olat/selenium/page/qti/QTI21Page.java
+7
-1
7 additions, 1 deletion
src/test/java/org/olat/selenium/page/qti/QTI21Page.java
with
112 additions
and
1 deletion
src/test/java/org/olat/selenium/ImsQTI21Test.java
+
105
−
0
View file @
4049ef14
...
...
@@ -41,6 +41,7 @@ import org.olat.selenium.page.User;
import
org.olat.selenium.page.course.AssessmentToolPage
;
import
org.olat.selenium.page.course.CourseEditorPageFragment
;
import
org.olat.selenium.page.course.CoursePageFragment
;
import
org.olat.selenium.page.course.MembersPage
;
import
org.olat.selenium.page.graphene.OOGraphene
;
import
org.olat.selenium.page.qti.QTI21ConfigurationCEPage
;
import
org.olat.selenium.page.qti.QTI21CorrectionPage
;
...
...
@@ -1064,4 +1065,108 @@ public class ImsQTI21Test extends Deployments {
.
getQTI21Page
(
participantBrowser
)
.
assertOnCourseAssessmentTestScore
(
2
);
}
/**
* An author create a course with a course element
* of type self test. It add a participant. The
* participant log in, go to the course to make the
* test.
*
* @param loginPage The login page
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public
void
qti21Course_selfTest
(
@InitialPage
LoginPage
loginPage
)
throws
IOException
,
URISyntaxException
{
UserVO
author
=
new
UserRestClient
(
deploymentUrl
).
createAuthor
();
UserVO
ryomou
=
new
UserRestClient
(
deploymentUrl
).
createRandomUser
(
"ryomou"
);
loginPage
.
loginAs
(
author
.
getLogin
(),
author
.
getPassword
());
//upload a test
String
qtiTestTitle
=
"Simple QTI 2.1 "
+
UUID
.
randomUUID
();
URL
qtiTestUrl
=
JunitTestHelper
.
class
.
getResource
(
"file_resources/qti21/simple_QTI_21_test.zip"
);
File
qtiTestFile
=
new
File
(
qtiTestUrl
.
toURI
());
navBar
.
openAuthoringEnvironment
()
.
uploadResource
(
qtiTestTitle
,
qtiTestFile
);
//create a course
String
courseTitle
=
"Course-self-"
+
UUID
.
randomUUID
();
CoursePageFragment
courseRuntime
=
navBar
.
openAuthoringEnvironment
()
.
createCourse
(
courseTitle
)
.
clickToolbarBack
();
//add participants
MembersPage
members
=
courseRuntime
.
members
();
members
.
importMembers
()
.
setMembers
(
ryomou
)
.
nextUsers
()
.
nextOverview
()
.
selectRepositoryEntryRole
(
false
,
false
,
true
)
.
nextPermissions
()
.
finish
();
// back to course
members
.
clickToolbarBack
();
//create a course element of type Test with the test that we create above
String
nodeTitle
=
"Selftest"
;
CourseEditorPageFragment
courseEditor
=
CoursePageFragment
.
getCourse
(
browser
)
.
edit
();
courseEditor
.
createNode
(
"iqself"
)
.
nodeTitle
(
nodeTitle
)
.
selectTabLearnContent
()
.
chooseTest
(
qtiTestTitle
);
QTI21ConfigurationCEPage
configPage
=
new
QTI21ConfigurationCEPage
(
browser
);
configPage
.
showResultsOnHomepage
(
Boolean
.
TRUE
,
QTI21AssessmentResultsOptions
.
allOptions
())
.
showScoreOnHomepage
(
true
)
.
saveConfiguration
();
courseEditor
.
autoPublish
()
.
publish
()
.
settings
()
.
accessConfiguration
()
.
setUserAccess
(
UserAccess
.
membersOnly
)
.
save
()
.
clickToolbarBack
();
//log out
new
UserToolsPage
(
browser
)
.
logout
();
// participant comes in and do the self test
loginPage
.
loginAs
(
ryomou
.
getLogin
(),
ryomou
.
getPassword
());
NavigationPage
ryomouNavBar
=
new
NavigationPage
(
browser
);
ryomouNavBar
.
openMyCourses
()
.
select
(
courseTitle
);
CoursePageFragment
course
=
new
CoursePageFragment
(
browser
);
course
.
clickTree
()
.
selectWithTitle
(
nodeTitle
);
QTI21Page
qtiPage
=
QTI21Page
.
getQTI21Page
(
browser
);
qtiPage
.
start
()
.
answerSingleChoiceWithParagraph
(
"Right"
)
.
saveAnswer
()
.
endTest
()
.
closeAssessmentResults
()
.
assertOnStart
()
.
assertOnAssessmentResults
();
}
}
This diff is collapsed.
Click to expand it.
src/test/java/org/olat/selenium/page/qti/QTI21Page.java
+
7
−
1
View file @
4049ef14
...
...
@@ -59,13 +59,19 @@ public class QTI21Page {
return
new
QTI21Page
(
browser
);
}
public
QTI21Page
assertOnStart
()
{
By
startBy
=
By
.
cssSelector
(
"a.o_sel_start_qti21assessment"
);
OOGraphene
.
waitElement
(
startBy
,
browser
);
return
this
;
}
public
QTI21Page
start
()
{
By
startBy
=
By
.
cssSelector
(
"a.o_sel_start_qti21assessment"
);
WebElement
startButton
=
browser
.
findElement
(
startBy
);
startButton
.
click
();
OOGraphene
.
waitBusy
(
browser
);
By
mainBy
=
By
.
cssSelector
(
"div.qtiworks.o_assessmenttest"
);
OOGraphene
.
waitElement
(
mainBy
,
5
,
browser
);
OOGraphene
.
waitElement
(
mainBy
,
browser
);
return
this
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment