Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/CoreBundle/Resources/views/Chat/chat.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@
const isMe = (user.id === myUserId);
const dotCls = user.isConnected ? 'bg-emerald-500' : 'bg-gray-300';
const btnTitle = user.isConnected ? T.startChat : T.leaveMessage;
// Build a safe id from the complete_name
const rawName = user.complete_name || '';
const nameNormalized = rawName.replace(/\s+/g, '_')

return `
<li class="px-4 py-3 hover:bg-gray-15">
Expand All @@ -296,7 +299,7 @@
<p class="text-xs text-gray-500 truncate">${user.username ? escapeHTML(user.username) : '&nbsp;'}</p>
</div>
${!isMe ? `
<button type="button" class="btn btn-tertiary user-chat-btn"
<button type="button" id="${escapeHTML(nameNormalized)}_chat" class="btn btn-tertiary user-chat-btn"
title="${escapeHTML(btnTitle)}" data-name="${escapeHTML(user.complete_name)}" data-user="${user.id}">
{{ 'Chat'|trans }}
</button>` : ''}
Expand Down
15 changes: 15 additions & 0 deletions tests/behat/features/adminFillCourses.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Admin fill courses and subscribe users

Background:
Given I am logged as "admin"

Scenario: Admin fills courses then subscribes a user to a course with long waits
Given I am on "/main/admin/filler.php?fill=courses"
When wait very long for the page to be loaded
When I am on "/main/admin/subscribe_user2course.php"
And wait very long for the page to be loaded
And I select "ywarnier" from "UserList[]"
And I select "(SOLARSYSTEM) Our solar system" from "CourseList[]"
When I click the "button.btn--primary" element
When wait very long for the page to be loaded
Then I should see "The selected users are subscribed to the selected course"
43 changes: 43 additions & 0 deletions tests/behat/features/toolChat.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Feature: Chat tool
In order to communicate with other users
Teachers and students should be able to send public and private chat messages


Scenario: Admin sends public and private messages, Andrea checks them
Given I am a platform administrator
And I am on course "TEMP" homepage
And I wait for the page to be loaded
And I zoom out to maximum
Then I follow "Chat"
And wait for the page to be loaded
# Send a public message as admin
Then I fill in the following:
| chat-writer | I am USER1 |
Then I click the "button#chat-send-message" element
And wait for the page to be loaded


# Open private chat with Andrea and send a private message
Then I click the "button#andrea_costea_chat" element
And wait for the page to be loaded
Then I fill in the following:
| chat-writer | HelloAndrea |
Then I click the "button#chat-send-message" element
And wait for the page to be loaded


Scenario: Now switch to Andrea (student) and verify messages
Given I am a student
And I am on course "TEMP" homepage
And I wait for the page to be loaded
And I zoom out to maximum
Then I follow "Chat"
And wait for the page to be loaded
Then I should see "USER1"
Then I should not see "Hello"


# Click on another user (john_doe) and assert a message
Then I click the "button#john_doe_chat" element
And wait for the page to be loaded
Then I should see "Hello"
34 changes: 34 additions & 0 deletions tests/behat/features/toolCoursedescription.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@common @tools
Feature: Course description tool
In order to manage the course description
As a course administrator and student
I want to edit and view the course description


Background:
Given I am a platform administrator
And I wait for the page to be loaded


Scenario: Admin edits the course description and sees the content
Given I am on course "TEMP" homepage
And I wait for the page to be loaded
And I zoom out to maximum
And I follow "Course description"
And I wait for the page to be loaded
And I click the "i.mdi-image-text" element
And I fill in "course_description_title" with "General"
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."
And I press "course_description_submit"
And I wait for the page to be loaded
Then I should see "surface web"


Scenario: Student views the course description
Given I am a student
And I wait for the page to be loaded
Given I am on course "TEMP" homepage
And I wait for the page to be loaded
And I follow "Course description"
And I wait for the page to be loaded
Then I should see "surface web"
24 changes: 24 additions & 0 deletions tests/behat/features/toolDropbox.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@common @tools
Feature: Dropbox tool
In order to manage files in the course
As a course administrator
I want to open the Dropbox tool and access the upload dialog


Background:
Given I am a platform administrator
And I wait for the page to be loaded


Scenario: Admin opens Dropbox and sees the upload action
Given I am on course "TEMP" homepage
And I wait for the page to be loaded
And I zoom out to maximum
And I follow "Dropbox"
And I wait for the page to be loaded
Then I should see "Share a new file"
And I click the "i.mdi-upload" element
And I wait for the page to be loaded
Then I should see "Upload"


Loading
Loading