Permalink
Browse files

MDL-58788 behat: backport of course navigation step

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 9ddd0bd72a6a26826b66ebf9998e0f86b16648a4
@@ -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"
@@ -574,4 +574,18 @@ public function i_open_my_profile_in_edit_mode() {
$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)));
}
}
View
@@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs,
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 ===
* get_user_capability_course() now has an additional parameter 'limit'. This can be used to return a set number of records with

0 comments on commit 9ddd0bd

Please sign in to comment.