mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +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:
|
||||
| grade_report_showaverages | 0 |
|
||||
| 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
|
||||
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
|
||||
// already triggered by selectOption() to be finished.
|
||||
if ($this->running_javascript()) {
|
||||
// Trigger change event as this is needed by some drivers (Phantomjs, Mac-FF). Don't do it for
|
||||
// Singleselect as this will cause multiple event fire and lead to race-around condition.
|
||||
// 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);
|
||||
} catch (Exception $e) {
|
||||
// No need to do anything if element has been removed by JS.
|
||||
// This is possible when inline editing element is used.
|
||||
$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);
|
||||
|
@ -1539,4 +1539,22 @@ class behat_general extends behat_base {
|
||||
$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());
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user