Add exercise test sample.

pull/2487/head
jmontoyaa 9 years ago
parent 836e361a2e
commit dbb3500f9a
  1. 19
      tests/behat/features/bootstrap/FeatureContext.php
  2. 35
      tests/behat/features/exercise.feature

@ -275,4 +275,23 @@ class FeatureContext extends MinkContext
'action' => 'delete'
]));
}
/**
* @Then /^I fill in wysiwyg field "([^"]*)" with "([^"]*)"$/
*/
public function iFillInWysiwygOnFieldWith($locator, $value)
{
$el = $this->getSession()->getPage()->findField($locator);
$fieldId = $el->getAttribute('id');
if (empty($fieldId)) {
throw new Exception(
'Could not find an id for field with locator: '.$locator
);
}
$this->getSession()->executeScript(
"CKEDITOR.instances[\"$fieldId\"].setData(\"$value\");"
);
}
}

@ -0,0 +1,35 @@
Feature: Exercise tool
In order to use the exercise tool
The teachers should be able to create exercises
Background:
Given I am a platform administrator
And I am on course "TEMP" homepage
Scenario: Create an exercise
Given I am on "/main/exercise/exercise_admin.php?cidReq=TEMP"
When I fill in the following:
| exercise_title | Exercise 1 |
| exerciseDescription | Exercise description |
And I press "submitExercise"
Then I should see "Exercise added"
# Scenario: Create an exercise with a question
# Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
# And I follow "Exercise 1"
# And I follow "Edit"
# And I follow "Multiple choice"
# When I fill in the following:
# | questionName | Question Multiple choice |
## | answer[1] | Answer 1 |
## | answer[2] | Answer 2 |
## | answer[3] | Answer 3 |
## | answer[4] | Answer 4 |
## | weighting[1] | 10 |
## Then I fill in wysiwyg field "answer[1]" with "Answer 1"
# And I press "submitQuestion"
# Then I should see "Item added"
#
#
Loading…
Cancel
Save