mirror of
https://github.com/moodle/moodle.git
synced 2025-05-01 06:01:12 +02:00
MDL-42013 behat: I should (not)? see checking visibility
Only for non-Javascript tests. If the step is named I should/should not see whatever is makes sense that has to be visible.
This commit is contained in:
parent
835a006b07
commit
e9af3ed361
@ -31,5 +31,5 @@ Feature: Import course's contents into another course
|
||||
When I import "Course 1" course into "Course 2" course using this options:
|
||||
Then I should see "Test database name"
|
||||
And I should see "Test forum name"
|
||||
And I should see "Comments"
|
||||
And I should see "Comments" in the "Comments" "block"
|
||||
And I should see "Recent blog entries"
|
||||
|
@ -23,7 +23,7 @@ Feature: Restore Moodle 2 course backups
|
||||
| Filename | test_backup.mbz |
|
||||
And I restore "test_backup.mbz" backup into "Course 2" course using this options:
|
||||
Then I should see "Course 2"
|
||||
And I should see "Community finder"
|
||||
And I should see "Community finder" in the "Community finder" "block"
|
||||
And I should see "Test forum name"
|
||||
|
||||
@javascript
|
||||
@ -33,7 +33,7 @@ Feature: Restore Moodle 2 course backups
|
||||
And I restore "test_backup.mbz" backup into a new course using this options:
|
||||
| Course name | Course 1 restored in a new course |
|
||||
Then I should see "Course 1 restored in a new course"
|
||||
And I should see "Community finder"
|
||||
And I should see "Community finder" in the "Community finder" "block"
|
||||
And I should see "Test forum name"
|
||||
And I follow "Edit settings"
|
||||
And I expand all fieldsets
|
||||
@ -51,7 +51,7 @@ Feature: Restore Moodle 2 course backups
|
||||
| setting_section_section_5_userinfo | 0 |
|
||||
Then I should see "Course 1"
|
||||
And I should not see "Section 3"
|
||||
And I should see "Community finder"
|
||||
And I should see "Community finder" in the "Community finder" "block"
|
||||
And I should see "Test forum name"
|
||||
|
||||
@javascript
|
||||
@ -69,7 +69,7 @@ Feature: Restore Moodle 2 course backups
|
||||
Then I should see "Course 1"
|
||||
And I should not see "Section 3"
|
||||
And I should not see "Test forum post backup name"
|
||||
And I should see "Community finder"
|
||||
And I should see "Community finder" in the "Community finder" "block"
|
||||
And I should see "Test forum name"
|
||||
|
||||
@javascript
|
||||
|
@ -23,8 +23,8 @@ Feature: Add and configure blocks throughout the site
|
||||
| Page contexts | Display throughout the entire site |
|
||||
And I press "Save changes"
|
||||
When I follow "Course 1"
|
||||
Then I should see "Comments"
|
||||
And I should see "Save comment"
|
||||
Then I should see "Comments" in the "Comments" "block"
|
||||
And I should see "Save comment" in the "Comments" "block"
|
||||
And I am on homepage
|
||||
And I follow "Configure Comments block"
|
||||
And I fill the moodle form with:
|
||||
|
@ -22,8 +22,8 @@ Feature: Allowed blocks controls
|
||||
And I turn editing mode on
|
||||
When I add the "Course completion status" block
|
||||
And I add the "Activities" block
|
||||
Then I should see "Activities"
|
||||
And I should see "Course completion status"
|
||||
Then I should see "Activities" in the "Activities" "block"
|
||||
And I should see "Course completion status" in the "Course completion status" "block"
|
||||
|
||||
@javascript
|
||||
Scenario: Blocks can not be added when the admin restricts the permissions
|
||||
|
@ -95,47 +95,47 @@ Feature: Course category management interface performs as expected
|
||||
And I log in as "admin"
|
||||
And I go to the courses management page
|
||||
And I should see the "Course categories" management page
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should not see "Cat 1-1"
|
||||
And I should not see "Cat 1-2"
|
||||
And I should not see "Cat 1-1-1"
|
||||
And I should not see "Cat 1-1-2"
|
||||
And I should not see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click on "Cat 1" "link"
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should not see "Cat 1-1-1"
|
||||
And I should not see "Cat 1-1-2"
|
||||
And I should not see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click on "Cat 1-1" "link"
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should see "Cat 1-1-1"
|
||||
And I should see "Cat 1-1-2"
|
||||
And I should not see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click on "Cat 2" "link"
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should not see "Cat 1-1"
|
||||
And I should not see "Cat 1-2"
|
||||
And I should not see "Cat 1-1-1"
|
||||
And I should not see "Cat 1-1-2"
|
||||
And I should see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
|
||||
# This is similar to the above scenario except here we are going to use AJAX
|
||||
# to load the categories.
|
||||
@ -165,74 +165,74 @@ Feature: Course category management interface performs as expected
|
||||
And I log in as "admin"
|
||||
And I go to the courses management page
|
||||
And I should see the "Course categories" management page
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should not see "Cat 1-1"
|
||||
And I should not see "Cat 1-2"
|
||||
And I should not see "Cat 1-1-1"
|
||||
And I should not see "Cat 1-1-2"
|
||||
And I should not see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT1" in the management interface
|
||||
# AJAX action - no redirect.
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should not see "Cat 1-1-1"
|
||||
And I should not see "Cat 1-1-2"
|
||||
And I should not see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT3" in the management interface
|
||||
# AJAX action - no redirect.
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should see "Cat 1-1-1"
|
||||
And I should see "Cat 1-1-2"
|
||||
And I should not see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT2" in the management interface
|
||||
# AJAX action - no redirect.
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should see "Cat 1-1-1"
|
||||
And I should see "Cat 1-1-2"
|
||||
And I should see "Cat 2-1"
|
||||
And I should not see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT7" in the management interface
|
||||
# AJAX action - no redirect.
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should see "Cat 1-1-1"
|
||||
And I should see "Cat 1-1-2"
|
||||
And I should see "Cat 2-1"
|
||||
And I should see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT1" in the management interface
|
||||
# AJAX action - no redirect.
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should not see "Cat 1-1"
|
||||
And I should not see "Cat 1-2"
|
||||
And I should not see "Cat 1-1-1"
|
||||
And I should not see "Cat 1-1-2"
|
||||
And I should see "Cat 2-1"
|
||||
And I should see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT1" in the management interface
|
||||
# AJAX action - no redirect.
|
||||
And I should see "Cat 1"
|
||||
And I should see "Cat 2"
|
||||
And I should see "Cat 1-1"
|
||||
And I should see "Cat 1-2"
|
||||
And I should see "Cat 1-1-1"
|
||||
And I should see "Cat 1-1-2"
|
||||
And I should see "Cat 2-1"
|
||||
And I should see "Cat 2-1-1"
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Top level categories are displayed correctly when resorted
|
||||
@ -398,11 +398,11 @@ Feature: Course category management interface performs as expected
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
|
||||
And I should not see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
And I should not see "Course 3"
|
||||
And I should not see "Course 4"
|
||||
And I should not see "Course 5"
|
||||
And I should see "Course 10" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 2" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 3" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 4" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 5" in the "#course-listing" "css_element"
|
||||
And I should see course listing "Course 6" before "Course 7"
|
||||
And I should see course listing "Course 7" before "Course 8"
|
||||
And I should see course listing "Course 8" before "Course 9"
|
||||
@ -422,16 +422,16 @@ Feature: Course category management interface performs as expected
|
||||
# Redirect. Test next link.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
|
||||
And I should not see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
And I should not see "Course 3"
|
||||
And I should not see "Course 4"
|
||||
And I should not see "Course 5"
|
||||
And I should not see "Course 6"
|
||||
And I should not see "Course 7"
|
||||
And I should not see "Course 8"
|
||||
And I should not see "Course 9"
|
||||
And I should not see "Course 10"
|
||||
And I should see "Course 11"
|
||||
And I should not see "Course 2" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 3" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 4" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 5" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 6" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 7" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 8" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 9" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 10" in the "#course-listing" "css_element"
|
||||
And I should see course listing "Course 11" before "Course 12"
|
||||
And "#course-listing .listing-pagination" "css_element" should exists
|
||||
And I should see "Showing courses 11 to 12 of 12 courses"
|
||||
@ -450,13 +450,13 @@ Feature: Course category management interface performs as expected
|
||||
And I should see course listing "Course 2" before "Course 3"
|
||||
And I should see course listing "Course 3" before "Course 4"
|
||||
And I should see course listing "Course 4" before "Course 5"
|
||||
And I should not see "Course 6"
|
||||
And I should not see "Course 7"
|
||||
And I should not see "Course 8"
|
||||
And I should not see "Course 9"
|
||||
And I should not see "Course 10"
|
||||
And I should not see "Course 11"
|
||||
And I should not see "Course 12"
|
||||
And I should not see "Course 6" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 7" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 8" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 9" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 10" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 11" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 12" in the "#course-listing" "css_element"
|
||||
And "#course-listing .listing-pagination" "css_element" should exists
|
||||
And I should see "Showing courses 1 to 5 of 12 courses"
|
||||
And I should not see "First" in the "#course-listing .listing-pagination" "css_element"
|
||||
@ -470,16 +470,16 @@ Feature: Course category management interface performs as expected
|
||||
# Redirect. Test last link.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
|
||||
And I should not see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
And I should not see "Course 3"
|
||||
And I should not see "Course 4"
|
||||
And I should not see "Course 5"
|
||||
And I should not see "Course 6"
|
||||
And I should not see "Course 7"
|
||||
And I should not see "Course 8"
|
||||
And I should not see "Course 9"
|
||||
And I should not see "Course 10"
|
||||
And I should see "Course 11" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 2" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 3" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 4" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 5" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 6" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 7" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 8" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 9" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 10" in the "#course-listing" "css_element"
|
||||
And I should see course listing "Course 11" before "Course 12"
|
||||
And "#course-listing .listing-pagination" "css_element" should exists
|
||||
And I should see "Showing courses 11 to 12 of 12 courses"
|
||||
@ -494,11 +494,11 @@ Feature: Course category management interface performs as expected
|
||||
# Redirect. Test prev link.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
|
||||
And I should not see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
And I should not see "Course 3"
|
||||
And I should not see "Course 4"
|
||||
And I should not see "Course 5"
|
||||
And I should see "Course 10" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 2" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 3" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 4" in the "#course-listing" "css_element"
|
||||
And I should not see "Course 5" in the "#course-listing" "css_element"
|
||||
And I should see course listing "Course 6" before "Course 7"
|
||||
And I should see course listing "Course 7" before "Course 8"
|
||||
And I should see course listing "Course 8" before "Course 9"
|
||||
|
@ -276,7 +276,7 @@ class behat_general extends behat_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that page contains specified text.
|
||||
* Checks, that page contains specified text. It also checks if the text is visible when running Javascript tests.
|
||||
*
|
||||
* @Then /^I should see "(?P<text_string>(?:[^"]|\\")*)"$/
|
||||
* @throws ExpectationException
|
||||
@ -284,19 +284,34 @@ class behat_general extends behat_base {
|
||||
*/
|
||||
public function assert_page_contains_text($text) {
|
||||
|
||||
// Looking for all the matching nodes without any other descendant matching the
|
||||
// same xpath (we are using contains(., ....).
|
||||
$xpathliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($text);
|
||||
$xpath = "/descendant-or-self::*[contains(., $xpathliteral)]";
|
||||
$xpath = "/descendant-or-self::*[contains(., $xpathliteral)]" .
|
||||
"[count(descendant::*[contains(., $xpathliteral)]) = 0]";
|
||||
|
||||
// Wait until it finds the text, otherwise custom exception.
|
||||
try {
|
||||
$this->find('xpath', $xpath);
|
||||
$nodes = $this->find_all('xpath', $xpath);
|
||||
|
||||
// We also check for the element visibility when running JS tests.
|
||||
if ($this->running_javascript()) {
|
||||
foreach ($nodes as $node) {
|
||||
if ($node->isVisible()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ExpectationException("'{$text}' text was found but was not visible", $this->getSession());
|
||||
}
|
||||
|
||||
} catch (ElementNotFoundException $e) {
|
||||
throw new ExpectationException('"' . $text . '" text was not found in the page', $this->getSession());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that page doesn't contain specified text.
|
||||
* Checks, that page doesn't contain specified text. When running Javascript tests it also considers that texts may be hidden.
|
||||
*
|
||||
* @Then /^I should not see "(?P<text_string>(?:[^"]|\\")*)"$/
|
||||
* @throws ExpectationException
|
||||
@ -317,7 +332,7 @@ class behat_general extends behat_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS selector or XPath contains specified text.
|
||||
* Checks, that the specified element contains the specified text. When running Javascript tests it also considers that texts may be hidden.
|
||||
*
|
||||
* @Then /^I should see "(?P<text_string>(?:[^"]|\\")*)" in the "(?P<element_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)"$/
|
||||
* @throws ElementNotFoundException
|
||||
@ -331,12 +346,27 @@ class behat_general extends behat_base {
|
||||
// Getting the container where the text should be found.
|
||||
$container = $this->get_selected_node($selectortype, $element);
|
||||
|
||||
// Looking for all the matching nodes without any other descendant matching the
|
||||
// same xpath (we are using contains(., ....).
|
||||
$xpathliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($text);
|
||||
$xpath = "/descendant-or-self::*[contains(., $xpathliteral)]";
|
||||
$xpath = "/descendant-or-self::*[contains(., $xpathliteral)]" .
|
||||
"[count(descendant::*[contains(., $xpathliteral)]) = 0]";
|
||||
|
||||
// Wait until it finds the text inside the container, otherwise custom exception.
|
||||
try {
|
||||
$this->find('xpath', $xpath, false, $container);
|
||||
$nodes = $this->find_all('xpath', $xpath, false, $container);
|
||||
|
||||
// We also check for the element visibility when running JS tests.
|
||||
if ($this->running_javascript()) {
|
||||
foreach ($nodes as $node) {
|
||||
if ($node->isVisible()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ExpectationException("'{$text}' text was found in the {$element} element but was not visible", $this->getSession());
|
||||
}
|
||||
|
||||
} catch (ElementNotFoundException $e) {
|
||||
throw new ExpectationException('"' . $text . '" text was not found in the ' . $element . ' element', $this->getSession());
|
||||
}
|
||||
@ -344,7 +374,7 @@ class behat_general extends behat_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS selector or XPath doesn't contain specified text.
|
||||
* Checks, that the specified element does not contain the specified text. When running Javascript tests it also considers that texts may be hidden.
|
||||
*
|
||||
* @Then /^I should not see "(?P<text_string>(?:[^"]|\\")*)" in the "(?P<element_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)"$/
|
||||
* @throws ElementNotFoundException
|
||||
|
Loading…
x
Reference in New Issue
Block a user