Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_block
2
Feature: Add and configure blocks throughout the site
3
  In order to maintain some patterns across all the site
4
  As a manager
5
  I need to set and configure blocks throughout the site
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | category |
10
      | Course 1 | C1 | 0 |
11
    And the following "users" exist:
12
      | username | firstname | lastname | email |
13
      | manager1 | Manager | 1 | manager1@example.com |
14
      | teacher1 | teacher | 1 | teacher@example.com |
15
    And the following "course enrolments" exist:
16
      | user     | course | role           |
17
      | teacher1 | C1     | editingteacher |
18
    And the following "system role assigns" exist:
19
      | user | course | role |
20
      | manager1 | Acceptance test site | manager |
21
    # Allow at least one role assignment in the block context:
22
    And I log in as "admin"
23
    And I navigate to "Users > Permissions > Define roles" in site administration
24
    And I follow "Edit Non-editing teacher role"
25
    And I set the following fields to these values:
26
      | Block | 1 |
27
    And I press "Save changes"
28
    And I log out
29
 
30
  Scenario: Add and configure a block throughtout the site
31
    Given I log in as "manager1"
32
    And I am on site homepage
33
    And I turn editing mode on
34
    And I add the "Comments" block
35
    And I configure the "Comments" block
36
    And I set the following fields to these values:
37
      | Page contexts | Display throughout the entire site |
38
    And I press "Save changes"
39
    When I am on "Course 1" course homepage
40
    Then I should see "Comments" in the "Comments" "block"
41
    And I should see "Save comment" in the "Comments" "block"
42
    And I am on site homepage
43
    And I configure the "Comments" block
44
    And I set the following fields to these values:
45
      | Default weight | -10 (first) |
46
    And I press "Save changes"
47
    And I am on "Course 1" course homepage
48
    # The first block matching the pattern should be top-left block
49
    And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" "xpath_element"
50
 
51
  Scenario: Blocks on the dashboard page can have roles assigned to them
52
    Given I log in as "manager1"
53
    When I turn editing mode on
54
    Then I should see "Assign roles in Recently accessed items block"
55
 
56
  Scenario: Blocks on courses can have roles assigned to them
57
    Given I log in as "teacher1"
58
    And I am on "Course 1" course homepage with editing mode on
59
    And I add the "Search forums" block
60
    Then I should see "Assign roles in Search forums block"
61
 
62
  @javascript
63
  Scenario: Blocks can safely be customised
64
    Given I log in as "admin"
65
    And I am on homepage
66
    And I turn editing mode on
67
    And I add the "Text" block to the default region with:
68
      | Text block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" |
69
      | Content     | Example |
70
    Then I should see "Example" in the "block_html" "block"
71
    Then I should see "document.getElementsByTagName"