Skip to content

Commit 38873b4

Browse files
author
Matthias Opitz
committed
added Behat test if news are shown
1 parent 42dba87 commit 38873b4

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

tests/behat/show_news.feature

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
@block @block_news @javascript
2+
Feature: Show news
3+
In order to be informed about news
4+
As a user
5+
I need to be able to see the news block on my dashboard but not on my course page.
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 |
13+
| teacher1 |
14+
| student1 |
15+
And the following "course enrolments" exist:
16+
| user | course | role |
17+
| teacher1 | C1 | editingteacher |
18+
| student1 | C1 | student |
19+
And the following "blocks" exist:
20+
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
21+
| news | System | 1 | my-index | full-b |
22+
And the following config values are set as admin:
23+
| config | value | plugin |
24+
| ssoenableredirecttoaad | 0 | theme_ucl |
25+
| title1 | News Title One | block_news |
26+
| description1 | News Description One | block_news |
27+
| link1 | https://apple.com | block_news |
28+
| title2 | News Title Two | block_news |
29+
| description2 | News Description Two | block_news |
30+
| link2 | https://google.com | block_news |
31+
| title3 | News Title Three | block_news |
32+
| description3 | News Description Three | block_news |
33+
| link3 | https://ucl.ac.uk | block_news |
34+
35+
Scenario: See news on my dashboard page as admin.
36+
When I log in as "admin"
37+
Then I should see "News"
38+
And I should see "News Title One"
39+
And I should see "News Title Two"
40+
And I should see "News Title Three"
41+
42+
Scenario: See no news on the course home page as admin.
43+
When I am on the "Course 1" course page logged in as admin
44+
Then I should not see "News"
45+
And I should not see "News Title One"
46+
And I should not see "News Title Two"
47+
And I should not see "News Title Three"
48+
49+
Scenario: See news on my dashboard page as teacher.
50+
When I log in as "teacher1"
51+
Then I should see "News"
52+
And I should see "News Title One"
53+
And I should see "News Title Two"
54+
And I should see "News Title Three"
55+
56+
Scenario: See no news on the course home page as teacher.
57+
When I am on the "Course 1" course page logged in as teacher1
58+
Then I should not see "News"
59+
And I should not see "News Title One"
60+
And I should not see "News Title Two"
61+
And I should not see "News Title Three"
62+
63+
Scenario: See news on my dashboard page as student.
64+
When I log in as "student1"
65+
Then I should see "News"
66+
And I should see "News Title One"
67+
And I should see "News Title Two"
68+
And I should see "News Title Three"
69+
70+
Scenario: See no news on the course home page as student.
71+
When I am on the "Course 1" course page logged in as student1
72+
Then I should not see "News"
73+
And I should not see "News Title One"
74+
And I should not see "News Title Two"
75+
And I should not see "News Title Three"
76+

0 commit comments

Comments
 (0)