mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-54589 behat: Added hack for some OS/browsers
This commit is contained in:
parent
6a021f59f3
commit
fba0ac63b8
@ -47,7 +47,8 @@ Feature: Using the AJAX grading feature of Grader report to update grades and fe
|
|||||||
And the following config values are set as admin:
|
And the following config values are set as admin:
|
||||||
| grade_report_showaverages | 0 |
|
| grade_report_showaverages | 0 |
|
||||||
| grade_report_enableajax | 1 |
|
| grade_report_enableajax | 1 |
|
||||||
|
# Floating headers can fail to set value on some OS/Browsers, so do this test on large screens.
|
||||||
|
And I change window size to "large"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Use the grader report without editing, with AJAX on and quick feedback off
|
Scenario: Use the grader report without editing, with AJAX on and quick feedback off
|
||||||
|
@ -71,15 +71,24 @@ class behat_form_select extends behat_form_field {
|
|||||||
// Wait for all the possible AJAX requests that have been
|
// Wait for all the possible AJAX requests that have been
|
||||||
// already triggered by selectOption() to be finished.
|
// already triggered by selectOption() to be finished.
|
||||||
if ($this->running_javascript()) {
|
if ($this->running_javascript()) {
|
||||||
// Trigger change event as this is needed by some drivers (Phantomjs, Mac-FF). Don't do it for
|
// Trigger change event and click on first skip link, as some OS/browsers (Phantomjs, Mac-FF),
|
||||||
// Singleselect as this will cause multiple event fire and lead to race-around condition.
|
// don't close select option field and trigger event.
|
||||||
if (!$singleselect) {
|
if (!$singleselect) {
|
||||||
|
$dialoguexpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue-focused ')]";
|
||||||
|
if (!$node = $this->session->getDriver()->find($dialoguexpath)) {
|
||||||
$script = "Syn.trigger('change', {}, {{ELEMENT}})";
|
$script = "Syn.trigger('change', {}, {{ELEMENT}})";
|
||||||
try {
|
try {
|
||||||
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
|
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
|
||||||
} catch (Exception $e) {
|
$this->session->getDriver()->click('//body//div[@class="skiplinks"]');
|
||||||
// No need to do anything if element has been removed by JS.
|
} catch (\Exception $e) {
|
||||||
// This is possible when inline editing element is used.
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$this->session->getDriver()->click($dialoguexpath);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
|
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
|
||||||
|
@ -1539,4 +1539,22 @@ class behat_general extends behat_base {
|
|||||||
$node->keyPress($char, $modifier);
|
$node->keyPress($char, $modifier);
|
||||||
$node->keyUp($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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,7 @@ Feature: In an assignment, teacher can annotate PDF files during grading
|
|||||||
And I follow "View all submissions"
|
And I follow "View all submissions"
|
||||||
And I click on "Edit" "link" in the "Student 2" "table_row"
|
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 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 click on ".linebutton" "css_element"
|
||||||
And I draw on the pdf
|
And I draw on the pdf
|
||||||
And I press "Save changes"
|
And I press "Save changes"
|
||||||
|
@ -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 "Test assignment name"
|
||||||
And I follow "View all submissions"
|
And I follow "View all submissions"
|
||||||
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
|
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 click on ".navigate-next-button" "css_element"
|
||||||
|
And I wait until the page is ready
|
||||||
And I click on ".stampbutton" "css_element"
|
And I click on ".stampbutton" "css_element"
|
||||||
And I draw on the pdf
|
And I draw on the pdf
|
||||||
And I wait until the page is ready
|
And I wait until the page is ready
|
||||||
|
@ -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 quiz has a time limit of 1 hour. Time will "
|
||||||
And I should see "The password entered was incorrect"
|
And I should see "The password entered was incorrect"
|
||||||
And I set the field "Quiz password" to "Frog"
|
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 press "Start attempt"
|
||||||
And I should see "Text of the first question"
|
And I should see "Text of the first question"
|
||||||
|
|
||||||
@ -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 quiz has a time limit of 1 hour. Time will "
|
||||||
And I should see "The password entered was incorrect"
|
And I should see "The password entered was incorrect"
|
||||||
And I set the field "Quiz password" to "Frog"
|
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"
|
And I press "Cancel"
|
||||||
Then I should see "Quiz 1 description"
|
Then I should see "Quiz 1 description"
|
||||||
And "Attempt quiz now" "button" should be visible
|
And "Attempt quiz now" "button" should be visible
|
||||||
|
Loading…
x
Reference in New Issue
Block a user