MDL-55074 behat: Fixed new theme related changes

This commit is contained in:
Rajesh Taneja 2016-10-25 13:48:51 +08:00
parent 6858c7acec
commit c99dffb69c
No known key found for this signature in database
GPG Key ID: B363F7FB787F80E4
5 changed files with 24 additions and 31 deletions

View File

@ -11,18 +11,19 @@ Feature: Block visibility
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I follow "Turn editing on"
And I turn editing mode on
@javascript
Scenario: Hiding all blocks on the page should remove the column they're in
Given I open the "Search forums" blocks action menu
Given I add the "Search forums" block
And I open the "Search forums" blocks action menu
And I click on "Configure Search forums block" "link" in the "Search forums" "block"
And I set the field "Region" to "Right"
And I press "Save changes"
And I turn editing mode off
And ".empty-region-side-post" "css_element" should not exist in the "body" "css_element"
And I turn editing mode on
And I open the "Search forums" blocks action menu
And I click on "Hide Search forums block" "link" in the "Search forums" "block"
And I open the "Latest announcements" blocks action menu
And I click on "Hide Latest announcements block" "link" in the "Latest announcements" "block"
And I open the "Upcoming events" blocks action menu
And I click on "Hide Upcoming events block" "link" in the "Upcoming events" "block"
And I open the "Recent activity" blocks action menu
When I click on "Hide Recent activity block" "link" in the "Recent activity" "block"
Then ".empty-region-side-post" "css_element" should not exist in the "body" "css_element"
And I follow "Turn editing off"
And ".empty-region-side-post" "css_element" should exist in the "body" "css_element"

View File

@ -14,7 +14,7 @@ Feature: The context of a block can always be returned to it's original state.
And I follow "Turn editing on"
And I add the "Tags" block
Then I should see "Tags" in the "Tags" "block"
And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element"
And I click on "Participants" "link" in the "//li[p/a[contains(normalize-space(string(.)), 'Courses')]]" "xpath_element"
And I configure the "Tags" block
And I set the following fields to these values:
| Display on page types | Any page |
@ -31,7 +31,7 @@ Feature: The context of a block can always be returned to it's original state.
And I should see "Tags" in the "Tags" "block"
And I follow "Course 1"
And "Tags" "block" should not exist
And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element"
And I navigate to "Participants" node in "Courses > C1"
And "Tags" "block" should not exist
And I follow "Course 1"
And I add a "Assignment" to section "1" and I fill the form with:
@ -45,5 +45,5 @@ Feature: The context of a block can always be returned to it's original state.
And I press "Save changes"
And I follow "Course 1"
And I should see "Tags" in the "Tags" "block"
And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element"
And I navigate to "Participants" node in "Courses > C1"
And I should see "Tags" in the "Tags" "block"

View File

@ -48,7 +48,11 @@ class behat_course extends behat_base {
*/
public function i_turn_editing_mode_on() {
$this->execute("behat_forms::press_button", get_string('turneditingon'));
try {
$this->execute("behat_forms::press_button", get_string('turneditingon'));
} catch (Exception $e) {
$this->execute("behat_general::i_click_on_in_the", [get_string('turneditingon'), 'link', 'Administration', 'block']);
}
}
/**
@ -57,7 +61,11 @@ class behat_course extends behat_base {
*/
public function i_turn_editing_mode_off() {
$this->execute("behat_forms::press_button", get_string('turneditingoff'));
try {
$this->execute("behat_forms::press_button", get_string('turneditingoff'));
} catch (Exception $e) {
$this->execute("behat_general::i_click_on_in_the", [get_string('turneditingoff'), 'link', 'Administration', 'block']);
}
}
/**

View File

@ -330,7 +330,7 @@ class behat_navigation extends behat_base {
"/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" .
"/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" .
"[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" .
"/span[normalize-space(.)=" . $nodetextliteral ."]]" .
"[span[normalize-space(.)=" . $nodetextliteral ."] or a[normalize-space(.)=" . $nodetextliteral ."]]]" .
"|" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' content ')]/div" .
"/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .

View File

@ -248,22 +248,6 @@ class behat_theme_boost_behat_course extends behat_course {
$actionnode->click();
}
public function i_turn_editing_mode_on() {
try {
$this->execute("behat_forms::press_button", get_string('turneditingon'));
} catch (Exception $e) {
$this->execute("behat_general::i_click_on_in_the", [get_string('turneditingon'), 'link', 'Administration', 'block']);
}
}
public function i_turn_editing_mode_off() {
try {
$this->execute("behat_forms::press_button", get_string('turneditingoff'));
} catch (Exception $e) {
$this->execute("behat_general::i_click_on_in_the", [get_string('turneditingoff'), 'link', 'Administration', 'block']);
}
}
protected function is_course_editor() {
// We don't need to behat_base::spin() here as all is already loaded.