Skip to content

Commit a46a5b5

Browse files
Behat: Fix feature scenarios for Behat tests - refs #7149
1 parent 9639d30 commit a46a5b5

4 files changed

Lines changed: 420 additions & 240 deletions

File tree

tests/behat/features/socialGroup.feature

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
Feature: Social Group
2-
In order to use the Social Network
3-
As an administrator
4-
I need to be able to create a social group, invite users and post a message
2+
In order to use the Social Network
3+
As an administrator
4+
I need to be able to create a social group, invite users and post a message
5+
56

67
Scenario: Create a social group
7-
Given I am a platform administrator
8-
And I am on "/main/social/group_add.php"
9-
When I fill in the following:
10-
| name | Behat Test Group |
11-
Then I fill in editor field "description" with "This is a group created by Behat"
12-
And I press "submit"
13-
And wait very long for the page to be loaded
14-
Then I should see "Group added"
8+
Given I am a platform administrator
9+
And I am on "/main/social/group_add.php"
10+
And I wait for the page to be loaded
11+
When I fill in the following:
12+
| title | Behat Test Group |
13+
Then I fill in editor field "description" with "This is a group created by Behat"
14+
And I press "submit"
15+
And wait very long for the page to be loaded
16+
Then I should not see an error
1517

16-
# Scenario: Invite a friend to group
17-
# Given I am a platform administrator
18-
# And I have a friend named "fbaggins" with id "11"
19-
# When I invite to a friend with id "11" to a social group with id "1"
20-
# Then I should see "Invitation sent"
18+
19+
Scenario: Invite a friend to group
20+
Given I am a platform administrator
21+
And I have a friend named "fbaggins" with id "11"
22+
When I invite to a friend with id "11" to a social group with id "1"
23+
Then I should see "Invitation sent"
2124
#
2225
# Scenario: Accept an invitation to social group
2326
# Given I am logged as "fbaggins"

tests/behat/features/toolAgenda.feature

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@ Feature: Agenda tool
22
In order to use the Agenda tool
33
The admin should be able to add an event
44

5+
56
Background:
67
Given I am a platform administrator
78

9+
810
Scenario: Create a personal event
911
Given I am on "/main/calendar/agenda.php?action=add&type=personal"
12+
And I wait for the page to be loaded
1013
When I fill in the following:
1114
| title | Event 1 |
12-
Then wait for the page to be loaded
1315
And I focus "date_range"
1416
And I fill in "date_range" with "2017-03-07 12:15 / 2017-03-07 12:15"
1517
Then I fill in editor field "content" with "Description event"
1618
And I press "Add event"
1719
And wait very long for the page to be loaded
18-
Then I should see "Event added"
20+
Then I should not see an error
1921
# TODO we need to check if the event appears in the personal agenda on resources/ccalendarevent
2022
# For the moment it does not appear
2123

2224
Scenario: Create an event inside course TEMP
2325
Given I am on "/main/calendar/agenda.php?action=add&type=course&cid=1"
26+
And I wait for the page to be loaded
2427
When I fill in the following:
2528
| title | Event in course |
2629
Then I fill in editor field "content" with "Description event"
@@ -30,21 +33,23 @@ Feature: Agenda tool
3033
And I fill in "date_range" with "2017-03-07 12:15 / 2017-03-07 12:15"
3134
And I press "Add event"
3235
And wait very long for the page to be loaded
33-
Then I should see "Event added"
36+
Then I should not see an error
37+
3438

3539
#TODO This scenario needs to be fixed because I do not know how to set the start date and the end date of the event.
3640
#There is an input id but it is impossible to know it. I put startDate and endDate for the moment.
37-
# Scenario: Create a personal event from the general agenda
38-
# Given I am on "/resources/ccalendarevent"
39-
# When I follow "Add event"
40-
# Then I fill in the following:
41-
# | title | Personal event from general agenda |
42-
# | Content | Content for personal event from general agenda |
43-
# And I fill in the following:
44-
# | startDate | 2021-07-26 14:15 |
45-
# | endDate | 2021-07-26 14:45 |
46-
# And I press "Add"
47-
# Then I should see "Personal event from general agenda created"
41+
Scenario: Create a personal event from the general agenda
42+
Given I am on "/resources/ccalendarevent"
43+
When I follow "Add event"
44+
Then I fill in the following:
45+
| Title | Personal event from general agenda |
46+
| Content | Content for personal event from general agenda |
47+
And I fill in the following:
48+
| startDate | 2021-07-26 14:15 |
49+
| endDate | 2021-07-26 14:45 |
50+
And I press "Add"
51+
Then I should see "Personal event from general agenda created"
52+
4853

4954
#TODO This scenario needs to be fixed because I do not know how to set the start date and the end date of the event.
5055
#There is an input id but it is impossible to know it. I put startDate and endDate for the moment.
@@ -81,6 +86,7 @@ Feature: Agenda tool
8186
# And I am on "/resources/ccalendarevent"
8287
# Then I should not see "Personal event from general agenda with invitees not editable"
8388

89+
8490
#TODO This scenario needs to be fixed because I do not know how to set the start date and the end date of the event.
8591
#There is an input id but it is impossible to know it. I put startDate and endDate for the moment.
8692
#We also need to add the user seleccion in the form and finaly connect as the invitee to check access and mail notification in inbox
@@ -111,7 +117,7 @@ Feature: Agenda tool
111117
# Then I should not see "Personal event from general agenda with invitees editable"
112118
# Then I am a platform administrator
113119
# And I am on "/resources/ccalendarevent"
114-
# And I should see "Personal event from general agenda with invitees editable"
120+
# And I should see "Personal event from general agenda with invitees editable"
115121
# And I follow "Personal event from general agenda with invitees editable"
116122
# And I should not see "Edit"
117123
# And I follow "Edit"
@@ -123,3 +129,4 @@ Feature: Agenda tool
123129
# And I follow "OK"
124130
# And I am on "/resources/ccalendarevent"
125131
# Then I should not see "Personal event from general agenda with invitees editable"
132+

tests/behat/features/toolDocument.feature

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,107 +2,126 @@ Feature: Document tool
22
In order to use the document tool
33
The teachers should be able to create and upload files
44

5-
Background:
5+
6+
Scenario: Create a folder
67
Given I am a platform administrator
78
And I am on course "TEMP" homepage
9+
And I wait for the page to be loaded
810
Then I follow "Document"
9-
And wait the page to be loaded when ready
10-
11-
Scenario: Create a folder
12-
Then I should see "New folder"
13-
Then I press "New folder"
11+
And wait for the page to be loaded
12+
Then I click the "span.mdi-folder-plus" element
13+
And I wait for the page to be loaded
1414
Then I fill in the following:
1515
| title | My new directory |
1616
And I press "Save"
1717
And wait for the page to be loaded
1818
Then I should see "saved"
1919

20+
2021
Scenario: Create a folder that already exists
21-
Then I should see "New folder"
22-
Then I press "New folder"
22+
Given I am a platform administrator
23+
And I am on course "TEMP" homepage
24+
And I wait for the page to be loaded
25+
Then I follow "Document"
26+
And wait for the page to be loaded
27+
Then I click the "span.mdi-folder-plus" element
28+
And I wait for the page to be loaded
2329
And I fill in the following:
2430
| title | My new directory |
2531
And I press "Save"
26-
And wait for the page to be loaded
2732
Then I should see "saved"
2833

34+
2935
Scenario: Create a text document
30-
Then I press "New document"
36+
Given I am a platform administrator
37+
And I am on course "TEMP" homepage
38+
And I wait for the page to be loaded
39+
Then I follow "Document"
40+
And wait for the page to be loaded
41+
Then I click the "span.mdi-file-plus" element
3142
And wait for the page to be loaded
3243
Then I fill in the following:
3344
| Title | My first document |
3445
And I fill in tinymce field "item_content" with "This is my first document!"
35-
And I press "Submit"
46+
And I press "Save"
3647
And wait for the page to be loaded
3748
Then I should see "created"
3849
And I should see "My first document"
3950
And wait for the page to be loaded
4051

52+
4153
Scenario: Create a HTML document
42-
Then I press "New document"
54+
Given I am a platform administrator
55+
And I am on course "TEMP" homepage
56+
And I wait for the page to be loaded
57+
Then I follow "Document"
58+
And wait for the page to be loaded
59+
Then I click the "span.mdi-file-plus" element
4360
And wait for the page to be loaded
4461
Then I fill in the following:
4562
| Title | My second document |
4663
And I fill in tinymce field "item_content" with "<a href='www.chamilo.org'>Click here</a><span><b>This is my second document!!</b></span>"
47-
And I press "Submit"
64+
And I click the "span.mdi-content-save" element
4865
And wait for the page to be loaded
4966
Then I should see "created"
5067
And I should see "My second document"
5168

69+
5270
Scenario: Upload a document
53-
Then I press "Upload"
71+
Given I am a platform administrator
72+
And I am on course "TEMP" homepage
73+
And I wait for the page to be loaded
74+
Then I follow "Document"
75+
And wait for the page to be loaded
76+
Then I click the "span.mdi-file-upload" element
5477
And wait for the page to be loaded
5578
Then I should see "Drop files here"
5679
Then I attach the file "/public/favicon.ico" to "files[]"
5780
Then I press "Upload 1 file"
5881
And wait for the page to be loaded
59-
Then I should see "Complete"
60-
Then I move backward one page
61-
And wait for the page to be loaded
82+
Then I should see "created"
6283
Then I should see "favicon.ico"
6384

64-
# Scenario: Search for "My second document" and edit it
65-
# Then I press "Search"
66-
# Then I fill in the following:
67-
# | search_filter | My second document |
68-
# Then I press "Filter"
69-
# And wait for the page to be loaded
70-
# Then I should not see "My first document"
71-
# Then I press "Info"
72-
# Then I should see "My second document"
73-
# Then I press "Edit"
74-
# And wait for the page to be loaded
75-
# Then I fill in the following:
76-
# | item_title | My second document edited |
77-
# Then I press "Submit"
78-
# And wait very long for the page to be loaded
79-
# Then I should see "updated"
80-
# Then move backward one page
81-
# And I should see "My second document edited"
82-
#
83-
# Scenario: Search for "My first document" and delete it
84-
# Then I press "Search"
85-
# Then I fill in the following:
86-
# | search_filter | My first document |
87-
# Then I press "Filter"
88-
# And wait very long for the page to be loaded
89-
# Then I should see "My first document"
90-
# Then I press "Info"
91-
# And wait for the page to be loaded
92-
# Then I should see "My first document"
93-
# Then I press "Delete"
94-
# And wait for the page to be loaded
95-
# And I press "Yes"
96-
# And wait for the page to be loaded
97-
# Then I should see "Deleted"
98-
99-
100-
# Scenario: Delete simple document
101-
# Then I follow "document"
102-
# Then I press "File upload"
103-
# And wait for the page to be loaded
104-
# Then I follow "My first document"
105-
# Then I should see "Created at"
106-
# Then I follow "Delete"
107-
# Then I should see "Deleted"
108-
# And I should not see "My first document.html"
85+
86+
Scenario: Search for "My second document" and edit it
87+
Given I am a platform administrator
88+
And I am on course "TEMP" homepage
89+
And I wait for the page to be loaded
90+
Then I follow "Documents"
91+
And wait for the page to be loaded
92+
Then I should see "My second document"
93+
Then I click the "span.mdi-pencil" element
94+
And wait for the page to be loaded
95+
Then I fill in the following:
96+
| item_title | My second document edited |
97+
Then I press "Save"
98+
And wait very long for the page to be loaded
99+
Then I should see "My second document edited"
100+
101+
102+
Scenario: Search for "My first document" and delete it
103+
Given I am a platform administrator
104+
And I am on course "TEMP" homepage
105+
And I wait for the page to be loaded
106+
Then I follow "Document"
107+
And wait for the page to be loaded
108+
Then I should see "My first document"
109+
Then I press "Info"
110+
And wait for the page to be loaded
111+
Then I should see "My first document"
112+
Then I press "Delete"
113+
And wait for the page to be loaded
114+
And I press "Yes"
115+
And wait for the page to be loaded
116+
Then I should see "Deleted"
117+
118+
119+
Scenario: Delete simple document
120+
Then I follow "document"
121+
Then I press "File upload"
122+
And wait for the page to be loaded
123+
Then I follow "My first document"
124+
Then I should see "Created at"
125+
Then I follow "Delete"
126+
Then I should see "Deleted"
127+
And I should not see "My first document.html"

0 commit comments

Comments
 (0)