Remove "I am a student subscribed to session" shortcut

- Use behat instructions to create a session on the fly for a test
- Add message after adding users to a session

Refs: 407536472f
pull/2688/head
Julio Montoya 7 years ago
parent 2dd16ef54d
commit bc1335635a
  1. 1
      main/session/add_users_to_session.php
  2. 24
      tests/behat/features/bootstrap/FeatureContext.php
  3. 80
      tests/behat/features/toolExercise.feature

@ -336,6 +336,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
null,
!$notEmptyList
);
Display::addFlash(Display::return_message(get_lang('Updated')));
header('Location: resume_session.php?id_session='.$id_session);
exit;
}

@ -473,30 +473,6 @@ class FeatureContext extends MinkContext
return false;
}
/**
* @Given /^I am a student subscribed to session "([^"]*)"$/
*
* @param string$sessionName
*/
public function iAmStudentSubscribedToXSession($sessionName)
{
$this->iAmAPlatformAdministrator();
$this->visit('/main/session/session_add.php');
$this->fillField('name', $sessionName);
$this->pressButton('Next step');
$this->selectOption('NoSessionCoursesList[]', 'TEMP (TEMP)');
$this->pressButton('add_course');
$this->pressButton('Next step');
$this->assertPageContainsText('Update successful');
$this->fillField('user_to_add', 'acostea');
$this->waitForThePageToBeLoaded();
$this->clickLink('Costea Andrea (acostea)');
$this->pressButton('Finish session creation');
$this->assertPageContainsText('Session overview');
//$this->assertPageContainsText('Costea Andrea (acostea)');
$this->iAmAStudent();
}
/**
* Example: Then I should see the table "#category_results":
* | Categories | Absolute score | Relative score |

@ -232,6 +232,29 @@ Feature: Exercise tool
And I press "submitQuestion"
Then I should see "Item added"
Scenario: Duplicate exercise
Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Copy this exercise as a new one"
And I confirm the popup
Then I should see "Exercise copied"
And I should see "Exercise 1 - Copy"
Scenario: Import exercise to test questions categories
Given I am on "/main/exercise/upload_exercise.php?cidReq=TEMP"
And I should see "Import quiz from Excel"
And I attach the file "/tests/behat/uploadable_files/exercise.xls" to "user_upload_quiz"
When I press "Upload"
And wait for the page to be loaded
Then I should see "Exercise for Behat test"
Scenario: Import exercise from excel
Given I am on "/main/exercise/upload_exercise.php?cidReq=TEMP"
Then I should see "Import quiz from Excel"
Then I attach the file "/main/exercise/quiz_template.xls" to "user_upload_quiz"
And I press "Upload"
And wait for the page to be loaded
Then I should see "Definition of oligarchy"
Scenario: Try exercise "Exercise 1"
Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Exercise 1"
@ -303,28 +326,28 @@ Feature: Exercise tool
And I follow "Grade activity"
Then I should see "Score for the test: 83 / 117"
Scenario: Duplicate exercise
Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Copy this exercise as a new one"
And I confirm the popup
Then I should see "Exercise copied"
And I should see "Exercise 1 - Copy"
Scenario: Import exercise to test questions categories
Given I am on "/main/exercise/upload_exercise.php?cidReq=TEMP"
And I should see "Import quiz from Excel"
And I attach the file "/tests/behat/uploadable_files/exercise.xls" to "user_upload_quiz"
When I press "Upload"
And wait for the page to be loaded
Then I should see "Exercise for Behat test"
Scenario: Create a session "Session Exercise" and add user "acostea"
Given I am on "/main/session/session_add.php"
When I fill in the following:
| name | Session Exercise |
And I fill in select2 input "#coach_username" with id "1" and value "admin"
And I press "submit"
Then wait for the page to be loaded
Then I should see "Add courses to this session (Session Exercise)"
Then I select "TEMP (TEMP)" from "NoSessionCoursesList[]"
And I press "add_course"
And I press "next"
Then I should see "Update successful"
Then I follow "Multiple registration"
Then I select "Costea Andrea (acostea)" from "nosessionUsersList[]"
And I press "add_user"
And I press "next"
Then I should see "Update successful"
Scenario: Try exercise with categorized questions as student
Given I am a student subscribed to session "Session Exercise"
And I am on "/user_portal.php"
And I follow "Session Exercise"
And wait for the page to be loaded
And I follow "tabs2"
And I follow "TEMP"
Given I am a student
And I am on course "TEMP" homepage in session "Session Exercise"
Then I should see "TEMP (Session Exercise)"
And I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Exercise for Behat test"
And I follow "Start test"
@ -363,10 +386,8 @@ Feature: Exercise tool
Scenario: Teacher see exercise results by categories
Given I am on "/user_portal.php"
And I follow "Session Exercise"
And wait for the page to be loaded
And I follow "tabs2"
And I follow "TEMP"
And I am on course "TEMP" homepage in session "Session Exercise"
Then I should see "TEMP (Session Exercise)"
And I am on "/main/exercise/exercise.php?cidReq=TEMP"
And I follow "Exercise for Behat test"
And I follow "Results and feedback"
@ -397,10 +418,9 @@ Feature: Exercise tool
And I follow "Delete"
Then I should see "Category deleted"
Scenario: Import exercise from excel
Given I am on "/main/exercise/upload_exercise.php?cidReq=TEMP"
Then I should see "Import quiz from Excel"
Then I attach the file "/main/exercise/quiz_template.xls" to "user_upload_quiz"
And I press "Upload"
Scenario: Delete session
Given I am on "/main/session/session_list.php?keyword=Session+Exercise"
And wait for the page to be loaded
Then I should see "Definition of oligarchy"
And I follow "Delete"
And I confirm the popup
Then I should see "Deleted"

Loading…
Cancel
Save