Skip to content
Snippets Groups Projects
Commit 7732c96e authored by srosse's avatar srosse
Browse files

OO-4080: update selenium tests with assessment course elements

parent ceeba667
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,7 @@ public class MSConfigController extends FormBasicController {
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_course_ms");
// Evaluation Form
evaluationFormEnabledEl = uifactory.addCheckboxesHorizontal("form.evaluation.enabled", formLayout,
ENABLED_KEYS, translateAll(getTranslator(), ENABLED_KEYS));
......@@ -155,6 +156,7 @@ public class MSConfigController extends FormBasicController {
// Points
scoreEl = uifactory.addDropdownSingleselect("form.score", formLayout, EMPTY_ARRAY, EMPTY_ARRAY);
scoreEl.setElementCssClass("o_sel_course_ms_score");
scoreEl.addActionListener(FormEvent.ONCHANGE);
// Scale
......@@ -166,11 +168,13 @@ public class MSConfigController extends FormBasicController {
Float min = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
min = min != null? min: MSCourseNode.CONFIG_DEFAULT_SCORE_MIN;
minEl = uifactory.addTextElement("form.min", "form.min", 8, min.toString(), formLayout);
minEl.setElementCssClass("o_sel_course_ms_min");
// Maximim
Float max = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
max = max != null? max: MSCourseNode.CONFIG_DEFAULT_SCORE_MAX;
maxEl = uifactory.addTextElement("form.max", "form.max", 8, max.toString(), formLayout);
maxEl.setElementCssClass("o_sel_course_ms_max");
uifactory.addSpacerElement("spacer1", formLayout, false);
......@@ -196,6 +200,7 @@ public class MSConfigController extends FormBasicController {
// Passing grade cut value
cutEl = uifactory.addTextElement("form.cut", "form.cut", 8, cut.toString(), formLayout);
cutEl.setElementCssClass("o_sel_course_ms_cut");
uifactory.addSpacerElement("spacer2", formLayout, false);
......
......@@ -823,8 +823,8 @@ public class AssessmentTest extends Deployments {
//configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig
.selectConfiguration()
.setScoreAuto(0.1f, 10.0f, 5.0f);
.selectConfigurationWithRubric()
.setRubricScore(0.1f, 10.0f, 5.0f);
//set the score / passed calculation in root node and publish
courseEditor
.selectRoot()
......@@ -1596,8 +1596,8 @@ public class AssessmentTest extends Deployments {
//configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig
.selectConfiguration()
.setScoreAuto(0.1f, 10.0f, 5.0f);
.selectConfigurationWithRubric()
.setRubricScore(0.1f, 10.0f, 5.0f);
//set the score / passed calculation in root node and publish
courseEditor
.selectRoot()
......
......@@ -1382,8 +1382,8 @@ public class CourseTest extends Deployments {
//configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig
.selectConfiguration()
.setScoreAuto(0.0f, 6.0f, 4.0f);
.selectConfigurationWithRubric()
.setRubricScore(0.0f, 6.0f, 4.0f);
//wiki is assessment dependent
courseEditor
......
......@@ -458,8 +458,8 @@ public class PortfolioV2Test extends Deployments {
//configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig
.selectConfiguration()
.setScoreAuto(1.0f, 6.0f, 4.0f);
.selectConfigurationWithRubric()
.setRubricScore(1.0f, 6.0f, 4.0f);
//set the score / passed calculation in root node and publish
courseEditor
.selectRoot()
......
......@@ -23,6 +23,7 @@ import org.olat.selenium.page.graphene.OOGraphene;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
/**
*
......@@ -43,6 +44,11 @@ public class AssessmentCEConfigurationPage {
return selectTab(configBy);
}
public AssessmentCEConfigurationPage selectConfigurationWithRubric() {
By configBy = By.className("o_sel_course_ms");
return selectTab(configBy);
}
public AssessmentCEConfigurationPage setScoreAuto(float minVal, float maxVal, float cutVal) {
By scoreBy = By.cssSelector(".o_sel_course_ms_score input[type='checkbox']");
browser.findElement(scoreBy).click();
......@@ -74,6 +80,50 @@ public class AssessmentCEConfigurationPage {
return this;
}
/**
* Give a score, set the min. and max. value and passed/failed
* is automatically calculated with the cut value.
*
* @param minVal
* @param maxVal
* @param cutVal
* @return
*/
public AssessmentCEConfigurationPage setRubricScore(float minVal, float maxVal, float cutVal) {
By scoreBy = By.id("o_fioform_score_SELBOX");
OOGraphene.waitElement(scoreBy, browser);
WebElement scoreEl = browser.findElement(scoreBy);
new Select(scoreEl).selectByValue("score.manual");
OOGraphene.waitBusy(browser);
By minValBy = By.cssSelector(".o_sel_course_ms_min input[type='text']");
OOGraphene.waitElement(minValBy, browser);
WebElement minValEl = browser.findElement(minValBy);
minValEl.clear();
minValEl.sendKeys(Float.toString(minVal));
By maxValBy = By.cssSelector(".o_sel_course_ms_max input[type='text']");
WebElement maxValEl = browser.findElement(maxValBy);
maxValEl.clear();
maxValEl.sendKeys(Float.toString(maxVal));
By displayAutoBy = By.cssSelector("#o_coform_passed_type input[type='radio'][value='true']");
browser.findElement(displayAutoBy).click();
OOGraphene.waitBusy(browser);
By cutValBy = By.cssSelector(".o_sel_course_ms_cut input[type='text']");
WebElement cutValEl = browser.findElement(cutValBy);
cutValEl.clear();
cutValEl.sendKeys(Float.toString(cutVal));
By saveBy = By.cssSelector(".o_sel_course_ms button.btn.btn-primary");
OOGraphene.click(saveBy, browser);
OOGraphene.waitBusy(browser);
OOGraphene.scrollTop(browser);
return this;
}
private AssessmentCEConfigurationPage selectTab(By tabBy) {
OOGraphene.selectTab("o_node_config", tabBy, browser);
return this;
......
......@@ -207,10 +207,11 @@ public class CourseEditorPageFragment {
}
/**
* Set the course element title and short title
* Set the course element title and short title, save
* and wait that the dialog disappears.
*
* @param title
* @return
* @param title The title of the course element
* @return Itself
*/
public CourseEditorPageFragment nodeTitle(String title) {
By shortTitleBy = By.cssSelector("div.o_sel_node_editor_shorttitle input[type='text']");
......
......@@ -327,21 +327,21 @@ public class OOGraphene {
.perform();
}
// top.tinymce.get('o_fi1000000416').setContent('<p>Hacked</p>');
// <div id="o_fi1000000416_diw" class="o_richtext_mce"> <iframe id="o_fi1000000416_ifr">
public static final void tinymce(String content, WebDriver browser) {
new WebDriverWait(browser, driverTimeout)
.until(new TinyMCELoadedPredicate());
public static final void waitTinymce(WebDriver browser) {
new WebDriverWait(browser, driverTimeout).withTimeout(waitTinyDuration)
.pollingEvery(poolingDuration)
.until(new TinyMCELoadedPredicate());
}
// top.tinymce.get('o_fi1000000416').setContent('<p>Hacked</p>');
// <div id="o_fi1000000416_diw" class="o_richtext_mce"> <iframe id="o_fi1000000416_ifr">
public static final void tinymce(String content, WebDriver browser) {
waitTinymce(browser);
((JavascriptExecutor)browser).executeScript("top.tinymce.activeEditor.setContent('" + content + "')");
}
public static final void tinymceExec(String content, WebDriver browser) {
new WebDriverWait(browser, driverTimeout).withTimeout(waitTinyDuration)
.pollingEvery(poolingDuration)
.until(new TinyMCELoadedPredicate());
waitTinymce(browser);
((JavascriptExecutor)browser).executeScript("top.tinymce.activeEditor.execCommand('mceInsertRawHTML', true, '" + content + "')");
}
......
......@@ -180,8 +180,9 @@ public class EfficiencyStatementPage {
}//
By collectBy = By.xpath("//div[contains(@class,'o_sel_certificates_table')]//table//tr[td[contains(text(),'" + courseTitle + "')]]/td/a[contains(@href,'cmd.MEDIA')]");
OOGraphene.waitElement(collectBy, 5, browser);
OOGraphene.waitElement(collectBy, browser);
browser.findElement(collectBy).click();
OOGraphene.waitTinymce(browser);
OOGraphene.waitModalDialog(browser);
return new MediaPage(browser);
}
......
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