Skip to content
Snippets Groups Projects
Commit 5447c85d authored by srosse's avatar srosse
Browse files

Merge with 373ee2d8d8b8a573b2505823fbb864414763bc21

parents 3c7735a1 cc863b37
No related branches found
No related tags found
No related merge requests found
......@@ -346,6 +346,7 @@ public class AssessmentForm extends FormBasicController {
uifactory.addFormSubmitButton("save", buttonGroupLayout);
if(saveAndClose) {
saveAndCloseLink = uifactory.addFormLink("save.close", buttonGroupLayout, Link.BUTTON);
saveAndCloseLink.setElementCssClass("o_sel_assessment_form_save_and_close");
}
uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
}
......
......@@ -184,10 +184,12 @@ public class GTACoachRevisionAndCorrectionsController extends BasicController {
returnToRevisionsButton = LinkFactory.createCustomLink("coach.submit.corrections.to.revision.button", "submit", "coach.submit.corrections.to.revision.button", Link.BUTTON, mainVC, this);
returnToRevisionsButton.setCustomEnabledLinkCSS("btn btn-primary");
returnToRevisionsButton.setIconLeftCSS("o_icon o_icon o_icon_submit");
returnToRevisionsButton.setElementCssClass("o_sel_course_gta_return_revision");
closeRevisionsButton = LinkFactory.createCustomLink("coach.close.revision.button", "close", "coach.close.revision.button", Link.BUTTON, mainVC, this);
closeRevisionsButton.setCustomEnabledLinkCSS("btn btn-primary");
closeRevisionsButton.setIconLeftCSS("o_icon o_icon o_icon_submit");
closeRevisionsButton.setElementCssClass("o_sel_course_gta_close_revision");
}
@Override
......
......@@ -80,6 +80,7 @@ public class GTACoachedParticipantGradingController extends BasicController {
assessmentFormButton = LinkFactory.createCustomLink("coach.assessment", "assessment", "coach.assessment", Link.BUTTON, mainVC, this);
assessmentFormButton.setCustomEnabledLinkCSS("btn btn-primary");
assessmentFormButton.setElementCssClass("o_sel_course_gta_assessment_button");
putInitialPanel(mainVC);
setAssessmentDatas(ureq);
......
......@@ -159,6 +159,7 @@ public class GTAParticipantRevisionAndCorrectionsController extends BasicControl
submitRevisionButton = LinkFactory.createCustomLink("run.submit.revision.button", "submit", "run.submit.revision.button", Link.BUTTON, mainVC, this);
submitRevisionButton.setCustomEnabledLinkCSS("btn btn-primary");
submitRevisionButton.setIconLeftCSS("o_icon o_icon o_icon_submit");
submitRevisionButton.setElementCssClass("o_sel_course_gta_submit_revisions");
}
private boolean setRevision(UserRequest ureq, String cmpName, int iteration) {
......
......@@ -1036,4 +1036,175 @@ public class AssessmentTest {
.selectWithTitle(gtaNodeTitle);
ryomouTask.assertPassed();
}
/**
* An author create a course for a task with the some custom
* settings, all steps are selected, grading with score and
* passed automatically calculated, 2 tasks, 1 solution...</br>
* It had 2 participants. One of them goes through the workflow,
* selects a task, 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 taskWithIndividuScoreAndRevision(@InitialPage LoginPage authorLoginPage,
@Drone @User WebDriver ryomouBrowser)
throws IOException, URISyntaxException {
//File upload only work with Firefox
Assume.assumeTrue(browser instanceof FirefoxDriver);
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
.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)
.saveTasks()
.selectSolution();
URL solutionUrl = JunitTestHelper.class.getResource("file_resources/solution_1.txt");
File solutionFile = new File(solutionUrl.toURI());
gtaConfig.uploadSolution("The Best Solution", solutionFile);
gtaConfig
.selectAssessment()
.setAssessmentOptions(0.0f, 6.0f, 4.0f)
.saveAssessmentOptions();
courseEditor
.publish()
.quickPublish(Access.membersOnly);
MembersPage membersPage = courseEditor
.clickToolbarBack()
.members();
membersPage
.importMembers()
.setMembers(kanu, ryomou)
.next().next().next().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()
.selectTask(1)
.assertTask("Individual Task 2 beta")
.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();
}
}
......@@ -57,6 +57,11 @@ public class GroupTaskConfigurationPage {
return this;
}
public GroupTaskConfigurationPage selectAssessment() {
By configBy = By.className("o_sel_course_ms_form");
return selectTab(configBy);
}
public GroupTaskConfigurationPage selectAssignment() {
By configBy = By.className("o_sel_course_gta_tasks");
return selectTab(configBy);
......@@ -110,6 +115,18 @@ public class GroupTaskConfigurationPage {
return this;
}
public GroupTaskConfigurationPage setAssessmentOptions(Float minVal, Float maxVal, Float cutVal) {
new AssessmentCEConfigurationPage(browser).setScoreAuto(minVal, maxVal, cutVal);
return this;
}
public GroupTaskConfigurationPage saveAssessmentOptions() {
By saveBy = By.cssSelector(".o_sel_course_ms_form button.btn-primary");
browser.findElement(saveBy).click();
OOGraphene.waitBusy(browser);
return this;
}
private GroupTaskConfigurationPage selectTab(By tabBy) {
List<WebElement> tabLinks = browser.findElements(CourseEditorPageFragment.navBarNodeConfiguration);
......
......@@ -80,7 +80,15 @@ public class GroupTaskPage {
}
public GroupTaskPage submitFile(File file) {
By uploadButtonBy = By.cssSelector("#o_step_submit_content .o_sel_course_gta_submit_file");
return uploadFile("o_step_submit_content", file);
}
public GroupTaskPage submitRevisedFile(File file) {
return uploadFile("o_step_revision_content", file);
}
private GroupTaskPage uploadFile(String stepId, File file) {
By uploadButtonBy = By.cssSelector("#" + stepId + " .o_sel_course_gta_submit_file");
browser.findElement(uploadButtonBy).click();
OOGraphene.waitBusy(browser);
......@@ -90,7 +98,6 @@ public class GroupTaskPage {
By saveButtonBy = By.cssSelector(".o_sel_course_gta_upload_form button.btn-primary");
browser.findElement(saveButtonBy).click();
OOGraphene.waitBusy(browser);
return this;
}
......@@ -125,6 +132,13 @@ public class GroupTaskPage {
return this;
}
public GroupTaskPage submitRevision() {
By submitBy = By.cssSelector("#o_step_revision_content .o_sel_course_gta_submit_revisions");
browser.findElement(submitBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskPage assertPassed() {
By passedBy = By.cssSelector("#o_step_grading_content table tr.o_state.o_passed");
List<WebElement> passedEls = browser.findElements(passedBy);
......
package org.olat.selenium.page.course;
import java.io.File;
import java.util.List;
import org.jboss.arquillian.drone.api.annotation.Drone;
......@@ -47,20 +48,8 @@ public class GroupTaskToCoachPage {
}
public GroupTaskToCoachPage selectIdentityToCoach(UserVO user) {
By tableRowBy = By.cssSelector(".table tr");
By selectLinkBy = By.xpath("//td//a[contains(@href,'sel3ect')]");
List<WebElement> rows = browser.findElements(tableRowBy);
WebElement selectLinkEl = null;
for(WebElement row:rows) {
String firstName = user.getFirstName();
String text = row.getText();
if(row.getText().contains(user.getFirstName())) {
selectLinkEl = row.findElement(selectLinkBy);
}
}
Assert.assertNotNull(selectLinkEl);
selectLinkEl.click();
By selectLinkBy = By.xpath("//table[contains(@class,'table')]//td//a[contains(@href,'firstName')][contains(text(),'" + user.getFirstName() + "')]");
browser.findElement(selectLinkBy).click();
OOGraphene.waitBusy(browser);
return this;
}
......@@ -72,6 +61,13 @@ public class GroupTaskToCoachPage {
return this;
}
public GroupTaskToCoachPage assertRevision(String title) {
By selectLinkBy = By.xpath("//div[@id='o_step_revision_content']//ul//a//span[contains(text(),'" + title + "')]");
List<WebElement> documentLinkEls = browser.findElements(selectLinkBy);
Assert.assertFalse(documentLinkEls.isEmpty());
return this;
}
public GroupTaskToCoachPage reviewed() {
By reviewBy = By.cssSelector("#o_step_review_content .o_sel_course_gta_reviewed");
browser.findElement(reviewBy).click();
......@@ -79,11 +75,62 @@ public class GroupTaskToCoachPage {
return this;
}
public GroupTaskToCoachPage openGroupAssessment() {
public GroupTaskToCoachPage needRevision() {
By reviewBy = By.cssSelector("#o_step_review_content .o_sel_course_gta_need_revision");
browser.findElement(reviewBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskToCoachPage closeRevisions() {
By closeRevisionBy = By.cssSelector("#o_step_revision_content .o_sel_course_gta_close_revision");
browser.findElement(closeRevisionBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskToCoachPage uploadCorrection(File correctionFile) {
By uploadButtonBy = By.cssSelector("#o_step_review_content .o_sel_course_gta_submit_file");
browser.findElement(uploadButtonBy).click();
OOGraphene.waitBusy(browser);
By inputBy = By.cssSelector(".o_fileinput input[type='file']");
OOGraphene.uploadFile(inputBy, correctionFile, browser);
By saveButtonBy = By.cssSelector(".o_sel_course_gta_upload_form button.btn-primary");
browser.findElement(saveButtonBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskToCoachPage openIndividualAssessment() {
By assessmentButtonBy = By.cssSelector("#o_step_grading_content .o_sel_course_gta_assessment_button");
browser.findElement(assessmentButtonBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskToCoachPage individualAssessment(Boolean passed, Float score) {
if(passed != null) {
By passedBy = By.cssSelector(".o_sel_assessment_form_passed input[type='radio'][value='true']");
browser.findElement(passedBy).click();
}
if(score != null) {
By scoreBy = By.cssSelector(".o_sel_assessment_form_score input[type='text']");
browser.findElement(scoreBy).sendKeys(Float.toString(score));
}
By saveAndCloseBy = By.cssSelector(".o_sel_assessment_form a.o_sel_assessment_form_save_and_close");
browser.findElement(saveAndCloseBy).click();
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskToCoachPage openGroupAssessment() {
By assessmentButtonBy = By.cssSelector("#o_step_grading_content .o_sel_course_gta_assessment_button");
browser.findElement(assessmentButtonBy).click();
OOGraphene.waitBusy(browser);
return this;
}
......@@ -119,5 +166,12 @@ public class GroupTaskToCoachPage {
OOGraphene.waitBusy(browser);
return this;
}
public GroupTaskToCoachPage assertPassed() {
By passedBy = By.cssSelector("#o_step_grading_content table tr.o_state.o_passed");
List<WebElement> passedEls = browser.findElements(passedBy);
Assert.assertFalse(passedEls.isEmpty());
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