Merge branch 'MDL-69138-35' of git://github.com/andrewnicols/moodle into MOODLE_35_STABLE

This commit is contained in:
Adrian Greeve
2020-07-22 16:51:59 +08:00
7 changed files with 29 additions and 19 deletions
+1 -1
View File
@@ -49,6 +49,6 @@ class behat_auth_email extends behat_base {
$confirmationpath = $confirmationurl->out_as_local_url(false);
$url = $confirmationpath . '?' . 'data='. $secret .'/'. $username;
$this->getSession()->visit($this->locate_path($url));
$this->execute('behat_general::i_visit', [$url]);
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ class behat_auth extends behat_base {
}
// Visit login page.
$this->getSession()->visit($this->locate_path($loginurl->out_as_local_url()));
$this->execute('behat_general::i_visit', [$loginurl]);
// Enter username and password.
$this->execute('behat_forms::i_set_the_field_to', array('Username', $this->escape($username)));
+3 -3
View File
@@ -56,7 +56,7 @@ class behat_backup extends behat_base {
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
$this->getSession()->visit($this->locate_path('/?redirect=0'));
$this->execute('behat_general::i_visit', ['/?redirect=0']);
$this->execute("behat_general::wait_until_the_page_is_ready");
// Click the course link.
@@ -98,7 +98,7 @@ class behat_backup extends behat_base {
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
$this->getSession()->visit($this->locate_path('/?redirect=0'));
$this->execute('behat_general::i_visit', ['/?redirect=0']);
// Click the course link.
$this->execute("behat_general::click_link", $backupcourse);
@@ -134,7 +134,7 @@ class behat_backup extends behat_base {
// table elements are used, and we need to catch exceptions contantly.
// Go to homepage.
$this->getSession()->visit($this->locate_path('/?redirect=0'));
$this->execute('behat_general::i_visit', ['/?redirect=0']);
$this->execute("behat_general::wait_until_the_page_is_ready");
// Click the course link.
+1 -1
View File
@@ -121,7 +121,7 @@ class behat_calendar extends behat_base {
*/
public function i_view_the_calendar_for($month, $year) {
$time = make_timestamp($year, $month, 1);
$this->getSession()->visit($this->locate_path('/calendar/view.php?view=month&course=1&time='.$time));
$this->execute('behat_general::i_visit', ['/calendar/view.php?view=month&course=1&time='.$time]);
}
}
+16 -4
View File
@@ -74,7 +74,7 @@ class behat_general extends behat_base {
* @Given /^I am on homepage$/
*/
public function i_am_on_homepage() {
$this->getSession()->visit($this->locate_path('/'));
$this->execute('behat_general::i_visit', ['/']);
}
/**
@@ -83,7 +83,7 @@ class behat_general extends behat_base {
* @Given /^I am on site homepage$/
*/
public function i_am_on_site_homepage() {
$this->getSession()->visit($this->locate_path('/?redirect=0'));
$this->execute('behat_general::i_visit', ['/?redirect=0']);
}
/**
@@ -92,7 +92,7 @@ class behat_general extends behat_base {
* @Given /^I am on course index$/
*/
public function i_am_on_course_index() {
$this->getSession()->visit($this->locate_path('/course/index.php'));
$this->execute('behat_general::i_visit', ['/course/index.php']);
}
/**
@@ -1005,7 +1005,7 @@ EOF;
* @Given /^I trigger cron$/
*/
public function i_trigger_cron() {
$this->getSession()->visit($this->locate_path('/admin/cron.php'));
$this->execute('behat_general::i_visit', ['/admin/cron.php']);
}
/**
@@ -1778,4 +1778,16 @@ EOF;
$value = ($shift == ' shift') ? [\WebDriver\Key::SHIFT . \WebDriver\Key::TAB] : [\WebDriver\Key::TAB];
$this->getSession()->getDriver()->getWebDriverSession()->activeElement()->postValue(['value' => $value]);
}
/**
* Visit a local URL relative to the behat root.
*
* @When I visit :localurl
*
* @param string|moodle_url $localurl The URL relative to the behat_wwwroot to visit.
*/
public function i_visit($localurl) {
$localurl = new moodle_url($localurl);
$this->getSession()->visit($this->locate_path($localurl->out_as_local_url(false)));
}
}
+1 -1
View File
@@ -486,7 +486,7 @@ EOF;
// Again, this would be better in the BeforeSuite hook, but that does not have access to the selectors in
// order to perform the necessary searches.
$session = $this->getSession();
$session->visit($this->locate_path('/'));
$this->execute('behat_general::i_visit', ['/']);
// Checking that the root path is a Moodle test site.
if (self::is_first_scenario()) {
+6 -8
View File
@@ -567,7 +567,7 @@ class behat_navigation extends behat_base {
}
}
$this->getSession()->visit($this->locate_path($url->out_as_local_url()));
$this->execute('behat_general::i_visit', [$url]);
}
// Restore global user variable.
@@ -590,8 +590,7 @@ class behat_navigation extends behat_base {
* @throws Exception if the specified page cannot be determined.
*/
public function i_am_on_page(string $page) {
$this->getSession()->visit($this->locate_path(
$this->resolve_page_helper($page)->out_as_local_url()));
$this->execute('behat_general::i_visit', [$this->resolve_page_helper($page)]);
}
/**
@@ -670,8 +669,7 @@ class behat_navigation extends behat_base {
* @throws Exception if the specified page cannot be determined.
*/
public function i_am_on_page_instance(string $identifier, string $type) {
$this->getSession()->visit($this->locate_path(
$this->resolve_page_instance_helper($identifier, $type)->out_as_local_url()));
$this->execute('behat_general::i_visit', [$this->resolve_page_instance_helper($identifier, $type)]);
}
/**
@@ -776,7 +774,7 @@ class behat_navigation extends behat_base {
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)));
$this->execute('behat_general::i_visit', [$url]);
}
/**
@@ -797,13 +795,13 @@ class behat_navigation extends behat_base {
// Javascript is running so it is possible to grab the session ket and jump straight to editing mode.
$url->param('edit', 1);
$url->param('sesskey', $sesskey);
$this->getSession()->visit($this->locate_path($url->out_as_local_url(false)));
$this->execute('behat_general::i_visit', [$url]);
return;
}
// Visit the course page.
$this->getSession()->visit($this->locate_path($url->out_as_local_url(false)));
$this->execute('behat_general::i_visit', [$url]);
try {
$this->execute("behat_forms::press_button", get_string('turneditingon'));