Add announcement test + exercise with one question test

pull/2487/head
jmontoyaa 8 years ago
parent ccd97a8a78
commit 6be69d6100
  1. 5
      .travis.yml
  2. 25
      tests/behat/features/announcement.feature
  3. 15
      tests/behat/features/bootstrap/FeatureContext.php
  4. 53
      tests/behat/features/exercise.feature

@ -1,11 +1,6 @@
services:
- mysql
addons:
apt:
packages:
- oracle-java8-installer
language: php
php:

@ -0,0 +1,25 @@
Feature: Announcement tool
In order to use the Announcement tool
The teachers should be able to create Announcements
Background:
Given I am a platform administrator
And I am on course "TEMP" homepage
Scenario: Create an announcement
Given I am on "/main/announcements/announcements.php?action=add&cidReq=TEMP"
When I fill in the following:
| title | Announcement test |
And I select "admin admin" from "users-f"
And I press "add"
And I fill in ckeditor field "content" with "Announcement description"
And I press "submit"
Then I should see "Announcement has been added"
Scenario: Delete all announcements
Given I am on "/main/announcements/announcements.php?cidReq=TEMP"
When I follow "Clear list of announcements"
# And I confirm the popup
Then I should see "All announcements have been deleted"

@ -277,7 +277,7 @@ class FeatureContext extends MinkContext
}
/**
* @Then /^I fill in wysiwyg field "([^"]*)" with "([^"]*)"$/
* @Then /^I fill in ckeditor field "([^"]*)" with "([^"]*)"$/
*/
public function iFillInWysiwygOnFieldWith($locator, $value)
{
@ -371,4 +371,17 @@ class FeatureContext extends MinkContext
//$this->getSession()->wait(10000, "document.readyState === 'complete'");
$this->getSession()->wait(3000);
}
/**
* @When /^I check the "([^"]*)" radio button$/
*/
public function iCheckTheRadioButton($radioLabel)
{
$radioButton = $this->getSession()->getPage()->findField($radioLabel);
if (null === $radioButton) {
throw new Exception("Cannot find radio button ".$radioLabel);
}
//$value = $radioButton->getAttribute('value');
$this->getSession()->getDriver()->click($radioButton->getXPath());
}
}

@ -8,28 +8,45 @@ Feature: Exercise tool
Scenario: Create an exercise
Given I am on "/main/exercise/exercise_admin.php?cidReq=TEMP"
And I follow "Advanced settings"
When I fill in the following:
| exercise_title | Exercise 1 |
| exerciseDescription | Exercise description |
And I fill in ckeditor field "exerciseDescription" with "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"
#
#
Scenario: Add question to exercise created "Exercise 1"
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 |
| weighting[1] | 10 |
Then I fill in ckeditor field "answer[1]" with "Answer true"
Then I fill in ckeditor field "answer[2]" with "Answer false"
Then I fill in ckeditor field "answer[3]" with "Answer false"
Then I fill in ckeditor field "answer[4]" with "Answer false"
Then I fill in ckeditor field "comment[1]" with "Comment true"
Then I fill in ckeditor field "comment[2]" with "Comment false"
Then I fill in ckeditor field "comment[3]" with "Comment false"
Then I fill in ckeditor field "comment[4]" with "Comment false"
And I press "submitQuestion"
Then I should see "Item added"
Scenario: Try exercise "Exercise 1"
Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Exercise 1"
And I follow "Start test"
Then I should see "Question Multiple choice"
And I check the "Answer true" radio button
Then I follow "End test"
And wait for the page to be loaded
Then I should see "Score for the test: 100 / 100"
Scenario: Delete an exercise
Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Delete"
And I confirm the popup
Then I should see "The test has been deleted"
Loading…
Cancel
Save