Internal: Behat - Fix create course

pull/3513/head
Julio Montoya 4 years ago
parent e39980713c
commit b6c06945f2
  1. 12
      public/main/course_home/redirect.php
  2. 4
      tests/behat/features/bootstrap/FeatureContext.php
  3. 8
      tests/behat/features/course.feature

@ -14,10 +14,20 @@ if (!empty($sessionName) && !empty($courseCode)) {
$sessionInfo = SessionManager::get_session_by_name($sessionName);
$courseInfo = api_get_course_info($courseCode);
if (!empty($sessionInfo) && !empty($courseInfo)) {
$url = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/index.php?sid='.$sessionInfo['id'];
$url = $courseInfo['course_public_url'].'?sid='.$sessionInfo['id'];
header('Location: '.$url);
exit;
}
}
if (!empty($courseCode)) {
$courseInfo = api_get_course_info($courseCode);
if (!empty($courseInfo)) {
$url = $courseInfo['course_public_url'];
header('Location: '.$url);
exit;
}
}
api_not_allowed(true);

@ -89,7 +89,8 @@ class FeatureContext extends MinkContext
*/
public function iAmOnCourseXHomepage($courseCode)
{
$this->visit('/courses/'.$courseCode.'/index.php');
$this->visit('/main/course_home/redirect.php?cidReq='.$courseCode);
//$this->visit('/courses/'.$courseCode.'/index.php');
$this->assertElementNotOnPage('.alert-danger');
}
@ -99,6 +100,7 @@ class FeatureContext extends MinkContext
public function iAmOnCourseXHomepageInSessionY($courseCode, $sessionName)
{
$this->visit('/main/course_home/redirect.php?cidReq='.$courseCode.'&session_name='.$sessionName);
$this->assertElementNotOnPage('.alert-danger');
}
/**

@ -17,15 +17,13 @@ Feature: Course tools basic testing
Given I am on "/main/admin/index.php"
Then I should see "Add course"
Scenario: Access the course creation page
Given I am on "/main/admin/course_add.php"
Then I should not see "not authorized"
Scenario: Create a private course before testing
Given I am on "/main/admin/course_add.php"
Then I should not see "not authorized"
When I fill in "title" with "TEMP_PRIVATE"
Then I check the "Private access (access authorized to group members only)" radio button
And I press "submit"
Then wait for the page to be loaded
And I press "Create a course"
Then I should see "Course TEMP_PRIVATE added"
Scenario: Create a course before testing

Loading…
Cancel
Save