Skip to content

Commit

Permalink
MDL-58788 behat: backport of course navigation step
Browse files Browse the repository at this point in the history
These got introduced in master on
3353cfd / MDL-58265

It will be useful for third party devs sharing feature files between
multiple branches.
  • Loading branch information
danpoltawski committed May 3, 2017
1 parent b06b50c commit 9ddd0bd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
29 changes: 29 additions & 0 deletions admin/tool/behat/tests/behat/backported_step_definitions.feature
@@ -0,0 +1,29 @@
@tool @tool_behat
Feature: Backported behat step definitions
In order to provide feature file compatibility between multiple Moodle versions
As a developer
I need to be able to use backported steps from newer Moodle versiosn

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C101 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C101 | student |
| teacher1 | C101 | teacher |

Scenario: I am on the course homepage
When I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"

@javascript
Scenario: I am on the course homepage
When I log in as "teacher1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
14 changes: 14 additions & 0 deletions lib/tests/behat/behat_navigation.php
Expand Up @@ -574,4 +574,18 @@ public function i_open_my_profile_in_edit_mode() {
$USER = $globuser; $USER = $globuser;
} }


/**
* Opens the course homepage.
*
* @Given /^I am on "(?P<coursefullname_string>(?:[^"]|\\")*)" course homepage$/
* @throws coding_exception
* @param string $coursefullname The full name of the course.
* @return void
*/
public function i_am_on_course_homepage($coursefullname) {
global $DB;
$course = $DB->get_record("course", array("fullname" => $coursefullname), 'id', MUST_EXIST);
$url = new moodle_url('/course/view.php', ['id' => $course->id]);
$this->getSession()->visit($this->locate_path($url->out_as_local_url(false)));
}
} }
5 changes: 5 additions & 0 deletions lib/upgrade.txt
@@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs, This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers. information provided here is intended especially for developers.


=== 3.2.3 ===

* Behat compatibility changes are now being documented at
https://docs.moodle.org/dev/Acceptance_testing/Compatibility_changes

=== 3.2.2 === === 3.2.2 ===


* get_user_capability_course() now has an additional parameter 'limit'. This can be used to return a set number of records with * get_user_capability_course() now has an additional parameter 'limit'. This can be used to return a set number of records with
Expand Down

0 comments on commit 9ddd0bd

Please sign in to comment.