Skip to content

Commit

Permalink
Merge branch 'wip-mdl-54589-m31' of https://github.com/rajeshtaneja/m…
Browse files Browse the repository at this point in the history
…oodle into MOODLE_31_STABLE
  • Loading branch information
stronk7 committed Jun 21, 2016
2 parents 50804bc + 6bf8caa commit 2579f5f
Show file tree
Hide file tree
Showing 21 changed files with 183 additions and 118 deletions.
@@ -1,4 +1,4 @@
@block @block_private_files @file_upload @javascript
@block @block_private_files @_file_upload @javascript
Feature: The private files block allows users to store files privately in moodle
In order to store a private file in moodle
As a user
Expand Down
@@ -1,4 +1,4 @@
@block @block_private_files @file_upload
@block @block_private_files @_file_upload
Feature: The private files block allows users to store files privately in moodle
In order to store a private file in moodle
As a teacher
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -2,6 +2,6 @@
"require-dev": {
"phpunit/phpunit": "4.8.*",
"phpunit/dbUnit": "1.4.*",
"moodlehq/behat-extension": "3.31.2"
"moodlehq/behat-extension": "3.31.3"
}
}
205 changes: 105 additions & 100 deletions composer.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions enrol/tests/behat/behat_enrol.php
Expand Up @@ -58,6 +58,9 @@ public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {
array($this->escape($enrolmethod), get_string('addinstance', 'enrol'))
);

// Wait again, for page to reloaded.
$this->execute('behat_general::i_wait_to_be_redirected');

// Set form fields.
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $table);

Expand Down
1 change: 0 additions & 1 deletion grade/report/grader/tests/behat/ajax_grader.feature
Expand Up @@ -48,7 +48,6 @@ Feature: Using the AJAX grading feature of Grader report to update grades and fe
| grade_report_showaverages | 0 |
| grade_report_enableajax | 1 |


@javascript
Scenario: Use the grader report without editing, with AJAX on and quick feedback off
When the following config values are set as admin:
Expand Down
Expand Up @@ -402,6 +402,11 @@ FloatingHeaders.prototype = {
return this;
}

if (M.cfg.behatsiterunning) {
// If the behat site is running we don't want floating elements.
return;
}

// Generate floating elements.
this._setupFloatingUserColumn();
this._setupFloatingUserHeader();
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -402,6 +402,11 @@ FloatingHeaders.prototype = {
return this;
}

if (M.cfg.behatsiterunning) {
// If the behat site is running we don't want floating elements.
return;
}

// Generate floating elements.
this._setupFloatingUserColumn();
this._setupFloatingUserHeader();
Expand Down
Expand Up @@ -259,6 +259,11 @@ FloatingHeaders.prototype = {
return this;
}

if (M.cfg.behatsiterunning) {
// If the behat site is running we don't want floating elements.
return;
}

// Generate floating elements.
this._setupFloatingUserColumn();
this._setupFloatingUserHeader();
Expand Down
4 changes: 3 additions & 1 deletion group/clientlib.js
Expand Up @@ -208,7 +208,9 @@ var removeLoaderImgs = function (elClass, parentId) {
var parentEl = document.getElementById(parentId);
if (parentEl) {
var loader = document.getElementById("loaderImg");
parentEl.removeChild(loader);
if (loader) {
parentEl.removeChild(loader);
}
}
};

Expand Down
28 changes: 18 additions & 10 deletions lib/behat/form_field/behat_form_select.php
Expand Up @@ -71,16 +71,24 @@ public function set_value($value) {
// Wait for all the possible AJAX requests that have been
// already triggered by selectOption() to be finished.
if ($this->running_javascript()) {
// Trigger change event as this is needed by some drivers (Phantomjs). Don't do it for
// Singleselect as this will cause multiple event fire and lead to race-around condition.
$browser = \Moodle\BehatExtension\Driver\MoodleSelenium2Driver::getBrowser();
if (!$singleselect && ($browser == 'phantomjs')) {
$script = "Syn.trigger('change', {}, {{ELEMENT}})";
try {
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
} catch (Exception $e) {
// No need to do anything if element has been removed by JS.
// This is possible when inline editing element is used.
// Trigger change event and click on first skip link, as some OS/browsers (Phantomjs, Mac-FF),
// don't close select option field and trigger event.
if (!$singleselect) {
$dialoguexpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue-focused ')]";
if (!$node = $this->session->getDriver()->find($dialoguexpath)) {
$script = "Syn.trigger('change', {}, {{ELEMENT}})";
try {
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
$this->session->getDriver()->click('//body//div[@class="skiplinks"]');
} catch (\Exception $e) {
return;
}
} else {
try {
$this->session->getDriver()->click($dialoguexpath);
} catch (\Exception $e) {
return;
}
}
}
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
Expand Down
18 changes: 18 additions & 0 deletions lib/tests/behat/behat_general.php
Expand Up @@ -1541,4 +1541,22 @@ public function i_press_key_in_element($key, $element, $selectortype) {
$node->keyPress($char, $modifier);
$node->keyUp($char, $modifier);
}

/**
* Press tab key on a specific element.
*
* @When /^I press tab key in "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)"$/
* @param string $element Element we look for
* @param string $selectortype The type of what we look for
* @throws DriverException
* @throws ExpectationException
*/
public function i_post_tab_key_in_element($element, $selectortype) {
if (!$this->running_javascript()) {
throw new DriverException('Tab press step is not available with Javascript disabled');
}
// Gets the node based on the requested selector type and locator.
$node = $this->get_selected_node($selectortype, $element);
$this->getSession()->getDriver()->post_key("\xEE\x80\x84", $node->getXpath());
}
}
Expand Up @@ -129,6 +129,7 @@ Feature: In an assignment, teacher can annotate PDF files during grading
And I follow "View all submissions"
And I click on "Edit" "link" in the "Student 2" "table_row"
And I click on "Grade" "link" in the "Student 2" "table_row"
And I wait until the page is ready
And I click on ".linebutton" "css_element"
And I draw on the pdf
And I press "Save changes"
Expand Down
Expand Up @@ -51,7 +51,9 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I wait until the page is ready
And I click on ".navigate-next-button" "css_element"
And I wait until the page is ready
And I click on ".stampbutton" "css_element"
And I draw on the pdf
And I wait until the page is ready
Expand Down
1 change: 1 addition & 0 deletions mod/assign/tests/behat/quickgrading.feature
Expand Up @@ -40,6 +40,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I wait until the page is ready
And I press "Save changes"
And I press "Ok"
And I click on "Edit settings" "link"
Expand Down
3 changes: 3 additions & 0 deletions mod/feedback/tests/behat/behat_mod_feedback.php
Expand Up @@ -54,6 +54,9 @@ public function i_add_question_to_the_feedback_with($questiontype, TableNode $qu

$this->execute('behat_forms::i_select_from_the_singleselect', array($questiontype, $additem));

// Wait again, for page to reloaded.
$this->execute('behat_general::i_wait_to_be_redirected');

$rows = $questiondata->getRows();
$modifiedrows = array();
foreach ($rows as $row) {
Expand Down
2 changes: 2 additions & 0 deletions mod/forum/tests/behat/discussion_navigation.feature
Expand Up @@ -39,9 +39,11 @@ Feature: A user can navigate to previous and next discussions
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 1 |
| Message | Test post message |
And I wait "1" seconds
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 2 |
| Message | Test post message |
And I wait "1" seconds
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 3 |
| Message | Test post message |
Expand Down
4 changes: 4 additions & 0 deletions mod/quiz/tests/behat/attempt_begin.feature
Expand Up @@ -88,6 +88,8 @@ Feature: The various checks that may happen when an attept is started
And I should see "The quiz has a time limit of 1 hour. Time will "
And I should see "The password entered was incorrect"
And I set the field "Quiz password" to "Frog"
# On Mac/FF tab key is needed as text field in dialogue and page have same id.
And I press tab key in "Quiz password" "field"
And I press "Start attempt"
And I should see "Text of the first question"

Expand All @@ -110,6 +112,8 @@ Feature: The various checks that may happen when an attept is started
And I should see "The quiz has a time limit of 1 hour. Time will "
And I should see "The password entered was incorrect"
And I set the field "Quiz password" to "Frog"
# On Mac/FF tab key is needed as text field in dialogue and page have same id.
And I press tab key in "Quiz password" "field"
And I press "Cancel"
Then I should see "Quiz 1 description"
And "Attempt quiz now" "button" should be visible
1 change: 1 addition & 0 deletions mod/quiz/tests/behat/editing_add.feature
Expand Up @@ -153,6 +153,7 @@ Feature: Edit quiz page - adding things

# Create the Essay 03 question.
And I set the field "Select a category" to "Default for C1"
And I wait until the page is ready
When I press "Create a new question ..."
And I set the field "qtype_qtype_essay" to "1"
And I press "Add"
Expand Down
1 change: 1 addition & 0 deletions report/eventlist/tests/behat/mainsection.feature
Expand Up @@ -10,6 +10,7 @@ Feature: Page contains a list of events
And I navigate to "Events list" node in "Site administration > Reports"
And I should see "Event name"
And I set the field "eventname" to "phase"
And I press "filterbutton"
And I should see "Phase switched"
And I should not see "Comment created"
And I press "clearbutton"
Expand Down

0 comments on commit 2579f5f

Please sign in to comment.