Skip to content
Snippets Groups Projects
Commit 3b068e62 authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_12.5' into OpenOLAT_13.0

parents da9badb2 8f96ddae
No related branches found
No related tags found
No related merge requests found
......@@ -1233,6 +1233,310 @@ public class AssessmentTest extends Deployments {
.assertPassed();
}
/**
* An author create a course for a task with some custom
* settings, assignment and solution steps are disabled,
* but grading is selected with score and
* passed is automatically calculated.</br>
* It had a participant which goes through the workflow,
* submits 2 documents, one with the embedded editor,
* one with the upload mechanism.</br>
* The author reviews the documents, uploads a correction and
* want a revision.</br>
* The assessed participant upload a revised document.</br>
* The author sees it and close the revisions process, use
* the assessment tool to set the score.</br>
* The participant checks if she successfully passed the task.
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void taskWithoutAssignment(@InitialPage LoginPage authorLoginPage,
@Drone @User WebDriver ryomouBrowser)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
//create a course
String courseTitle = "Course-with-task-alt-1-" + UUID.randomUUID();
navBar
.openAuthoringEnvironment()
.createCourse(courseTitle)
.clickToolbarBack();
//create a course element of type Test with the test that we create above
String gtaNodeTitle = "Individual task 2";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser)
.edit();
courseEditor
.createNode("ita")
.nodeTitle(gtaNodeTitle);
GroupTaskConfigurationPage gtaConfig = new GroupTaskConfigurationPage(browser);
gtaConfig
.selectWorkflow()
.enableAssignment(false)
.enableSolution(false)
.saveWorkflow();
gtaConfig
.selectAssessment()
.setAssessmentOptions(0.0f, 6.0f, 4.0f)
.saveAssessmentOptions();
courseEditor
.publish()
.quickPublish(UserAccess.membersOnly);
MembersPage membersPage = courseEditor
.clickToolbarBack()
.members();
membersPage
.importMembers()
.setMembers(kanu, ryomou)
.nextUsers()
.nextOverview()
.nextPermissions()
.finish();
//go to the course
CoursePageFragment coursePage = membersPage
.clickToolbarBack();
coursePage
.clickTree()
.selectWithTitle(gtaNodeTitle);
//Participant log in
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage
.loginAs(ryomou)
.resume();
//open the course
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar
.openMyCourses()
.select(courseTitle);
//go to the group task
CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
ryomouTestCourse
.clickTree()
.selectWithTitle(gtaNodeTitle);
GroupTaskPage ryomouTask = new GroupTaskPage(ryomouBrowser);
ryomouTask
.assertSubmissionAvailable();
URL submit1Url = JunitTestHelper.class.getResource("file_resources/submit_2.txt");
File submit1File = new File(submit1Url.toURI());
String submittedFilename = "personal_solution.html";
String submittedText = "This is my solution";
ryomouTask
.submitFile(submit1File)
.submitText(submittedFilename, submittedText)
.submitDocuments();
//back to author
coursePage
.clickTree()
.selectWithTitle(gtaNodeTitle);
GroupTaskToCoachPage participantToCoach = new GroupTaskToCoachPage(browser);
URL correctionUrl = JunitTestHelper.class.getResource("file_resources/correction_1.txt");
File correctionFile = new File(correctionUrl.toURI());
participantToCoach
.selectIdentityToCoach(ryomou)
.assertSubmittedDocument("personal_solution.html")
.assertSubmittedDocument("submit_2.txt")
.uploadCorrection(correctionFile)
.needRevision();
//participant add a revised document
URL revisionUrl = JunitTestHelper.class.getResource("file_resources/submit_3.txt");
File revisionFile = new File(revisionUrl.toURI());
ryomouTestCourse
.clickTree()
.selectWithTitle(gtaNodeTitle);
ryomouTask
.submitRevisedFile(revisionFile)
.submitRevision();
//back to author
coursePage
.clickTree()
.selectWithTitle(gtaNodeTitle);
participantToCoach
.selectIdentityToCoach(ryomou)
.assertRevision("submit_3.txt")
.closeRevisions()
.openIndividualAssessment()
.individualAssessment(null, 5.5f)
.assertPassed();
//participant checks she passed the task
ryomouTestCourse
.clickTree()
.selectWithTitle(gtaNodeTitle);
ryomouTask
.assertPassed();
}
/**
* An author create a course for a task with some custom
* settings, the following steps are not selected: review
* (and revisions) and solutions. The assignment is automatic.
* The assessment is set to passed automatically.</br>
* It had a participant which see the assignment and submits
* 2 documents, one with the embedded editor,
* one with the upload mechanism.</br>
* The author reviews the documents and use
* the assessment tool to set the score.</br>
* The participant checks if she successfully passed the task.
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void taskWithIndividuScoreNoRevision(@InitialPage LoginPage authorLoginPage,
@Drone @User WebDriver ryomouBrowser)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
//create a course
String courseTitle = "Course-with-individual-task-" + UUID.randomUUID();
navBar
.openAuthoringEnvironment()
.createCourse(courseTitle)
.clickToolbarBack();
//create a course element of type Test with the test that we create above
String gtaNodeTitle = "Individual task 1";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser)
.edit();
courseEditor
.createNode("ita")
.nodeTitle(gtaNodeTitle);
GroupTaskConfigurationPage gtaConfig = new GroupTaskConfigurationPage(browser);
gtaConfig
.selectWorkflow()
.enableSolution(false)
.enableReview(false)
.saveWorkflow()
.selectAssignment();
URL task1Url = JunitTestHelper.class.getResource("file_resources/task_1_a.txt");
File task1File = new File(task1Url.toURI());
gtaConfig.uploadTask("Individual Task 1 alpha", task1File);
URL task2Url = JunitTestHelper.class.getResource("file_resources/task_1_b.txt");
File task2File = new File(task2Url.toURI());
gtaConfig
.uploadTask("Individual Task 2 beta", task2File)
.enableAutoAssignment(true)
.saveTasks();
gtaConfig
.selectAssessment()
.setAssessmentOptions(0.0f, 6.0f, 4.0f)
.saveAssessmentOptions();
courseEditor
.publish()
.quickPublish(UserAccess.membersOnly);
MembersPage membersPage = courseEditor
.clickToolbarBack()
.members();
membersPage
.importMembers()
.setMembers(kanu, ryomou)
.nextUsers()
.nextOverview()
.nextPermissions()
.finish();
//go to the course
CoursePageFragment coursePage = membersPage
.clickToolbarBack();
coursePage
.clickTree()
.selectWithTitle(gtaNodeTitle);
//Participant log in
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage
.loginAs(ryomou)
.resume();
//open the course
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar
.openMyCourses()
.select(courseTitle);
//go to the group task
CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
ryomouTestCourse
.clickTree()
.selectWithTitle(gtaNodeTitle);
GroupTaskPage ryomouTask = new GroupTaskPage(ryomouBrowser);
ryomouTask
.assertAssignmentAvailable()
.assertTask("Individual Task")
.assertSubmissionAvailable();
URL submit1Url = JunitTestHelper.class.getResource("file_resources/submit_2.txt");
File submit1File = new File(submit1Url.toURI());
String submittedFilename = "personal_solution.html";
String submittedText = "This is my solution";
ryomouTask
.submitFile(submit1File)
.submitText(submittedFilename, submittedText)
.submitDocuments();
//back to author
coursePage
.clickTree()
.selectWithTitle(gtaNodeTitle);
GroupTaskToCoachPage participantToCoach = new GroupTaskToCoachPage(browser);
participantToCoach
.selectIdentityToCoach(ryomou)
.assertSubmittedDocument("personal_solution.html")
.assertSubmittedDocument("submit_2.txt")
.openIndividualAssessment()
.individualAssessment(null, 5.5f)
.assertPassed();
//participant checks she passed the task
ryomouTestCourse
.clickTree()
.selectWithTitle(gtaNodeTitle);
ryomouTask
.assertPassed();
}
/**
* Create an assessment course element, add two users to the course
* and assesses them with the bulk assessment tool. The 2 users
......
......@@ -48,6 +48,32 @@ public class GroupTaskConfigurationPage {
return selectTab(configBy);
}
public GroupTaskConfigurationPage enableAssignment(boolean enable) {
return enableStep("task.assignment", enable);
}
public GroupTaskConfigurationPage enableReview(boolean enable) {
return enableStep("review", enable);
}
public GroupTaskConfigurationPage enableRevision(boolean enable) {
return enableStep("revision", enable);
}
public GroupTaskConfigurationPage enableSolution(boolean enable) {
return enableStep("sample", enable);
}
private GroupTaskConfigurationPage enableStep(String name, boolean enable) {
By stepBy = By.xpath("//fieldset[contains(@class,'o_sel_course_gta_steps')]//label[input[@name='" + name + "']]");
WebElement labelEl = browser.findElement(stepBy);
By checkboxStepBy = By.xpath("//fieldset[contains(@class,'o_sel_course_gta_steps')]//label/input[@name='" + name + "']");
WebElement checkboxEl = browser.findElement(checkboxStepBy);
OOGraphene.check(labelEl, checkboxEl, Boolean.valueOf(enable));
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskConfigurationPage saveWorkflow() {
By saveBy = By.cssSelector(".o_sel_course_gta_save_workflow button.btn-primary");
browser.findElement(saveBy).click();
......@@ -122,6 +148,15 @@ public class GroupTaskConfigurationPage {
return this;
}
public GroupTaskConfigurationPage enableAutoAssignment(boolean enable) {
//task.assignment.type
String type = enable ? "auto" : "manual";
By typeBy = By.xpath("//fieldset[contains(@class,'o_sel_course_gta_task_config_form')]//input[@name='task.assignment.type'][@value='" + type + "']");
browser.findElement(typeBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskConfigurationPage saveTasks() {
By saveBy = By.cssSelector(".o_sel_course_gta_task_config_buttons button.btn-primary");
List<WebElement> saveEls = browser.findElements(saveBy);
......
......@@ -103,6 +103,7 @@ public class GroupTaskPage {
By saveButtonBy = By.cssSelector(".o_sel_course_gta_upload_form button.btn-primary");
browser.findElement(saveButtonBy).click();
OOGraphene.waitBusy(browser);
OOGraphene.waitModalDialogDisappears(browser);
return this;
}
......
......@@ -71,8 +71,7 @@ public class GroupTaskToCoachPage {
public GroupTaskToCoachPage assertSubmittedDocument(String title) {
By selectLinkBy = By.xpath("//div[@id='o_step_submit_content']//ul//a//span[contains(text(),'" + title + "')]");
List<WebElement> documentLinkEls = browser.findElements(selectLinkBy);
Assert.assertFalse(documentLinkEls.isEmpty());
OOGraphene.waitElement(selectLinkBy, browser);
return this;
}
......@@ -141,11 +140,10 @@ public class GroupTaskToCoachPage {
By collpaseBy = By.xpath("//a[@href='#o_step_grading_content']");
browser.findElement(collpaseBy).click();
OOGraphene.waitElement(assessmentButtonBy, browser);
browser.findElement(assessmentButtonBy).click();
} else {
buttons.get(0).click();
}
browser.findElement(assessmentButtonBy).click();
OOGraphene.waitBusy(browser);
OOGraphene.waitModalDialog(browser);
return this;
}
......
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