Skip to content

Commit

Permalink
MDL-49412 Navigation: Remaining behat fixed for nav branch
Browse files Browse the repository at this point in the history
Behat is passing after this change.

Part of MDL-45774.
  • Loading branch information
Damyon Wiese authored and abgreeve committed Apr 10, 2015
1 parent 8e94fae commit 46a2fbc
Show file tree
Hide file tree
Showing 28 changed files with 73 additions and 48 deletions.
2 changes: 1 addition & 1 deletion admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
}
}

if ($user->id != $USER->id) {
if (!empty($user) && ($user->id != $USER->id)) {
$PAGE->navigation->extend_for_user($user);
$PAGE->navbar->includesettingsbase = true;
}
Expand Down
2 changes: 1 addition & 1 deletion backup/util/ui/tests/behat/backup_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ Feature: Backup Moodle courses
When I perform a quick backup of course "Course 2"
Then I should see "Restore course"
And I should see "Course backup area"
And I should see "backup-moodle2-course-"
And I should see "backup-moodle2-course-"
6 changes: 3 additions & 3 deletions backup/util/ui/tests/behat/behat_backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function i_backup_course_using_this_options($backupcourse, $options = fal
// table elements are used, and we need to catch exceptions contantly.

// Go to homepage.
$this->getSession()->visit($this->locate_path('/'));
$this->getSession()->visit($this->locate_path('/?redirect=0'));

// Click the course link.
$this->find_link($backupcourse)->click();
Expand Down Expand Up @@ -113,7 +113,7 @@ public function i_perform_a_quick_backup_of_course($backupcourse) {
// table elements are used, and we need to catch exceptions contantly.

// Go to homepage.
$this->getSession()->visit($this->locate_path('/'));
$this->getSession()->visit($this->locate_path('/?redirect=0'));

// Click the course link.
$this->find_link($backupcourse)->click();
Expand Down Expand Up @@ -151,7 +151,7 @@ public function i_import_course_into_course($fromcourse, $tocourse, $options = f
// table elements are used, and we need to catch exceptions contantly.

// Go to homepage.
$this->getSession()->visit($this->locate_path('/'));
$this->getSession()->visit($this->locate_path('/?redirect=0'));
$this->wait();

// Click the course link.
Expand Down
1 change: 1 addition & 0 deletions backup/util/ui/tests/behat/restore_moodle2_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: Restore Moodle 2 course backups
| assign | C3 | assign1 | Test assign name | Assign description | 1 |
| data | C3 | data1 | Test database name | Database description | 2 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I add a "Forum" to section "1" and I fill the form with:
Expand Down
28 changes: 14 additions & 14 deletions blocks/activity_modules/tests/behat/block_activity_modules.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,48 +34,48 @@ Feature: Block activity modules
| wiki | Frontpage wiki name | Frontpage wiki description | Acceptance test site | wiki0 |
| workshop | Frontpage workshop name | Frontpage workshop description | Acceptance test site | workshop0 |

And I am on homepage
And I am on site homepage
When I follow "Turn editing on"
And I add the "Activities" block
And I click on "Assignments" "link" in the "Activities" "block"
Then I should see "Frontpage assignment name"
And I am on homepage
And I am on site homepage
And I click on "Chats" "link" in the "Activities" "block"
And I should see "Frontpage chat name"
And I am on homepage
And I am on site homepage
And I click on "Choices" "link" in the "Activities" "block"
And I should see "Frontpage choice name"
And I am on homepage
And I am on site homepage
And I click on "Databases" "link" in the "Activities" "block"
And I should see "Frontpage database name"
And I am on homepage
And I am on site homepage
And I click on "Feedback" "link" in the "Activities" "block"
And I should see "Frontpage feedback name"
And I am on homepage
And I am on site homepage
And I click on "Forums" "link" in the "Activities" "block"
And I should see "Frontpage forum name"
And I am on homepage
And I am on site homepage
And I click on "External tools" "link" in the "Activities" "block"
And I should see "Frontpage lti name"
And I am on homepage
And I am on site homepage
And I click on "Quizzes" "link" in the "Activities" "block"
And I should see "Frontpage quiz name"
And I am on homepage
And I am on site homepage
And I click on "Glossaries" "link" in the "Activities" "block"
And I should see "Frontpage glossary name"
And I am on homepage
And I am on site homepage
And I click on "SCORM packages" "link" in the "Activities" "block"
And I should see "Frontpage scorm name"
And I am on homepage
And I am on site homepage
And I click on "Lessons" "link" in the "Activities" "block"
And I should see "Frontpage lesson name"
And I am on homepage
And I am on site homepage
And I click on "Wikis" "link" in the "Activities" "block"
And I should see "Frontpage wiki name"
And I am on homepage
And I am on site homepage
And I click on "Workshop" "link" in the "Activities" "block"
And I should see "Frontpage workshop name"
And I am on homepage
And I am on site homepage
And I click on "Resources" "link" in the "Activities" "block"
And I should see "Frontpage book name"
And I should see "Frontpage page name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Course summary block used on the frontpage

Background:
Given I log in as "admin"
And I am on site homepage
And I navigate to "Edit settings" node in "Front page settings"
And I set the following fields to these values:
| summary | Proved the summary block works! |
Expand All @@ -14,20 +15,20 @@ Feature: Course summary block used on the frontpage
# The course summary block a default front page block, so no need to add it.

Scenario: Guest can view site summary
When I am on homepage
When I am on site homepage
Then "Course/site summary" "block" should exist
And I should see "Proved the summary block works!" in the "Course/site summary" "block"

Scenario: Admin can see an edit icon when edit mode is on and follow it to the front page settings
When I log in as "admin"
And I am on homepage
And I am on site homepage
And I follow "Turn editing on"
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
And I click on "Edit" "link" in the "Course/site summary" "block"
Then I should see "Front page settings" in the "h2" "css_element"

Scenario: Admin can not see edit icon when edit mode is off
When I log in as "admin"
And I am on homepage
And I am on site homepage
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
And "Edit" "link" should not exist in the "Course/site summary" "block"
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Scenario: Admin can add random glossary block to the frontpage
| activity | name | intro | course | idnumber |
| glossary | Tips and Tricks | Frontpage glossary description | Acceptance test site | glossary0 |
And I log in as "admin"
And I am on site homepage
And I click on "Turn editing on" "link" in the "Administration" "block"
And I add the "Random glossary entry" block
And I configure the "block_glossary_random" block
Expand Down
2 changes: 2 additions & 0 deletions blocks/html/tests/behat/configuring_html_block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Feature: Adding and configuring HTML blocks
@javascript
Scenario: Configuring the HTML block with Javascript on
Given I log in as "admin"
And I am on site homepage
When I click on "Turn editing on" "link" in the "Administration" "block"
And I add the "HTML" block
And I configure the "(new HTML block)" block
Expand All @@ -23,6 +24,7 @@ Feature: Adding and configuring HTML blocks

Scenario: Configuring the HTML block with Javascript off
Given I log in as "admin"
And I am on site homepage
When I click on "Turn editing on" "link" in the "Administration" "block"
And I add the "HTML" block
And I configure the "(new HTML block)" block
Expand Down
1 change: 1 addition & 0 deletions blocks/html/tests/behat/multiple_instances.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Adding and configuring HTML blocks

Background:
Given I log in as "admin"
And I am on site homepage
When I click on "Turn editing on" "link" in the "Administration" "block"
And I add the "HTML" block

Expand Down
1 change: 1 addition & 0 deletions blocks/login/tests/behat/login_block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Feature: Login from a block
| username | password | firstname | lastname | email |
| testuser | testpass | Test | User | student1@asd.com |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Login" block

Expand Down
13 changes: 9 additions & 4 deletions blocks/navigation/tests/behat/expand_courses_node.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Feature: Expand the courses nodes within the navigation block
And the following config values are set as admin:
| navshowallcourses | 1 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 2"
And I turn editing mode on
And I click on "Edit settings" "link" in the "Administration" "block"
Expand Down Expand Up @@ -74,7 +75,8 @@ Feature: Expand the courses nodes within the navigation block
@javascript
Scenario: As the admin user I expand the courses and category nodes to see courses.
When I log in as "admin"
And I should see "Home" in the "Navigation" "block"
And I am on site homepage
And I should see "Site home" in the "Navigation" "block"
And I should see "Courses" in the "Navigation" "block"
And I expand "Courses" node
And I should see "cat1" in the "Navigation" "block"
Expand Down Expand Up @@ -107,7 +109,8 @@ Feature: Expand the courses nodes within the navigation block
@javascript
Scenario: As teacher1 I expand the courses and category nodes to see courses.
When I log in as "teacher1"
And I should see "Home" in the "Navigation" "block"
And I am on site homepage
And I should see "Site home" in the "Navigation" "block"
And I should see "Courses" in the "Navigation" "block"
And I expand "Courses" node
And I should see "cat1" in the "Navigation" "block"
Expand Down Expand Up @@ -136,7 +139,8 @@ Feature: Expand the courses nodes within the navigation block
@javascript
Scenario: As student1 I expand the courses and category nodes to see courses.
When I log in as "student1"
And I should see "Home" in the "Navigation" "block"
And I am on site homepage
And I should see "Site home" in the "Navigation" "block"
And I should see "Courses" in the "Navigation" "block"
And I expand "Courses" node
And I should see "cat1" in the "Navigation" "block"
Expand Down Expand Up @@ -164,6 +168,7 @@ Feature: Expand the courses nodes within the navigation block
@javascript
Scenario: As guest I expand the courses and category nodes to see courses.
When I log in as "guest"
And I am on site homepage
And I should see "Home" in the "Navigation" "block"
And I should see "Courses" in the "Navigation" "block"
And I expand "Courses" node
Expand All @@ -187,4 +192,4 @@ Feature: Expand the courses nodes within the navigation block
And navigation node "c1" should not be expandable
And navigation node "c2" should be expandable
And navigation node "c3" should not be expandable
And navigation node "c4" should not be expandable
And navigation node "c4" should not be expandable
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: People Block used in a course
| user | course | role |
| student1 | C101 | student |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I add the "People" block
Expand Down
1 change: 1 addition & 0 deletions blocks/tests/behat/add_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Feature: Add blocks
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
When I add the "Blog menu" block
Expand Down
5 changes: 3 additions & 2 deletions blocks/tests/behat/configure_block_throughout_site.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: Add and configure blocks throughout the site
| user | course | role |
| manager1 | Acceptance test site | manager |
And I log in as "manager1"
And I am on site homepage
And I follow "Turn editing on"
And I add the "Comments" block
And I configure the "Comments" block
Expand All @@ -24,7 +25,7 @@ Feature: Add and configure blocks throughout the site
When I follow "Course 1"
Then I should see "Comments" in the "Comments" "block"
And I should see "Save comment" in the "Comments" "block"
And I am on homepage
And I am on site homepage
And I configure the "Comments" block
And I set the following fields to these values:
| Default weight | -10 (first) |
Expand Down Expand Up @@ -60,7 +61,7 @@ Feature: Add and configure blocks throughout the site
@javascript
Scenario: Blocks can safely be customised
Given I log in as "admin"
And I click on "My home" "link" in the "Navigation" "block"
And I click on "Dashboard" "link" in the "Navigation" "block"
And I press "Customise this page"
And I add the "HTML" block
And I configure the "(new HTML block)" block
Expand Down
2 changes: 1 addition & 1 deletion blocks/tests/behat/hide_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Block visibility
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I follow "Turn editing on"

Expand Down
2 changes: 1 addition & 1 deletion blocks/tests/behat/manage_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Block appearances
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I follow "Turn editing on"
And I add a "Survey" to section "1" and I fill the form with:
Expand Down
2 changes: 1 addition & 1 deletion blocks/tests/behat/restrict_available_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Feature: Allowed blocks controls
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
| block/activity_modules:addinstance | Prohibit |
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I expand "Users" node
And I follow "Permissions"
Expand Down
1 change: 1 addition & 0 deletions blocks/tests/behat/return_block_original_state.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Feature: The context of a block can always be returned to it's original state.
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on site homepage
When I follow "Course 1"
And I follow "Turn editing on"
And I add the "Tags" block
Expand Down
2 changes: 2 additions & 0 deletions cohort/tests/behat/access_visible_cohorts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Feature: Access visible and hidden cohorts
@javascript
Scenario: System manager can see all cohorts defined in the above contexts
When I log in as "user1"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Enrolment methods" node in "Course administration > Users"
And I set the field "Add method" to "Cohort sync"
Expand Down Expand Up @@ -101,6 +102,7 @@ Feature: Access visible and hidden cohorts
@javascript
Scenario: Category manager can see all cohorts defined in his category and visible cohorts defined above
When I log in as "user2"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Enrolment methods" node in "Course administration > Users"
And I set the field "Add method" to "Cohort sync"
Expand Down
7 changes: 4 additions & 3 deletions cohort/tests/behat/upload_cohort_users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ Feature: Upload users to a cohort
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I add "Cohort sync" enrolment method with:
| Cohort | Cohort 1 |
And I am on homepage
And I am on site homepage
And I follow "Course 2"
And I add "Cohort sync" enrolment method with:
| Cohort | Cohort 2 |
Expand All @@ -35,14 +36,14 @@ Feature: Upload users to a cohort
And I click on "Assign" "link" in the "Cohort 2" "table_row"
And the "Current users" select box should contain "Mary Smith ([email protected])"
And the "Current users" select box should contain "Alice Smith ([email protected])"
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I expand "Users" node
And I follow "Enrolled users"
And I should see "Tom Jones"
And I should see "Bob Jones"
And I should not see "Mary Smith"
And I am on homepage
And I am on site homepage
And I follow "Course 2"
And I expand "Users" node
And I follow "Enrolled users"
Expand Down
2 changes: 1 addition & 1 deletion course/tests/behat/add_activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Feature: Add activities to courses
Scenario: Set activity description to required then add an activity supplying only the name
Given I set the following administration settings values:
| requiremodintro | Yes |
When I follow "Home"
When I am on site homepage
And I follow "Course 1"
And I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
Expand Down
2 changes: 2 additions & 0 deletions files/tests/behat/course_files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Feature: Course files
| legacyfilesinnewcourses | 1 |
| legacyfilesaddallowed | 1 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
Then I should see "Legacy course files"
And I follow "Legacy course files"
Expand All @@ -29,6 +30,7 @@ Feature: Course files
| legacyfilesinnewcourses | 1 |
| legacyfilesaddallowed | 0 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
Then I should see "Legacy course files"
And I follow "Legacy course files"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Feature: Publish rubrics as templates
| user | role | contextlevel | reference |
| manager1 | manager | System | |
And I log in as "manager1"
And I am on site homepage
And I follow "Course 1"
And I go to "Test assignment 1 name" advanced grading definition page
And I set the following fields to these values:
Expand Down
Loading

0 comments on commit 46a2fbc

Please sign in to comment.