Add "I am a {language} user" and expose background context for tests

1.10.x
Yannick Warnier 9 years ago
parent 7adc126a8b
commit 2b95a8c296
  1. 10
      tests/features/bootstrap/FeatureContext.php
  2. 83
      tests/features/courseTools.feature
  3. 19
      tests/features/createCourse.feature

@ -178,4 +178,14 @@ class FeatureContext extends MinkContext
new Given('I should not see an ".alert-danger" element') new Given('I should not see an ".alert-danger" element')
); );
} }
/**
* @Given /^I am a "([^"]*)" user$/
*/
public function iAmAXUser($argument)
{
return array(
new Given('I am on "/main/auth/profile.php"'),
new Given('the "language" field should contain "' . $argument . '"')
);
}
} }

@ -1,164 +1,143 @@
# features/courseTools.feature # features/courseTools.feature
@common @common @tools
Feature: Course tools basic testing Feature: Course tools basic testing
In order to use a course In order to use a course
As a teacher As a teacher
I need to be able to enter a course and each of its tools I need to be able to enter a course and each of its tools
Scenario: Create a course before testing Background:
Given I am a platform administrator Given I am a platform administrator
And I am on "/main/admin/course_add.php" And I am a "English" user
# This is executed just before each scenario below
Scenario: Create a course before testing
Given I am on "/main/admin/course_add.php"
When I fill in "title" with "TEMP" When I fill in "title" with "TEMP"
And I press "submit" And I press "submit"
Then I should see "Course list" Then I should see "Course list"
Scenario: Make sure the course exists Scenario: Make sure the course exists
Given I am a platform administrator
Given course "TEMP" exists Given course "TEMP" exists
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the course description tool is available Scenario: Make sure the course description tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/course_description/index.php" And I am on "/main/course_description/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the documents tool is available Scenario: Make sure the documents tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/document/document.php" And I am on "/main/document/document.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the learning path tool is available Scenario: Make sure the learning path tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/newscorm/lp_controller.php" And I am on "/main/newscorm/lp_controller.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the links tool is available Scenario: Make sure the links tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/link/link.php" And I am on "/main/link/link.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the tests tool is available Scenario: Make sure the tests tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/exercice/exercice.php" And I am on "/main/exercice/exercice.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the announcements tool is available Scenario: Make sure the announcements tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/announcements/announcements.php" And I am on "/main/announcements/announcements.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the assessments tool is available Scenario: Make sure the assessments tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/gradebook/index.php" And I am on "/main/gradebook/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the glossary tool is available Scenario: Make sure the glossary tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/glossary/index.php" And I am on "/main/glossary/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the attendances tool is available Scenario: Make sure the attendances tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/attendances/index.php" And I am on "/main/attendances/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the course progress tool is available Scenario: Make sure the course progress tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/course_progress/index.php" And I am on "/main/course_progress/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the agenda tool is available Scenario: Make sure the agenda tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/calendar/agenda.php" And I am on "/main/calendar/agenda.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the forums tool is available Scenario: Make sure the forums tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/forum/index.php" And I am on "/main/forum/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the dropbox tool is available Scenario: Make sure the dropbox tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/dropbox/index.php" And I am on "/main/dropbox/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the users tool is available Scenario: Make sure the users tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/user/index.php" And I am on "/main/user/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the groups tool is available Scenario: Make sure the groups tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/group/group.php" And I am on "/main/group/group.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the chat tool is available Scenario: Make sure the chat tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/chat/index.php" And I am on "/main/chat/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the assignments tool is available Scenario: Make sure the assignments tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/work/work.php" And I am on "/main/work/work.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the surveys tool is available Scenario: Make sure the surveys tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/survey/index.php" And I am on "/main/survey/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the wiki tool is available Scenario: Make sure the wiki tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/wiki/index.php" And I am on "/main/wiki/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the notebook tool is available Scenario: Make sure the notebook tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/notebook/index.php" And I am on "/main/notebook/index.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the projects tool is available Scenario: Make sure the projects tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/blog/blog_admin.php" And I am on "/main/blog/blog_admin.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the reporting tool is available Scenario: Make sure the reporting tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/tracking/courseLog.php" And I am on "/main/tracking/courseLog.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the settings tool is available Scenario: Make sure the settings tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/course_info/infocours.php" And I am on "/main/course_info/infocours.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element
Scenario: Make sure the backup tool is available Scenario: Make sure the backup tool is available
Given I am a platform administrator
Given I am on course "TEMP" homepage Given I am on course "TEMP" homepage
Given I am on "/main/course_info/maintenance.php" And I am on "/main/course_info/maintenance.php"
Then I should not see an ".alert-danger" element Then I should not see an ".alert-danger" element

@ -4,32 +4,31 @@ Feature: Courses management as admin
As an administrator As an administrator
I need to be able to create new courses from the admin page I need to be able to create new courses from the admin page
Scenario: See the courses list Background:
Given I am a platform administrator Given I am a platform administrator
And I am on "/main/admin/course_list.php" # This is executed just before each scenario below
Scenario: See the courses list
Given I am on "/main/admin/course_list.php"
Then I should see "Course list" Then I should see "Course list"
And I should not see "not authorized" And I should not see "not authorized"
Scenario: See the course creation link on the admin page Scenario: See the course creation link on the admin page
Given I am a platform administrator Given I am on "/main/admin/index.php"
And I am on "/main/admin/index.php"
Then I should see "Create a course" Then I should see "Create a course"
Scenario: Access the course creation page Scenario: Access the course creation page
Given I am a platform administrator Given I am on "/main/admin/course_add.php"
And I am on "/main/admin/course_add.php"
Then I should not see "not authorized" Then I should not see "not authorized"
Scenario: Access the course creation page Scenario: Access the course creation page
Given I am a platform administrator Given I am on "/main/admin/course_add.php"
And I am on "/main/admin/course_add.php"
When I fill in "title" with "TESTCOURSE1" When I fill in "title" with "TESTCOURSE1"
And I press "submit" And I press "submit"
Then I should see "Course list" Then I should see "Course list"
Scenario: Search and delete a course Scenario: Search and delete a course
Given I am a platform administrator Given I am on "/main/admin/course_list.php"
And I am on "/main/admin/course_list.php"
And I fill in "course-search-keyword" with "TESTCOURSE1" And I fill in "course-search-keyword" with "TESTCOURSE1"
And I press "submit" And I press "submit"
When I follow "Delete" When I follow "Delete"

Loading…
Cancel
Save