MDL-45294 behat: Updating block references to aria label value

Also improving moodle selectors xpath expressions
readability.
This commit is contained in:
David Monllao
2014-05-20 20:56:18 +08:00
committed by Marina Glancy
parent f335645600
commit 64c1ec38d6
3 changed files with 17 additions and 13 deletions
@@ -25,19 +25,19 @@ Feature: Course summary block used in a course
Scenario: Student can view course summary
When I log in as "student1"
And I follow "Course 1"
Then "block_course_summary" "block" should exist
And I should see "Proved the course summary block works!" in the "block_course_summary" "block"
Then "Course/site summary" "block" should exist
And I should see "Proved the course summary block works!" in the "Course/site summary" "block"
Scenario: Teacher can see an edit icon when edit mode is on and follow it to the course edit page
When I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
Then I should see "Proved the course summary block works!" in the "block_course_summary" "block"
And I click on "Edit" "link" in the "block_course_summary" "block"
Then I should see "Proved the course summary block works!" in the "Course/site summary" "block"
And I click on "Edit" "link" in the "Course/site summary" "block"
Then I should see "Edit course settings" in the "h2" "css_element"
Scenario: Teacher can not see edit icon when edit mode is off
When I log in as "teacher1"
And I follow "Course 1"
Then I should see "Proved the course summary block works!" in the "block_course_summary" "block"
And "Edit" "link" should not exist in the "block_course_summary" "block"
Then I should see "Proved the course summary block works!" in the "Course/site summary" "block"
And "Edit" "link" should not exist in the "Course/site summary" "block"
@@ -15,19 +15,19 @@ Feature: Course summary block used on the frontpage
Scenario: Guest can view site summary
When I am on homepage
Then "block_course_summary" "block" should exist
And I should see "Proved the summary block works!" in the "block_course_summary" "block"
Then "Course/site summary" "block" should exist
And I should see "Proved the summary block works!" in the "Course/site summary" "block"
Scenario: Admin can see an edit icon when edit mode is on and follow it to the front page settings
When I log in as "admin"
And I am on homepage
And I follow "Turn editing on"
Then I should see "Proved the summary block works!" in the "block_course_summary" "block"
And I click on "Edit" "link" in the "block_course_summary" "block"
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
And I click on "Edit" "link" in the "Course/site summary" "block"
Then I should see "Front page settings" in the "h2" "css_element"
Scenario: Admin can not see edit icon when edit mode is off
When I log in as "teacher1"
And I am on homepage
Then I should see "Proved the summary block works!" in the "block_course_summary" "block"
And "Edit" "link" should not exist in the "block_course_summary" "block"
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
And "Edit" "link" should not exist in the "Course/site summary" "block"
+5 -1
View File
@@ -91,7 +91,11 @@ class behat_selectors {
normalize-space(descendant::div[@class='hd']) = %locator%]
XPATH
, 'block' => <<<XPATH
//div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', %locator%, ' '))] | //div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]/descendant::h2[normalize-space(.) = %locator%]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')] | //div[contains(concat(' ', normalize-space(@class), ' '), ' block ')][@aria-label = %locator% ]
//div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', %locator%, ' '))] |
//div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]
/descendant::h2[normalize-space(.) = %locator%]
/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')] |
//div[contains(concat(' ', normalize-space(@class), ' '), ' block ')][@aria-label = %locator% ]
XPATH
, 'region' => <<<XPATH
.//*[self::div | self::section | self::aside][./@id = %locator%]