Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated testing for bug log page (User Story 2) #38

Open
wants to merge 69 commits into
base: f24
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3fc20d4
check
Sep 27, 2024
07b1323
pulled
Sep 27, 2024
60a8c94
debugging
Oct 7, 2024
235032a
fixing controller to match view
Oct 9, 2024
b8e2aa4
updating ther frontend to match controler and view
Oct 9, 2024
be25711
updating ther frontend to match controler
Oct 9, 2024
96498ef
fixing the call on the api front end
Oct 9, 2024
916ce8b
fixing the table frontend
Oct 9, 2024
04f20f7
fixing rendering
Oct 9, 2024
d8b2c00
fixing views to correct the loop
Oct 9, 2024
0bc1d08
fixing syntax
Oct 9, 2024
8ad243d
the posting of data in bug log page
Oct 9, 2024
6b155f4
fixing the controller
Oct 9, 2024
08cf766
post api reportbug
Oct 9, 2024
d9470ca
fixing html file so it submits the report
Oct 11, 2024
cdd3845
debugging the html file
Oct 11, 2024
af0f28e
fixing syntax
Oct 11, 2024
eb03064
fixing syntax
Oct 11, 2024
37f5795
fixing syntax
Oct 11, 2024
d02718d
fixing syntax
Oct 11, 2024
9f106da
fixing syntax
Oct 11, 2024
298922f
logging check
Oct 11, 2024
368a58f
fixing and connection the post api in the report
Oct 13, 2024
10e7473
fixing and connection the post api in the report and fixing the bugs …
Oct 13, 2024
7e4a6ec
debugging report form
Oct 13, 2024
6559cb4
debugging report form
Oct 14, 2024
0e64179
debugging report form event listner
Oct 14, 2024
5836e5b
debugging report form event listner
Oct 14, 2024
f736d54
debugging the form
Oct 14, 2024
223442d
debugging the form including the fetch and the event listener
Oct 14, 2024
1e15862
added service worker and adjusted the report form
Oct 14, 2024
05eeb39
fixing service worker
Oct 14, 2024
d466609
fetch requests are handled correctly in service worker
Oct 14, 2024
3c39f0b
checking service worker
Oct 14, 2024
19fc108
debugging the report form
Oct 14, 2024
cd106bd
adding event listener
Oct 14, 2024
73e3f13
debugging event listener
Oct 14, 2024
23231d6
trying to fetch from the report
Oct 14, 2024
8d59077
removing event listener
Oct 14, 2024
502d8a1
fixing the reprt form
Oct 14, 2024
7d7c92e
debugging the token
Oct 14, 2024
fa7a62a
debugging the token
Oct 14, 2024
31b9aae
created the tests and file for bug log page
Oct 17, 2024
dce4ce6
fixing the testing style to mach teh rest of the test cases
Oct 17, 2024
17e0698
fixing the path of tests
Oct 17, 2024
8956aa7
fixing the define function
Oct 17, 2024
910dfa9
fixing the define function and the style
Oct 17, 2024
3de26ea
fixing the use of packages in file
Oct 17, 2024
1c8701c
fixing the file path
Oct 17, 2024
8054796
fixing the file path
Oct 18, 2024
1fe5702
fixing the file pathand altering the style of code
Oct 18, 2024
ac8154a
adjusting the functions
Oct 18, 2024
590e86f
adjusting the functions
Oct 18, 2024
3ca5f41
adjusting the functions
Oct 18, 2024
3539def
adjusting the functions
Oct 18, 2024
1fc77b5
adjusting the functions
Oct 18, 2024
637f11e
adjusting the indentations
Oct 18, 2024
77542b6
adjusting the indentations and errors
Oct 18, 2024
7d70c1d
adjusting the indentations and errors
Oct 18, 2024
0d40bdc
adjusting the indentations and errors
Oct 18, 2024
4b3a029
adjusting the indentation
Oct 18, 2024
9a8c986
fixing the schema
Oct 18, 2024
aec85de
fixing the schema
Oct 18, 2024
91390da
adding the get buglog to the schema
Oct 19, 2024
0e8dacc
fixing csrf error
Oct 21, 2024
94888ad
fixing the submit controller
Oct 22, 2024
e3df59f
setting the user as email
Oct 22, 2024
9175499
reverting changes
Oct 22, 2024
a7db483
fix
Oct 24, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/azure-deploy-f24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
./.github/workflows/test.yaml

build-and-deploy:
if: github.repository == 'cmu-313/NodeBB'
if: github.repository == 'CMU-17313Q/nodebb-f24-logic-lords'
needs: lint-and-test

runs-on: ubuntu-latest
Expand All @@ -34,7 +34,7 @@ jobs:

- name: Set up NodeBB
run: |
./nodebb setup '{"url":"https://nodebb-f24.azurewebsites.net:443",
./nodebb setup '{"url":"https://nodebb-logic-lords.azurewebsites.net:443",
"admin:username": "admin",
"admin:password": "${{ secrets.ADMIN_PASSWORD }}",
"admin:password:confirm": "${{ secrets.ADMIN_PASSWORD }}",
Expand All @@ -48,7 +48,7 @@ jobs:
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'nodebb-f24'
app-name: 'nodebb-Logic-Lords'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BFAB97B1AB1441ACA7C63280F91AD3F3 }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_881BB99C03D242D38887A5B46C8A0B12 }}
package: .
59 changes: 59 additions & 0 deletions UserGuide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# User Guide

## Introduction
This guide provides an outline of how to use and user test the new features added to NodeBB by the Logic Lords team. It also includes a description of the added automated tests for these features and where to find them.

---

## NodeBB Installation
NodeBB requires the following software to be installed:
- A version of Node.js at least 16 or greater (installation/upgrade instructions)
- MongoDB, version 3.6 or greater or Redis, version 2.8.9 or greater
- If you are using clustering you need Redis installed and configured.
- nginx, version 1.3.13 or greater (only if intending to use nginx to proxy requests to a NodeBB

Then, you can install NodeBB by following the below installation instructions based on your computer's operating system, but instead of cloning the class repository you should clone [this](https://github.com/CMU-17313Q/nodebb-f24-logic-lords) one:
- [Mac](https://cmu-17313q.github.io/projects/P1/installation/mac/)
- [Windows](https://cmu-17313q.github.io/projects/P1/installation/windows/)
- [Ubuntu (Linux)](https://cmu-17313q.github.io/projects/P1/installation/ubuntu/)

---

## How to Use The New Features

### Posting Anonymously
To make an anonymous post, navigate to any of the four interaction pages in NodeBB: _Announcements_, _General Discussion_, _Comments & Feedback_, or _Blogs_. Click on `New Topic`. A small pop-up window should appear where you can fill in the details of your new topic. Fill in at least a long enough title and post content. Then, you should see a blue `Submit` button on the top-right of pop-up window, with an arrow pointing down. Click the arrow, and a drop down menu should show. Click the second option in the menu: `Submit Anonymously`. Your post will be published without associating it with your user ID.

### Content Filtering
To use content filtering, go to any of the four interaction pages in NodeBB: _Announcements_, _General Discussion_, _Comments & Feedback_, or _Blogs_. When creating a new topic, if your title or message contains any inappropriate words from our predefined list (e.g., 'verybadword', which we added so that you don't have to use actual inappropriate words), a warning message will appear, stating: "Your title/message contains inappropriate words, please update it accordingly." You will not be able to submit your message until the inappropriate words are removed. Similarly, if you reply to a post with inappropriate words in your message, a warning message will appear, and you will be unable to send your reply until it is corrected.

### Bug Reporting and Bug Log
To use the bug reporting feature, users should navigate to the bug report form by clicking on the `Report Bug` button, which can be found on the left side bar and is visible on all pages (excluding the Admin page). After clicking on this button, users will be directed to a form which they will need to fill out with their name, email address, and a description of the bug they encountered. After filling out the form, users should click the `Submit` button to send their report. The form will validate the inputs to ensure all required fields are filled correctly, including a valid email address.

---

## Automated Tests

### Posting Anonymously
The ability to post anonymously and hide your user ID has been tested by adding tests in both [test/posts.js](https://github.com/CMU-17313Q/nodebb-f24-logic-lords/blob/f24/test/posts.js) and [test/topics.js](https://github.com/CMU-17313Q/nodebb-f24-logic-lords/blob/f24/test/topics.js) for the cases where a post is created successfully when a isAnonymous attribute is added. In addition, the tests ensure that the uid of such created posts are 0, ensuring the anonymity of the author and that their uid was never saved in the database. And thus fully testing the correctness of the feature.

### Content Filtering
Content filtering functionality has been tested thoroughly, with test cases added to the [test/posts.js](https://github.com/CMU-17313Q/nodebb-f24-logic-lords/blob/f24/test/posts.js) file from lines 448 to 478. These tests cover a variety of scenarios to ensure the system accurately detects inappropriate content: (1) The post's title contains inappropriate words, (2) The post's message contains inappropriate words, (3) Neither the title nor the message contains inappropriate words. Each test checks whether the system correctly identifies and handles these cases by displaying appropriate warning messages to users. Given that all possible scenarios are accounted for, the current set of test cases is comprehensive and sufficient to validate the content filtering mechanism.

### Bug Reporting and Bug Log

As for the bug report form, it has been tested carfully to ensure its functionality is sucessfully implement by covering essential scenarios which can be found in the [test/bug-report-form.js](https://github.com/CMU-17313Q/nodebb-f24-logic-lords/blob/testing-bug-report-form/test/bug-report-form.js) file. Test cases include: (1) The form fetches and logs data correctly upon submission, (2) The email field is validated for proper format, (3) The name field cannot be submitted if left empty, (4) The email field must not be empty, and (5) The bug description cannot be empty as well. Each test validates the form’s ability to handle these cases by checking that submission is prevented when necessary and appropriate error messages are displayed. The tests provide comprehensive coverage to validate the form’s functionality.

The functionality of the Bug-Log button in the admin dashboard navigation has been tested by extending the existing test of 'should load admin dashboard'. The test checks for the loading of the route `/admin/dashboard/bug-logs`, guranteeing that the button is in the navigation of the admin dashboard and loads the appropriate view file of a table that would record all reported bugs from the user bug report form (bug-logs.tpl). This contributes to ensure that the admin dashboard comprehensively loads all the correct pre-existing navigation features with the newly added functionality of showing bug-logs.

The bug log page has been tested thoroughly in the file [test/bug-logs.js](https://github.com/CMU-17313Q/nodebb-f24-logic-lords/blob/testing/test/bug-logs.js). Test cases include: (1) The fetchBugLogs function correctly fetches and displays bug logs from the API, (2) The submitBugReport function successfully submits a bug report when the description is provided, (3) The bug report description field is validated to ensure it is not empty before submission, (4) The bug logs container is properly emptied and updated with new logs upon fetching, and (5) Error handling is tested to ensure appropriate messages are displayed when fetching or submitting fails. Each test validates the module's ability to handle these cases by checking that the DOM is updated correctly and appropriate console messages are logged. The tests provide comprehensive coverage to validate the module's functionality.

in the case of this user story due to its incompletion this has resulted in manual testing to ensure seperate functionalities are working. We focused on validating key API operations:

1. **GET Requests**: We manually tested the API's ability to fetch data using the browser's Console tab. By executing `fetch` commands, we verified that responses included the expected information such as user IDs, usernames, and login statuses, confirming that data retrieval worked correctly.

2. **Form Submission**: We also monitored the Network tab to ensure that when we submitted forms, the correct data was sent to the API and appropriate responses were received. This step was crucial in validating the data submission flow.

3. **Error Handling**: Tests included checking how the system reacted to failure scenarios, ensuring that appropriate error messages were displayed when fetching or submitting data failed.

These tests helped us ensure the controller was handling data effectively.
Binary file added dump 2.rdb
Binary file not shown.
Binary file added dump 3.rdb
Binary file not shown.
25 changes: 25 additions & 0 deletions inappropriate-words.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
"verybadword",
"idiot",
"moron",
"stupid",
"dumb",
"loser",
"worthless",
"lame",
"pathetic",
"fool",
"trash",
"hell",
"lmao",
"lmfao",
"beer",
"dammit",
"kill",
"nigga",
"wtf",
"shit",
"weed",
"sadist",
"goddamn"
]
198 changes: 198 additions & 0 deletions install/package 2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"name": "nodebb",
"license": "GPL-3.0",
"description": "NodeBB Forum",
"version": "3.8.4",
"homepage": "https://www.nodebb.org",
"repository": {
"type": "git",
"url": "https://github.com/NodeBB/NodeBB/"
},
"main": "app.js",
"scripts": {
"start": "node loader.js",
"lint": "eslint --cache ./nodebb .",
"test": "nyc --reporter=html --reporter=text-summary mocha",
"coverage": "nyc report --reporter=text-lcov > ./coverage/lcov.info",
"coveralls": "nyc report --reporter=text-lcov | coveralls && rm -r coverage"
},
"nyc": {
"exclude": [
"src/upgrades/*",
"test/*"
]
},
"lint-staged": {
"*.js": [
"eslint --fix"
]
},
"dependencies": {
"@adactive/bootstrap-tagsinput": "0.8.2",
"@fontsource/inter": "5.0.18",
"@fontsource/poppins": "5.0.14",
"@fortawesome/fontawesome-free": "6.5.2",
"@isaacs/ttlcache": "1.4.1",
"@nodebb/spider-detector": "2.0.3",
"@popperjs/core": "2.11.8",
"ace-builds": "1.33.2",
"archiver": "7.0.1",
"async": "3.2.5",
"autoprefixer": "10.4.19",
"bcryptjs": "2.4.3",
"benchpressjs": "2.5.1",
"body-parser": "1.20.2",
"bootbox": "6.0.0",
"bootstrap": "5.3.3",
"bootswatch": "5.3.3",
"chalk": "4.1.2",
"chart.js": "4.4.2",
"cli-graph": "3.2.2",
"clipboard": "2.0.11",
"colors": "1.4.0",
"commander": "12.0.0",
"compare-versions": "6.1.0",
"compression": "1.7.4",
"connect-flash": "0.1.1",
"connect-mongo": "5.1.0",
"connect-multiparty": "2.2.0",
"connect-pg-simple": "9.0.1",
"connect-redis": "7.1.1",
"cookie-parser": "1.4.6",
"cron": "3.1.7",
"cropperjs": "1.6.2",
"csrf-sync": "4.0.3",
"daemon": "1.1.0",
"diff": "5.2.0",
"esbuild": "0.21.2",
"express": "4.19.2",
"express-session": "1.18.0",
"express-useragent": "1.0.15",
"fetch-cookie": "3.0.1",
"file-loader": "6.2.0",
"fs-extra": "11.2.0",
"graceful-fs": "4.2.11",
"helmet": "7.1.0",
"html-to-text": "9.0.5",
"imagesloaded": "5.0.0",
"ipaddr.js": "2.2.0",
"jquery": "3.7.1",
"jquery-deserialize": "2.0.0",
"jquery-form": "4.3.0",
"jquery-serializeobject": "1.0.0",
"jquery-ui": "1.13.3",
"jsesc": "3.0.2",
"json2csv": "5.0.7",
"jsonwebtoken": "9.0.2",
"lodash": "4.17.21",
"logrotate-stream": "0.2.9",
"lru-cache": "10.2.2",
"mime": "3.0.0",
"mkdirp": "3.0.1",
"mongodb": "6.6.1",
"morgan": "1.10.0",
"mousetrap": "1.6.5",
"multiparty": "4.2.3",
"nconf": "0.12.1",
"nodebb-plugin-2factor": "7.5.3",
"nodebb-plugin-composer-default": "10.2.36",
"nodebb-plugin-dbsearch": "6.2.5",
"nodebb-plugin-emoji": "5.1.15",
"nodebb-plugin-emoji-android": "4.0.0",
"nodebb-plugin-markdown": "12.2.6",
"nodebb-plugin-mentions": "4.4.3",
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0",
"nodebb-theme-harmony": "1.2.63",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.6",
"nodebb-theme-persona": "13.3.25",
"nodebb-widget-essentials": "7.0.18",
"nodemailer": "6.9.13",
"nprogress": "0.2.0",
"passport": "0.7.0",
"passport-http-bearer": "1.0.1",
"passport-local": "1.0.0",
"pg": "8.11.5",
"pg-cursor": "2.10.5",
"postcss": "8.4.38",
"postcss-clean": "1.2.0",
"progress-webpack-plugin": "1.0.16",
"prompt": "1.3.0",
"ioredis": "5.4.1",
"rimraf": "5.0.7",
"rss": "1.2.2",
"rtlcss": "4.1.1",
"sanitize-html": "2.13.0",
"sass": "1.77.1",
"semver": "7.6.2",
"serve-favicon": "2.5.0",
"sharp": "0.32.6",
"sitemap": "7.1.1",
"socket.io": "4.7.5",
"socket.io-client": "4.7.5",
"@socket.io/redis-adapter": "8.3.0",
"sortablejs": "1.15.2",
"spdx-license-list": "6.9.0",
"terser-webpack-plugin": "5.3.10",
"textcomplete": "0.18.2",
"textcomplete.contenteditable": "0.1.1",
"timeago": "1.6.7",
"tinycon": "0.6.8",
"toobusy-js": "0.5.1",
"tough-cookie": "4.1.4",
"validator": "13.12.0",
"webpack": "5.91.0",
"webpack-merge": "5.10.0",
"winston": "3.13.0",
"workerpool": "9.1.1",
"xml": "1.0.1",
"xregexp": "5.1.1",
"yargs": "17.7.2",
"zxcvbn": "4.4.2"
},
"devDependencies": {
"@apidevtools/swagger-parser": "10.1.0",
"@commitlint/cli": "19.3.0",
"@commitlint/config-angular": "19.3.0",
"coveralls": "3.1.1",
"eslint": "8.57.0",
"eslint-config-nodebb": "0.2.1",
"eslint-plugin-import": "2.29.1",
"grunt": "1.6.1",
"grunt-contrib-watch": "1.1.0",
"husky": "8.0.3",
"jsdom": "24.0.0",
"lint-staged": "15.2.2",
"mocha": "10.4.0",
"mocha-lcov-reporter": "1.3.0",
"mockdate": "3.0.5",
"nyc": "15.1.0",
"smtp-server": "3.13.4"
},
"optionalDependencies": {
"sass-embedded": "1.77.1"
},
"resolutions": {
"*/jquery": "3.7.1"
},
"bugs": {
"url": "https://github.com/NodeBB/NodeBB/issues"
},
"engines": {
"node": ">=18"
},
"maintainers": [
{
"name": "Julian Lam",
"email": "[email protected]",
"url": "https://github.com/julianlam"
},
{
"name": "Barış Soner Uşaklı",
"email": "[email protected]",
"url": "https://github.com/barisusakli"
}
]
}
Loading