Skip to content

Commit 7860c84

Browse files
committed
Move @app tests from core to this plugin
It has been decided to have all the @app behat tests centralised on this plugin. These behat tests were created by Sam Marshall and Kiet.Chan. Thanks a lot!
1 parent 478bbda commit 7860c84

File tree

3 files changed

+218
-0
lines changed

3 files changed

+218
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@core @core_course @app @javascript
2+
Feature: Check course completion feature.
3+
In order to track the progress of the course on mobile device
4+
As a student
5+
I need to be able to update the activity completion status.
6+
7+
Background:
8+
Given the following "users" exist:
9+
| username | firstname | lastname | email |
10+
| student1 | Student | 1 | student1@example.com |
11+
And the following "courses" exist:
12+
| fullname | shortname | category | enablecompletion |
13+
| Course 1 | C1 | 0 | 1 |
14+
And the following "course enrolments" exist:
15+
| user | course | role |
16+
| student1 | C1 | student |
17+
18+
Scenario: Complete the activity manually by clicking at the completion checkbox.
19+
Given the following "activities" exist:
20+
| activity | name | course | idnumber | completion | completionview |
21+
| forum | First forum | C1 | forum1 | 1 | 0 |
22+
| forum | Second forum | C1 | forum2 | 1 | 0 |
23+
When I enter the app
24+
And I log in as "student1"
25+
And I press "Course 1" near "Recently accessed courses" in the app
26+
# Set activities as completed.
27+
And I should see "0%"
28+
And I press "Not completed: First forum. Select to mark as complete." in the app
29+
And I should see "50%"
30+
And I press "Not completed: Second forum. Select to mark as complete." in the app
31+
And I should see "100%"
32+
# Set activities as not completed.
33+
And I press "Completed: First forum. Select to mark as not complete." in the app
34+
And I should see "50%"
35+
And I press "Completed: Second forum. Select to mark as not complete." in the app
36+
And I should see "0%"
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
@core @core_course @app @javascript
2+
Feature: Test course list shown on app start tab
3+
In order to select a course
4+
As a student
5+
I need to see the correct list of courses
6+
7+
Background:
8+
Given the following "courses" exist:
9+
| fullname | shortname |
10+
| Course 1 | C1 |
11+
| Course 2 | C2 |
12+
And the following "users" exist:
13+
| username |
14+
| student1 |
15+
| student2 |
16+
And the following "course enrolments" exist:
17+
| user | course | role |
18+
| student1 | C1 | student |
19+
| student2 | C1 | student |
20+
| student2 | C2 | student |
21+
22+
Scenario: Student is registered on one course
23+
When I enter the app
24+
And I log in as "student1"
25+
Then I should see "Course 1"
26+
And I should not see "Course 2"
27+
28+
Scenario: Student is registered on two courses (shortnames not displayed)
29+
When I enter the app
30+
And I log in as "student2"
31+
Then I should see "Course 1"
32+
And I should see "Course 2"
33+
And I should not see "C1"
34+
And I should not see "C2"
35+
36+
Scenario: Student is registered on two courses (shortnames displayed)
37+
Given the following config values are set as admin:
38+
| courselistshortnames | 1 |
39+
When I enter the app
40+
And I log in as "student2"
41+
Then I should see "Course 1"
42+
And I should see "Course 2"
43+
And I should see "C1"
44+
And I should see "C2"
45+
46+
Scenario: Student uses course list to enter course, then leaves it again
47+
When I enter the app
48+
And I log in as "student2"
49+
And I press "Course 2" near "Course overview" in the app
50+
Then the header should be "Course 2" in the app
51+
And I press the back button in the app
52+
Then the header should be "Acceptance test site" in the app
53+
54+
Scenario: Student uses filter feature to reduce course list
55+
Given the following config values are set as admin:
56+
| courselistshortnames | 1 |
57+
And the following "courses" exist:
58+
| fullname | shortname |
59+
| Frog 3 | C3 |
60+
| Frog 4 | C4 |
61+
| Course 5 | C5 |
62+
| Toad 6 | C6 |
63+
And the following "course enrolments" exist:
64+
| user | course | role |
65+
| student2 | C3 | student |
66+
| student2 | C4 | student |
67+
| student2 | C5 | student |
68+
| student2 | C6 | student |
69+
# Create bogus courses so that the main ones aren't shown in the 'recently accessed' part.
70+
# Because these come later in alphabetical order, they may not be displayed in the lower part
71+
# which is OK.
72+
And the following "courses" exist:
73+
| fullname | shortname |
74+
| Zogus 1 | Z1 |
75+
| Zogus 2 | Z2 |
76+
| Zogus 3 | Z3 |
77+
| Zogus 4 | Z4 |
78+
| Zogus 5 | Z5 |
79+
| Zogus 6 | Z6 |
80+
| Zogus 7 | Z7 |
81+
| Zogus 8 | Z8 |
82+
| Zogus 9 | Z9 |
83+
| Zogus 10 | Z10 |
84+
And the following "course enrolments" exist:
85+
| user | course | role |
86+
| student2 | Z1 | student |
87+
| student2 | Z2 | student |
88+
| student2 | Z3 | student |
89+
| student2 | Z4 | student |
90+
| student2 | Z5 | student |
91+
| student2 | Z6 | student |
92+
| student2 | Z7 | student |
93+
| student2 | Z8 | student |
94+
| student2 | Z9 | student |
95+
| student2 | Z10 | student |
96+
When I enter the app
97+
And I log in as "student2"
98+
Then I should see "C1"
99+
And I should see "C2"
100+
And I should see "C3"
101+
And I should see "C4"
102+
And I should see "C5"
103+
And I should see "C6"
104+
And I press "more" near "Course overview" in the app
105+
And I press "Filter my courses" in the app
106+
And I set the field "Filter my courses" to "fr" in the app
107+
Then I should not see "C1"
108+
And I should not see "C2"
109+
And I should see "C3"
110+
And I should see "C4"
111+
And I should not see "C5"
112+
And I should not see "C6"
113+
And I press "more" near "Course overview" in the app
114+
And I press "Filter my courses" in the app
115+
Then I should see "C1"
116+
And I should see "C2"
117+
And I should see "C3"
118+
And I should see "C4"
119+
And I should see "C5"
120+
And I should see "C6"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@mod @mod_forum @app @javascript
2+
Feature: Test basic usage in app
3+
In order to participate in the forum while using the mobile app
4+
As a student
5+
I need basic forum functionality to work
6+
7+
Background:
8+
Given the following "courses" exist:
9+
| fullname | shortname |
10+
| Course 1 | C1 |
11+
And the following "users" exist:
12+
| username |
13+
| student1 |
14+
And the following "course enrolments" exist:
15+
| user | course | role |
16+
| student1 | C1 | student |
17+
And the following "activities" exist:
18+
| activity | name | intro | course | idnumber | groupmode |
19+
| forum | Test forum name | Test forum | C1 | forum | 0 |
20+
21+
Scenario: Student starts a discussion
22+
When I enter the app
23+
And I log in as "student1"
24+
And I press "Course 1" near "Course overview" in the app
25+
And I press "Test forum name" in the app
26+
And I press "Add a new discussion topic" in the app
27+
And I set the field "Subject" to "My happy subject" in the app
28+
And I set the field "Message" to "An awesome message" in the app
29+
And I press "Post to forum" in the app
30+
Then I should see "My happy subject"
31+
And I should see "An awesome message"
32+
33+
Scenario: Student posts a reply
34+
When I enter the app
35+
And I log in as "student1"
36+
And I press "Course 1" near "Course overview" in the app
37+
And I press "Test forum name" in the app
38+
And I press "Add a new discussion topic" in the app
39+
And I set the field "Subject" to "DiscussionSubject" in the app
40+
And I set the field "Message" to "DiscussionMessage" in the app
41+
And I press "Post to forum" in the app
42+
And I press "DiscussionSubject" in the app
43+
And I press "Reply" in the app
44+
And I set the field "Message" to "ReplyMessage" in the app
45+
And I press "Post to forum" in the app
46+
Then I should see "DiscussionMessage"
47+
And I should see "ReplyMessage"
48+
49+
Scenario: Test that 'open in browser' works for forum
50+
When I enter the app
51+
And I change viewport size to "360x640"
52+
And I log in as "student1"
53+
And I press "Course 1" near "Course overview" in the app
54+
And I press "Test forum name" in the app
55+
And I press the page menu button in the app
56+
And I press "Open in browser" in the app
57+
And I switch to the browser tab opened by the app
58+
And I log in as "student1"
59+
Then I should see "Test forum name"
60+
And I should see "Add a new discussion topic"
61+
And I close the browser tab opened by the app
62+
And I press the back button in the app

0 commit comments

Comments
 (0)