Add Behat test for check access to public course with password - refs #8092

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 33fd942306
commit b385710a3a
  1. 30
      tests/features/bootstrap/FeatureContext.php
  2. 8
      tests/features/createCourse.feature

@ -231,4 +231,34 @@ class FeatureContext extends MinkContext
new Given('I am a platform administrator')
);
}
/**
* @Given /^I have a public password-protected course named "([^"]*)" with password "([^"]*)"$/
*/
public function iHaveAPublicPasswordProtectedCourse($code, $password)
{
return [
new Given('I am on "/main/admin/course_add.php"'),
new Given('I fill in "title" with "Password Protected"'),
new Given('I fill in "visual_code" with "' . $code . '"'),
new Given('I fill in "visibility" with "3"'),
new Given('I press "submit"'),
new Given('I am on "/main/course_info/infocours.php?cidReq=' . $code . '"'),
new Given('I should see "Course registration password"'),
new Given('I fill in "course_registration_password" with "' . $password . '"'),
new Given('I press "submit_save"'),
new Given('the "course_registration_password" field should contain "' . $password . '"')
];
}
/**
* @Given /^I am not logged$/
*/
public function iAmNotLogged()
{
return [
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage')
];
}
}

@ -34,3 +34,11 @@ Feature: Courses management as admin
When I follow "Delete"
Then I should see "Course list"
And I should not see "not be deleted"
Scenario: Enter to public password-protected course
Given I have a public password-protected course named "PASSWORDPROTECTED" with password "123456"
And I am not logged
And I am on "/courses/PASSWORDPROTECTED/index.php"
When I fill in "course_password" with "123456"
And I press "submit"
Then I should not see "The course password is incorrect"

Loading…
Cancel
Save