MDL-46929 mod_forum: behat fixes
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 17 Apr 2017 09:39:28 +0000 (11:39 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 17 Apr 2017 09:44:00 +0000 (11:44 +0200)
- Keep old scenarios being non-javascript.
- Move the tags stuff to recently added scenario.
- Change some "my" by "your" to avoid problems detecting results
  while keeping previous tests (based on "subject") working.

mod/forum/tests/behat/advanced_search.feature

index f80c565..558ec83 100644 (file)
@@ -31,11 +31,10 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I add a new topic to "Announcements" forum with:
       | Subject | My subject |
       | Message | My message |
     And I add a new topic to "Announcements" forum with:
       | Subject | My subject |
       | Message | My message |
-      | Tags    | SearchedTag |
     And I am on "Course 1" course homepage
     And I add a new topic to "Announcements" forum with:
     And I am on "Course 1" course homepage
     And I add a new topic to "Announcements" forum with:
-      | Subject | My subjective|
-      | Message | My long message |
+      | Subject | Your subjective|
+      | Message | Your long message |
     And I log out
 
   Scenario: Perform an advanced search using any term
     And I log out
 
   Scenario: Perform an advanced search using any term
@@ -47,7 +46,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I set the field "words" to "subject"
     When I press "Search forums"
     Then I should see "My subject"
     And I set the field "words" to "subject"
     When I press "Search forums"
     Then I should see "My subject"
-    And I should see "My subjective"
+    And I should see "Your subjective"
 
   Scenario: Perform an advanced search avoiding words
     Given I log in as "student1"
 
   Scenario: Perform an advanced search avoiding words
     Given I log in as "student1"
@@ -59,7 +58,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I set the field "notwords" to "subjective"
     When I press "Search forums"
     Then I should see "My subject"
     And I set the field "notwords" to "subjective"
     When I press "Search forums"
     Then I should see "My subject"
-    And I should not see "My subjective"
+    And I should not see "Your subjective"
 
   Scenario: Perform an advanced search using whole words
     Given database family used is one of the following:
 
   Scenario: Perform an advanced search using whole words
     Given database family used is one of the following:
@@ -73,7 +72,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I set the field "fullwords" to "subject"
     When I press "Search forums"
     Then I should see "My subject"
     And I set the field "fullwords" to "subject"
     When I press "Search forums"
     Then I should see "My subject"
-    And I should not see "My subjective"
+    And I should not see "Your subjective"
 
   Scenario: Perform an advanced search matching the subject
     Given I log in as "student1"
 
   Scenario: Perform an advanced search matching the subject
     Given I log in as "student1"
@@ -84,7 +83,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I set the field "subject" to "subjective"
     When I press "Search forums"
     Then I should not see "My message"
     And I set the field "subject" to "subjective"
     When I press "Search forums"
     Then I should not see "My message"
-    And I should see "My subjective"
+    And I should see "Your subjective"
 
   Scenario: Perform an advanced search matching the author
     Given I log in as "teacher2"
 
   Scenario: Perform an advanced search matching the author
     Given I log in as "teacher2"
@@ -109,14 +108,23 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I follow "Announcements"
     And I press "Search forums"
     And I should see "Advanced search"
     And I follow "Announcements"
     And I press "Search forums"
     And I should see "Advanced search"
-    And I set the field "subject" to "my subjective"
+    And I set the field "subject" to "your subjective"
     When I press "Search forums"
     Then I should not see "My message"
     When I press "Search forums"
     Then I should not see "My message"
-    And I should see "My subjective"
+    And I should see "Your subjective"
 
   @javascript
   Scenario: Perform an advanced search using tags
 
   @javascript
   Scenario: Perform an advanced search using tags
-    Given I log in as "student1"
+    Given I log in as "teacher1"
+    And I am on "Course 1" course homepage
+    And I follow "Announcements"
+    And I follow "My subject"
+    And I follow "Edit"
+    And I set the following fields to these values:
+        | Tags    | SearchedTag |
+    And I press "Save changes"
+    And I log out
+    And I log in as "student1"
     And I am on "Course 1" course homepage
     And I follow "Announcements"
     And I press "Search forums"
     And I am on "Course 1" course homepage
     And I follow "Announcements"
     And I press "Search forums"
@@ -125,4 +133,4 @@ Feature: The forum search allows users to perform advanced searches for forum po
     And I click on "[data-value='SearchedTag']" "css_element"
     When I press "Search forums"
     Then I should see "My subject"
     And I click on "[data-value='SearchedTag']" "css_element"
     When I press "Search forums"
     Then I should see "My subject"
-    And I should not see "My subjective"
+    And I should not see "Your subjective"