Merge branch 'MDL-42625_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2013-12-10 23:29:06 +01:00
commit ebc77165a4
51 changed files with 991 additions and 335 deletions

View file

@ -38,7 +38,7 @@ Feature: Backup Moodle courses
And I press "Continue"
And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exists
And I check "Include course logs"
And "Include course logs" "checkbox" should exists
And I press "Next"
@javascript

View file

@ -56,27 +56,32 @@ class behat_backup extends behat_base {
// Go to homepage.
$this->getSession()->visit($this->locate_path('/'));
$this->wait();
// Click the course link.
$this->find_link($backupcourse)->click();
$this->wait();
// Click the backup link.
$this->find_link(get_string('backup'))->click();
$this->wait();
// Initial settings.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('backupstage1action', 'backup'))->press();
$this->wait();
// Schema settings.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('backupstage2action', 'backup'))->press();
$this->wait();
// Confirmation and review, backup filename can also be specified.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('backupstage4action', 'backup'))->press();
// Waiting for it to finish.
$this->wait(10);
$this->wait(self::EXTENDED_TIMEOUT);
// Last backup continue button.
$this->find_button(get_string('backupstage16action', 'backup'))->press();
@ -101,12 +106,15 @@ class behat_backup extends behat_base {
// Go to homepage.
$this->getSession()->visit($this->locate_path('/'));
$this->wait();
// Click the course link.
$this->find_link($tocourse)->click();
$this->wait();
// Click the import link.
$this->find_link(get_string('import'))->click();
$this->wait();
// Select the course.
$exception = new ExpectationException('"' . $fromcourse . '" course not found in the list of courses to import from', $this->getSession());
@ -121,18 +129,21 @@ class behat_backup extends behat_base {
$radionode->click();
$this->find_button(get_string('continue'))->press();
$this->wait();
// Initial settings.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('importbackupstage1action', 'backup'))->press();
$this->wait();
// Schema settings.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('importbackupstage2action', 'backup'))->press();
$this->wait();
// Run it.
$this->find_button(get_string('importbackupstage4action', 'backup'))->press();
$this->wait();
$this->wait(self::EXTENDED_TIMEOUT);
// Continue and redirect to 'to' course.
$this->find_button(get_string('continue'))->press();
@ -294,17 +305,22 @@ class behat_backup extends behat_base {
// Settings.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('restorestage4action', 'backup'))->press();
$this->wait();
// Schema.
$this->fill_backup_restore_form($options);
$this->find_button(get_string('restorestage8action', 'backup'))->press();
$this->wait();
// Review, no options here.
$this->find_button(get_string('restorestage16action', 'backup'))->press();
$this->wait(10);
$this->wait();
// Last restore continue button, redirected to restore course after this.
$this->find_button(get_string('restorestage32action', 'backup'))->press();
// Long wait when waiting for the restore to finish.
$this->wait(self::EXTENDED_TIMEOUT);
}
/**
@ -325,11 +341,15 @@ class behat_backup extends behat_base {
return;
}
// Wait for the page to be loaded and the JS ready.
$this->wait();
// If we find any of the provided options in the current form we should set the value.
$datahash = $options->getRowsHash();
foreach ($datahash as $locator => $value) {
try {
// Using $this->find* to enforce stability over speed.
$fieldnode = $this->find_field($locator);
$field = behat_field_manager::get_form_field($fieldnode, $this->getSession());
$field->set_value($value);
@ -341,9 +361,9 @@ class behat_backup extends behat_base {
}
/**
* Waits until the DOM is ready.
* Waits until the DOM and the page Javascript code is ready.
*
* @param int To override the default timeout
* @param int $timeout The number of seconds that we wait.
* @return void
*/
protected function wait($timeout = false) {
@ -355,7 +375,8 @@ class behat_backup extends behat_base {
if (!$timeout) {
$timeout = self::TIMEOUT;
}
$this->getSession()->wait($timeout, '(document.readyState === "complete")');
$this->getSession()->wait($timeout * 1000, self::PAGE_READY_JS);
}
}

View file

@ -21,8 +21,8 @@ Feature: Duplicate activities
And I add a "Database" to section "1" and I fill the form with:
| Name | Test database name |
| Description | Test database description |
And I open "Test database name" actions menu
When I click on "Duplicate" "link" in the "Test database name" activity
And I duplicate "Test database name" activity
And I wait until section "1" is available
And I open "Test database name" actions menu
And I click on "Edit settings" "link" in the "Test database name" activity
And I fill the moodle form with: