Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 4.97 KB

user-documentation.md

File metadata and controls

50 lines (37 loc) · 4.97 KB

Endorsing and Unendorsing a Topic

Automated Testing

The tests for this feature can be found at test/topics.js on lines 401-421, 459-468, and 716-726. These tests ensure that a topic is initialized as not endorsed upon creation (i.e. the endorsed field is set to 0 by default). Additionally, these tests verify that the endorse and unendorse functions toggle the endorsement status (i.e., the endorse function sets the endorsed field to 1 and the unendorse function sets the endorsed field to 0). These tests comprehensively check the backend logic and ensure that the core functionality of endorsing and unendorsing topics works as expected.

Local Server Testing

Since the automated tests don't fully cover all UI aspects of this feature, we recommend manual testing on a local server. Running the user stories ensures that the UI components update correctly based on backend actions. We concluded that manual testing is necessary after reviewing existing features similar to endorse/unendorse, such as the lock/unlock functionality. These features also involve heavy interaction with UI components and limited automated tests.

These tests can be run by cloning our repo and setting up the redis database and NodeBB server.

An instructor (admin) can endorse/unendorse a topic (question)

  • Log in as an admin

  • Navigate to the page of any topic (serving as a “question”)

  • Underneath the topic title, use the "Topic Tools" dropdown menu and click "Endorse Topic." The topic will be marked with the "Endorsed" label, and the topic timeline below will update to show that the topic has been endorsed.

Screenshot 2024-10-10 at 10 17 58 PM
  • To unendorse, use the same dropdown menu "Topic Tools" and click "Unendorse Topic." The "Endorsed" label will be removed, and the topic timeline below will update to show that the topic has been unendorsed.
Screenshot 2024-10-10 at 10 18 18 PM Screenshot 2024-10-10 at 10 18 30 PM

To endorse more than one topic at a time at the category page:

  • Navigate to the category page.
  • Click to select more than one topic that is not currently endorsed.
Screenshot 2024-10-10 at 10 19 13 PM
  • Click Topic Tools. Click on the “Endorse Topic” button. This will endorse all the topics selected (give them the endorse label). Clicking on one topic that is endorsed will show the label once again in the topic page.
Screenshot 2024-10-10 at 10 19 00 PM

A student (non-admin) cannot endorse/unendorse a topic (question)

  • Log in as a non-admin.
  • Navigate to a topic.
  • You will see that there is no Topic Tools dropdown. The endorse button cannot be found/clicked.
Screenshot 2024-10-10 at 10 56 47 PM
  • Additionally navigate to a category page.
  • You will see that there is also no Topic Tools dropdown. The endorse button cannot be found/clicked.
Screenshot 2024-10-10 at 10 57 15 PM

Answered by an Admin

Automated Testing

This test can be found at test/topics.js on line 620-629. This test ensures that the function addAnswered works correctly by verifying that the field answered is set to one of two values, true or undefined. This test is sufficient because it confirms that the backend logic functions correctly and updates the answered field as expected.

Local Server Testing

For this user story, since the automated test primarily focused on checking whether the answered attribute was present in the database schema, the feature required more user testing to follow the acceptance criteria. For the acceptance criteria, which is ‘a professor adding a post and the topic now being answered’, this is tested by checked by the following:

  • To check when an admin has responded to a post and the ‘answered by professor’ tag appears, log into NodeBB as an admin, respond to a topic with a new post, and the tag should appear.
image
  • To check that when a topic does not have a response from an admin, open NodeBB (do not have to be logged in as an admin) and view a topic without a response from an admin (can be a topic with no response) and the tag will not appear.
image