Skip to content

Commit 69018d6

Browse files
committed
CI: Add and fix features for Behat tests - refs #7149
1 parent 623d9a3 commit 69018d6

12 files changed

Lines changed: 1015 additions & 164 deletions

src/CoreBundle/Resources/views/Chat/chat.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@
492492
const isMe = (user.id === myUserId);
493493
const dotCls = user.isConnected ? 'bg-emerald-500' : 'bg-gray-300';
494494
const btnTitle = user.isConnected ? T.startChat : T.leaveMessage;
495+
// Build a safe id from the complete_name
496+
const rawName = user.complete_name || '';
497+
const nameNormalized = rawName.replace(/\s+/g, '_')
495498
496499
return `
497500
<li class="px-4 py-3 hover:bg-gray-15">
@@ -505,7 +508,7 @@
505508
<p class="text-xs text-gray-500 truncate">${user.username ? escapeHTML(user.username) : '&nbsp;'}</p>
506509
</div>
507510
${!isMe ? `
508-
<button type="button" class="btn btn-tertiary user-chat-btn"
511+
<button type="button" id="${escapeHTML(nameNormalized)}_chat" class="btn btn-tertiary user-chat-btn"
509512
title="${escapeHTML(btnTitle)}" data-name="${escapeHTML(user.complete_name)}" data-user="${user.id}">
510513
{{ 'Chat'|trans }}
511514
</button>` : ''}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Feature: Admin fill courses and subscribe users
2+
3+
Background:
4+
Given I am logged as "admin"
5+
6+
Scenario: Admin fills courses then subscribes a user to a course with long waits
7+
Given I am on "/main/admin/filler.php?fill=courses"
8+
When wait very long for the page to be loaded
9+
When I am on "/main/admin/subscribe_user2course.php"
10+
And wait very long for the page to be loaded
11+
And I select "ywarnier" from "UserList[]"
12+
And I select "(SOLARSYSTEM) Our solar system" from "CourseList[]"
13+
When I click the "button.btn--primary" element
14+
When wait very long for the page to be loaded
15+
Then I should see "The selected users are subscribed to the selected course"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Feature: Chat tool
2+
In order to communicate with other users
3+
Teachers and students should be able to send public and private chat messages
4+
5+
6+
Scenario: Admin sends public and private messages, Andrea checks them
7+
Given I am a platform administrator
8+
And I am on course "TEMP" homepage
9+
And I wait for the page to be loaded
10+
And I zoom out to maximum
11+
Then I follow "Chat"
12+
And wait for the page to be loaded
13+
# Send a public message as admin
14+
Then I fill in the following:
15+
| chat-writer | I am USER1 |
16+
Then I click the "button#chat-send-message" element
17+
And wait for the page to be loaded
18+
19+
20+
# Open private chat with Andrea and send a private message
21+
Then I click the "button#andrea_costea_chat" element
22+
And wait for the page to be loaded
23+
Then I fill in the following:
24+
| chat-writer | HelloAndrea |
25+
Then I click the "button#chat-send-message" element
26+
And wait for the page to be loaded
27+
28+
29+
Scenario: Now switch to Andrea (student) and verify messages
30+
Given I am a student
31+
And I am on course "TEMP" homepage
32+
And I wait for the page to be loaded
33+
And I zoom out to maximum
34+
Then I follow "Chat"
35+
And wait for the page to be loaded
36+
Then I should see "USER1"
37+
Then I should not see "Hello"
38+
39+
40+
# Click on another user (john_doe) and assert a message
41+
Then I click the "button#john_doe_chat" element
42+
And wait for the page to be loaded
43+
Then I should see "Hello"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@common @tools
2+
Feature: Course description tool
3+
In order to manage the course description
4+
As a course administrator and student
5+
I want to edit and view the course description
6+
7+
8+
Background:
9+
Given I am a platform administrator
10+
And I wait for the page to be loaded
11+
12+
13+
Scenario: Admin edits the course description and sees the content
14+
Given I am on course "TEMP" homepage
15+
And I wait for the page to be loaded
16+
And I zoom out to maximum
17+
And I follow "Course description"
18+
And I wait for the page to be loaded
19+
And I click the "i.mdi-image-text" element
20+
And I fill in "course_description_title" with "General"
21+
And I fill in editor field "content" with "The surface web, also known as the visible web or indexed web, is the portion of the World Wide Web that is readily accessible to the general public through standard search engines such as Google and Bing, using conventional web browsers like Chrome or Firefox without requiring special software, authentication, or configuration.[1][2] It encompasses publicly available content that is crawled and indexed by search engine algorithms, allowing users to discover and navigate websites via simple URLs and keyword queries."
22+
And I press "course_description_submit"
23+
And I wait for the page to be loaded
24+
Then I should see "surface web"
25+
26+
27+
Scenario: Student views the course description
28+
Given I am a student
29+
And I wait for the page to be loaded
30+
Given I am on course "TEMP" homepage
31+
And I wait for the page to be loaded
32+
And I follow "Course description"
33+
And I wait for the page to be loaded
34+
Then I should see "surface web"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@common @tools
2+
Feature: Dropbox tool
3+
In order to manage files in the course
4+
As a course administrator
5+
I want to open the Dropbox tool and access the upload dialog
6+
7+
8+
Background:
9+
Given I am a platform administrator
10+
And I wait for the page to be loaded
11+
12+
13+
Scenario: Admin opens Dropbox and sees the upload action
14+
Given I am on course "TEMP" homepage
15+
And I wait for the page to be loaded
16+
And I zoom out to maximum
17+
And I follow "Dropbox"
18+
And I wait for the page to be loaded
19+
Then I should see "Share a new file"
20+
And I click the "i.mdi-upload" element
21+
And I wait for the page to be loaded
22+
Then I should see "Upload"
23+
24+

0 commit comments

Comments
 (0)