| 1 | 
           efrain | 
           1 | 
           @block @block_blog_menu @mod_assign @block_blog_recent
  | 
        
        
            | 
            | 
           2 | 
           Feature: Students can use the recent blog entries block to view recent entries on an activity page
  | 
        
        
            | 
            | 
           3 | 
             In order to enable the recent blog entries block an activity page
  | 
        
        
            | 
            | 
           4 | 
             As a teacher
  | 
        
        
            | 
            | 
           5 | 
             I can add the recent blog entries block to an activity page
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
             Background:
  | 
        
        
            | 
            | 
           8 | 
               Given the following "users" exist:
  | 
        
        
            | 
            | 
           9 | 
                 | username | firstname | lastname | email | idnumber |
  | 
        
        
            | 
            | 
           10 | 
                 | teacher1 | Teacher | 1 | teacher1@example.com | T1 |
  | 
        
        
            | 
            | 
           11 | 
                 | student1 | Student | 1 | student1@example.com | S1 |
  | 
        
        
            | 
            | 
           12 | 
                 | student2 | Student | 2 | student2@example.com | S2 |
  | 
        
        
            | 
            | 
           13 | 
               And the following "courses" exist:
  | 
        
        
            | 
            | 
           14 | 
                 | fullname | shortname | category |
  | 
        
        
            | 
            | 
           15 | 
                 | Course 1 | C1 | 0 |
  | 
        
        
            | 
            | 
           16 | 
               And the following "course enrolments" exist:
  | 
        
        
            | 
            | 
           17 | 
                 | user | course | role |
  | 
        
        
            | 
            | 
           18 | 
                 | teacher1 | C1 | editingteacher |
  | 
        
        
            | 
            | 
           19 | 
                 | student1 | C1 | student |
  | 
        
        
            | 
            | 
           20 | 
                 | student2 | C1 | student |
  | 
        
        
            | 
            | 
           21 | 
               And the following "activity" exists:
  | 
        
        
            | 
            | 
           22 | 
                 | activity                      | assign            |
  | 
        
        
            | 
            | 
           23 | 
                 | course                        | C1                |
  | 
        
        
            | 
            | 
           24 | 
                 | idnumber                      | 0001              |
  | 
        
        
            | 
            | 
           25 | 
                 | name                          | Test assignment 1 |
  | 
        
        
            | 
            | 
           26 | 
                 | intro                         | Offline text      |
  | 
        
        
            | 
            | 
           27 | 
                 | section                       | 1                 |
  | 
        
        
            | 
            | 
           28 | 
                 | assignsubmission_file_enabled | 0                 |
  | 
        
        
            | 
            | 
           29 | 
               And the following "blocks" exist:
  | 
        
        
            | 
            | 
           30 | 
                 | blockname   | contextlevel    | reference | pagetypepattern | defaultregion |
  | 
        
        
            | 
            | 
           31 | 
                 | blog_menu   | Activity module | 0001      | mod-assign-view | side-pre      |
  | 
        
        
            | 
            | 
           32 | 
                 | blog_recent | Activity module | 0001      | mod-assign-view | side-pre      |
  | 
        
        
            | 
            | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
             Scenario: Students use the recent blog entries block to view blogs
  | 
        
        
            | 
            | 
           35 | 
               Given I am on the "Test assignment 1" "assign activity" page logged in as student1
  | 
        
        
            | 
            | 
           36 | 
               And I follow "Add an entry about this Assignment"
  | 
        
        
            | 
            | 
           37 | 
               When I set the following fields to these values:
  | 
        
        
            | 
            | 
           38 | 
                 | Entry title | S1 First Blog |
  | 
        
        
            | 
            | 
           39 | 
                 | Blog entry body | This is my awesome blog! |
  | 
        
        
            | 
            | 
           40 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           41 | 
               Then I should see "S1 First Blog"
  | 
        
        
            | 
            | 
           42 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           43 | 
               And I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           44 | 
               And I should see "S1 First Blog"
  | 
        
        
            | 
            | 
           45 | 
               And I follow "S1 First Blog"
  | 
        
        
            | 
            | 
           46 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
             Scenario: Students only see a few entries in the recent blog entries block
  | 
        
        
            | 
            | 
           49 | 
               Given I am on the "Test assignment 1" "assign activity" page logged in as student1
  | 
        
        
            | 
            | 
           50 | 
               And I follow "Add an entry about this Assignment"
  | 
        
        
            | 
            | 
           51 | 
               # Blog 1 of 5
  | 
        
        
            | 
            | 
           52 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           53 | 
                 | Entry title | S1 First Blog |
  | 
        
        
            | 
            | 
           54 | 
                 | Blog entry body | This is my awesome blog! |
  | 
        
        
            | 
            | 
           55 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           56 | 
               And I wait "1" seconds
  | 
        
        
            | 
            | 
           57 | 
               And I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           58 | 
               And I follow "Add an entry about this Assignment"
  | 
        
        
            | 
            | 
           59 | 
               # Blog 2 of 5
  | 
        
        
            | 
            | 
           60 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           61 | 
                 | Entry title | S1 Second Blog |
  | 
        
        
            | 
            | 
           62 | 
                 | Blog entry body | This is my awesome blog! |
  | 
        
        
            | 
            | 
           63 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           64 | 
               And I wait "1" seconds
  | 
        
        
            | 
            | 
           65 | 
               And I should see "S1 Second Blog"
  | 
        
        
            | 
            | 
           66 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           67 | 
               And I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           68 | 
               And I follow "Add an entry about this Assignment"
  | 
        
        
            | 
            | 
           69 | 
               # Blog 3 of 5
  | 
        
        
            | 
            | 
           70 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           71 | 
                 | Entry title | S1 Third Blog |
  | 
        
        
            | 
            | 
           72 | 
                 | Blog entry body | This is my awesome blog! |
  | 
        
        
            | 
            | 
           73 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           74 | 
               And I wait "1" seconds
  | 
        
        
            | 
            | 
           75 | 
               And I should see "S1 Third Blog"
  | 
        
        
            | 
            | 
           76 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           77 | 
               And I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           78 | 
               And I follow "Add an entry about this Assignment"
  | 
        
        
            | 
            | 
           79 | 
               # Blog 4 of 5
  | 
        
        
            | 
            | 
           80 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           81 | 
                 | Entry title | S1 Fourth Blog |
  | 
        
        
            | 
            | 
           82 | 
                 | Blog entry body | This is my awesome blog! |
  | 
        
        
            | 
            | 
           83 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           84 | 
               And I wait "1" seconds
  | 
        
        
            | 
            | 
           85 | 
               And I should see "S1 Fourth Blog"
  | 
        
        
            | 
            | 
           86 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           87 | 
               And I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           88 | 
               And I follow "Add an entry about this Assignment"
  | 
        
        
            | 
            | 
           89 | 
               # Blog 5 of 5
  | 
        
        
            | 
            | 
           90 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           91 | 
                 | Entry title | S1 Fifth Blog |
  | 
        
        
            | 
            | 
           92 | 
                 | Blog entry body | This is my awesome blog! |
  | 
        
        
            | 
            | 
           93 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           94 | 
               And I should see "S1 Fifth Blog"
  | 
        
        
            | 
            | 
           95 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           96 | 
               When I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           97 | 
               And I should not see "S1 First Blog"
  | 
        
        
            | 
            | 
           98 | 
               And I should see "S1 Second Blog"
  | 
        
        
            | 
            | 
           99 | 
               And I should see "S1 Third Blog"
  | 
        
        
            | 
            | 
           100 | 
               And I should see "S1 Fourth Blog"
  | 
        
        
            | 
            | 
           101 | 
               And I should see "S1 Fifth Blog"
  | 
        
        
            | 
            | 
           102 | 
               And I follow "S1 Fifth Blog"
  | 
        
        
            | 
            | 
           103 | 
               And I should see "This is my awesome blog!"
  | 
        
        
            | 
            | 
           104 | 
               Then I log out
  | 
        
        
            | 
            | 
           105 | 
               And I log in as "teacher1"
  | 
        
        
            | 
            | 
           106 | 
               And I am on "Course 1" course homepage with editing mode on
  | 
        
        
            | 
            | 
           107 | 
               And I follow "Test assignment 1"
  | 
        
        
            | 
            | 
           108 | 
               And I configure the "Recent blog entries" block
  | 
        
        
            | 
            | 
           109 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           110 | 
                 | config_numberofrecentblogentries | 2 |
  | 
        
        
            | 
            | 
           111 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           112 | 
               And I should see "S1 Fourth Blog"
  | 
        
        
            | 
            | 
           113 | 
               And I should see "S1 Fifth Blog"
  |