From 638ec3e45b4ccc663c58d657d1c2935cad6845cc Mon Sep 17 00:00:00 2001 From: nazmul-md Date: Sat, 26 Oct 2024 17:11:38 -0400 Subject: [PATCH 01/25] make debugging false --- app.py | 2 +- database.db | Bin 20480 -> 20480 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index fea5ef3b..8cdf65a9 100644 --- a/app.py +++ b/app.py @@ -360,4 +360,4 @@ def search(): return f"Error: {e}" if __name__ == '__main__': - app.run(debug=True) + app.run(debug=False) diff --git a/database.db b/database.db index e8f517b77a4eb91ff3fe851842591ed0722f29bc..58f1ec9073224af8c76bcba25cbf1b8e10cbf07c 100644 GIT binary patch delta 156 zcmZozz}T>Wae_3X(nJ|&RwV|#s=|#a3;3DkSbk4t7qDhx`Mt4mJ4=9{96N)sa3hO& zVp1{?sTd`x7#gX#S9w^P=ocrt1eaw5B|7I?WV=@8=>=4U`I+Tb7$gOIr+VjxhD3&h zWrZhIhNeda=VXQzCZ^xy>$m GdlUg}4=#ED delta 64 zcmV-G0Kfl$paFoO0gxL3A(0$I1t9<~YS6J{pbrBb1xu3$5IeDf2?euD6}buu9S%eQ W4}A{J4n(sMAS@1%Pztj|F1#U7gAw@v From f02330771bb03184dcf356af5ca58b2fd27d372f Mon Sep 17 00:00:00 2001 From: KKGanguly Date: Sun, 27 Oct 2024 11:17:01 -0400 Subject: [PATCH 02/25] added selenium tests for sign-up page --- UnitTesting/selenium/signup_test.py | 151 ++++++++++++++++++ requirements.txt | Bin 5586 -> 5652 bytes ...__.SignupTestCase_2024-10-27_11-13-41.html | 124 ++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 UnitTesting/selenium/signup_test.py create mode 100644 signup_test_report.html/TestResults___main__.SignupTestCase_2024-10-27_11-13-41.html diff --git a/UnitTesting/selenium/signup_test.py b/UnitTesting/selenium/signup_test.py new file mode 100644 index 00000000..fc7da57d --- /dev/null +++ b/UnitTesting/selenium/signup_test.py @@ -0,0 +1,151 @@ +import unittest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import Select +import time +import uuid +import HtmlTestRunner + +class SignupTestCase(unittest.TestCase): + + @classmethod + def setUpClass(cls): + # Initialize the Firefox WebDriver + cls.driver = webdriver.Firefox() + cls.driver.maximize_window() + cls.driver.implicitly_wait(10) + + def setUp(self): + # Navigate to the signup page before each test + self.driver.get("http://127.0.0.1:5000/signup") # Replace with the actual signup page URL + + def test_signup_with_unique_username(self): + """Test case for signing up with valid data including a randomly generated unique username.""" + driver = self.driver + + # Generate a random unique username + unique_username = f"user_{uuid.uuid4().hex[:8]}" # Generate a username like "user_a1b2c3d4" + + # Fill in Name + name_field = driver.find_element(By.NAME, "name") + name_field.send_keys("Test User") + + # Fill in Username with the unique username + username_field = driver.find_element(By.NAME, "username") + username_field.send_keys(unique_username) + + # Fill in Password + password_field = driver.find_element(By.NAME, "password") + password_field.send_keys("Password123!") + + # Select User Type from dropdown + user_type_dropdown = Select(driver.find_element(By.NAME, "usertype")) + user_type_dropdown.select_by_visible_text("Admin") # Replace with actual option + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + # Wait for the page to load + time.sleep(3) + + # Verify if redirected to the login page URL + expected_url = "http://127.0.0.1:5000/login" + current_url = driver.current_url + self.assertEqual(current_url, expected_url, "Signup was successful and redirected to login page.") + + def test_signup_with_duplicate_username(self): + """Test case for signing up with a duplicate username.""" + driver = self.driver + + # Use the same username as created in the previous test + duplicate_username = f"user_{uuid.uuid4().hex[:8]}" # Generate a username like "user_a1b2c3d4" + + # First signup with a unique username + self._sign_up_user("Test User", duplicate_username, "Password123!", "Admin") + + # Now try to sign up again with the same username + self.driver.get("http://127.0.0.1:5000/signup") # Navigate to signup page + self._sign_up_user("Another User", duplicate_username, "AnotherPassword!", "Admin") + + # Wait for the page to load + time.sleep(3) + + # Verify if still on the signup page + current_url = driver.current_url + self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after duplicate username attempt.") + + def test_signup_with_short_password(self): + """Test case for signing up with a password shorter than 8 characters.""" + driver = self.driver + + # Fill in fields with a short password + self._sign_up_user("Test User", f"user_{uuid.uuid4().hex[:8]}", "short", "Admin") + + # Wait for the page to load + time.sleep(3) + + # Verify if still on the signup page + current_url = driver.current_url + self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after short password attempt.") + + def test_signup_with_blank_fields(self): + """Test case for signing up with blank fields.""" + driver = self.driver + + # Leave all fields blank and submit + name_field = driver.find_element(By.NAME, "name") + username_field = driver.find_element(By.NAME, "username") + password_field = driver.find_element(By.NAME, "password") + user_type_dropdown = Select(driver.find_element(By.NAME, "usertype")) + + name_field.clear() + username_field.clear() + password_field.clear() + user_type_dropdown.select_by_visible_text("") # Assuming there is a blank option or handle error accordingly + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + # Wait for the page to load + time.sleep(3) + + # Verify if still on the signup page + current_url = driver.current_url + self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after submitting blank fields.") + + def _sign_up_user(self, name, username, password, user_type): + """Helper method to fill in the signup form and submit.""" + driver = self.driver + + # Fill in Name + name_field = driver.find_element(By.NAME, "name") + name_field.send_keys(name) + + # Fill in Username + username_field = driver.find_element(By.NAME, "username") + username_field.send_keys(username) + + # Fill in Password + password_field = driver.find_element(By.NAME, "password") + password_field.send_keys(password) + + # Select User Type from dropdown + user_type_dropdown = Select(driver.find_element(By.NAME, "usertype")) + user_type_dropdown.select_by_visible_text(user_type) + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + @classmethod + def tearDownClass(cls): + # Quit the driver after all tests are done + cls.driver.quit() + +# Run the tests +if __name__ == "__main__": + output_file = "signup_test_report.html" + runner = HtmlTestRunner.HTMLTestRunner(output=output_file) + runner.run(unittest.TestLoader().loadTestsFromTestCase(SignupTestCase)) diff --git a/requirements.txt b/requirements.txt index 16ac244d3e2c8c0b4841d90cf658a8828b8cc543..ebc27fb29c6aa1958b71dfcf47fd734b1f3355a2 100644 GIT binary patch delta 74 zcmcblJw<23B~hnhhE#?eAkJgRWGH3GWw2wgWiVmTV=!be1Cj;|ybN3n84M*rnH&aP UAf3uk3?zeqYV&|Fm7$0M0C1BI&Hw-a delta 7 OcmbQDb4h!{B~btkssmL3 diff --git a/signup_test_report.html/TestResults___main__.SignupTestCase_2024-10-27_11-13-41.html b/signup_test_report.html/TestResults___main__.SignupTestCase_2024-10-27_11-13-41.html new file mode 100644 index 00000000..9452fced --- /dev/null +++ b/signup_test_report.html/TestResults___main__.SignupTestCase_2024-10-27_11-13-41.html @@ -0,0 +1,124 @@ + + + + Unittest Results + + + + + +
+
+
+

Unittest Results

+

Start Time: 2024-10-27 11:13:41

+

Duration: 24.54 s

+

Summary: Total: 4, Pass: 2, Fail: 1, Error: 1

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
__main__.SignupTestCaseStatus
test_signup_with_blank_fields + Error + + +

NoSuchElementException: Message: Could not locate element with visible text: ; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception +

Traceback (most recent call last): + File "E:\WolfTrack5.0\UnitTesting\selenium\signup_test.py", line 105, in test_signup_with_blank_fields + user_type_dropdown.select_by_visible_text("") # Assuming there is a blank option or handle error accordingly + File "E:\WolfTrack5.0\test_env\lib\site-packages\selenium\webdriver\support\select.py", line 137, in select_by_visible_text + raise NoSuchElementException(f"Could not locate element with visible text: {text}") +selenium.common.exceptions.NoSuchElementException: Message: Could not locate element with visible text: ; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception + +

+
test_signup_with_duplicate_username + Pass + +
test_signup_with_short_password + Fail + + +

AssertionError: 'http://127.0.0.1:5000/login' != 'http://127.0.0.1:5000/signup' +- http://127.0.0.1:5000/login +? ^^ - ++ http://127.0.0.1:5000/signup +? ^^ ++ + : Page did not forward after short password attempt.

Traceback (most recent call last): + File "E:\WolfTrack5.0\UnitTesting\selenium\signup_test.py", line 90, in test_signup_with_short_password + self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after short password attempt.") +AssertionError: 'http://127.0.0.1:5000/login' != 'http://127.0.0.1:5000/signup' +- http://127.0.0.1:5000/login +? ^^ - ++ http://127.0.0.1:5000/signup +? ^^ ++ + : Page did not forward after short password attempt. +

+
test_signup_with_unique_username + Pass + +
+ Total: 4, Pass: 2, Fail: 1, Error: 1 -- Duration: 24.54 s +
+
+
+
+ + + + Date: Sun, 27 Oct 2024 12:44:07 -0400 Subject: [PATCH 03/25] fixes issues of signup pages according to selenium test cases --- app.py | 21 +++++------ templates/signup.html | 87 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 15 deletions(-) diff --git a/app.py b/app.py index 8cdf65a9..3f558337 100644 --- a/app.py +++ b/app.py @@ -58,22 +58,19 @@ # usertype = db.Column(db.String(20), nullable=False) class RegisterForm(FlaskForm): - username = StringField(render_kw={"placeholder": "Username"}) - name = StringField(render_kw={"placeholder": "Name"}) - password = PasswordField(render_kw={"placeholder": "Password"}) - usertype = SelectField(render_kw={"placeholder": "Usertype"}, choices=[('admin', 'Admin'), ('student', 'Student')]) - submit = SubmitField('Register') - -class LoginForm(FlaskForm): username = StringField(validators=[ InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Username"}) - + name = StringField(validators=[ + InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Name"}) password = PasswordField(validators=[ InputRequired(), Length(min=8, max=20)], render_kw={"placeholder": "Password"}) + usertype = SelectField(render_kw={"placeholder": "Usertype"}, choices=[('admin', 'Admin'), ('student', 'Student')]) + submit = SubmitField('Register') - usertype = SelectField(validators=[ - InputRequired(), Length(min=4, max=20)], render_kw={"placeholder": "Usertype"}, choices=[('admin', 'Admin'), ('student', 'Student')]) - +class LoginForm(FlaskForm): + username = StringField(render_kw={"placeholder": "Username"}) + password = PasswordField(render_kw={"placeholder": "Password"}) + usertype = SelectField( render_kw={"placeholder": "Usertype"}, choices=[('admin', 'Admin'), ('student', 'Student')]) submit = SubmitField('Login') @app.route('/') @@ -360,4 +357,4 @@ def search(): return f"Error: {e}" if __name__ == '__main__': - app.run(debug=False) + app.run(debug=True) diff --git a/templates/signup.html b/templates/signup.html index 4e159eda..fe1c081d 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -15,11 +15,12 @@
-
-

WolfTrack


+ +

WolfTrack


+
Don't stop until you're proud!
@@ -35,20 +36,24 @@
+ + From 697cde98b60a7d2444163aa14b8694beaa0e4fa8 Mon Sep 17 00:00:00 2001 From: KKGanguly Date: Sun, 27 Oct 2024 12:59:27 -0400 Subject: [PATCH 04/25] modified signup test --- UnitTesting/selenium/signup_test.py | 41 ++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/UnitTesting/selenium/signup_test.py b/UnitTesting/selenium/signup_test.py index fc7da57d..c1a2193a 100644 --- a/UnitTesting/selenium/signup_test.py +++ b/UnitTesting/selenium/signup_test.py @@ -1,7 +1,8 @@ import unittest from selenium import webdriver from selenium.webdriver.common.by import By -from selenium.webdriver.support.ui import Select +from selenium.webdriver.support.ui import Select, WebDriverWait +from selenium.webdriver.support import expected_conditions as EC import time import uuid import HtmlTestRunner @@ -49,6 +50,9 @@ def test_signup_with_unique_username(self): # Wait for the page to load time.sleep(3) + # Check for server errors + self._check_for_errors() + # Verify if redirected to the login page URL expected_url = "http://127.0.0.1:5000/login" current_url = driver.current_url @@ -58,9 +62,9 @@ def test_signup_with_duplicate_username(self): """Test case for signing up with a duplicate username.""" driver = self.driver - # Use the same username as created in the previous test - duplicate_username = f"user_{uuid.uuid4().hex[:8]}" # Generate a username like "user_a1b2c3d4" - + # Generate a unique username for the first signup + duplicate_username = f"user_{uuid.uuid4().hex[:8]}" + # First signup with a unique username self._sign_up_user("Test User", duplicate_username, "Password123!", "Admin") @@ -71,6 +75,9 @@ def test_signup_with_duplicate_username(self): # Wait for the page to load time.sleep(3) + # Check for server errors + self._check_for_errors() + # Verify if still on the signup page current_url = driver.current_url self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after duplicate username attempt.") @@ -85,6 +92,9 @@ def test_signup_with_short_password(self): # Wait for the page to load time.sleep(3) + # Check for server errors + self._check_for_errors() + # Verify if still on the signup page current_url = driver.current_url self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after short password attempt.") @@ -102,7 +112,7 @@ def test_signup_with_blank_fields(self): name_field.clear() username_field.clear() password_field.clear() - user_type_dropdown.select_by_visible_text("") # Assuming there is a blank option or handle error accordingly + user_type_dropdown.select_by_visible_text("Admin") # Assuming there is a blank option or handle error accordingly # Submit the form submit_button = driver.find_element(By.NAME, "submit") @@ -111,6 +121,9 @@ def test_signup_with_blank_fields(self): # Wait for the page to load time.sleep(3) + # Check for server errors + self._check_for_errors() + # Verify if still on the signup page current_url = driver.current_url self.assertEqual(current_url, "http://127.0.0.1:5000/signup", "Page did not forward after submitting blank fields.") @@ -139,6 +152,16 @@ def _sign_up_user(self, name, username, password, user_type): submit_button = driver.find_element(By.NAME, "submit") submit_button.click() + def _check_for_errors(self): + # Check for a generic internal server error message in

+ h1_elements = self.driver.find_elements(By.TAG_NAME, "h1") + h1_texts = [h1.text for h1 in h1_elements] + # Check if any

contains the term "error" + internal_error_found = any("error" in h1.lower() for h1 in h1_texts) + # Assert that an internal server error message was not found + self.assertFalse(internal_error_found, "Internal server error detected in the response.") + + @classmethod def tearDownClass(cls): # Quit the driver after all tests are done @@ -147,5 +170,11 @@ def tearDownClass(cls): # Run the tests if __name__ == "__main__": output_file = "signup_test_report.html" - runner = HtmlTestRunner.HTMLTestRunner(output=output_file) + runner = HtmlTestRunner.HTMLTestRunner( + output='.', # Specify the output directory + report_name='signup_test_report', # Set the report name (without extension) + report_title='Signup Test Report', # Title for the report + descriptions='Unit test results' # Description for the report + ) runner.run(unittest.TestLoader().loadTestsFromTestCase(SignupTestCase)) + #unittest.main() \ No newline at end of file From dd080872fc7b7df5df9d405e459dab9bda3397de Mon Sep 17 00:00:00 2001 From: nazmul-md Date: Mon, 28 Oct 2024 21:39:39 -0400 Subject: [PATCH 05/25] login and signup pages' issues solved and tested with selenium --- UnitTesting/selenium/login_test.py | 170 ++++++++++++++++++ ...n__.LoginTestCase_2024-10-28_19-46-46.html | 92 ++++++++++ ...__.SignupTestCase_2024-10-28_18-33-26.html | 92 ++++++++++ app.py | 10 +- database.db | Bin 20480 -> 20480 bytes dbutils.py | 11 ++ static/css/login.css | 5 + templates/login.html | 11 ++ templates/signup.html | 13 ++ 9 files changed, 402 insertions(+), 2 deletions(-) create mode 100644 UnitTesting/selenium/login_test.py create mode 100644 UnitTesting/selenium/login_test_report___main__.LoginTestCase_2024-10-28_19-46-46.html create mode 100644 UnitTesting/selenium/signup_test_report___main__.SignupTestCase_2024-10-28_18-33-26.html diff --git a/UnitTesting/selenium/login_test.py b/UnitTesting/selenium/login_test.py new file mode 100644 index 00000000..30a45338 --- /dev/null +++ b/UnitTesting/selenium/login_test.py @@ -0,0 +1,170 @@ +import unittest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import Select, WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +import time +import HtmlTestRunner + +class LoginTestCase(unittest.TestCase): + + @classmethod + def setUpClass(cls): + # Initialize the Firefox WebDriver + cls.driver = webdriver.Firefox() + cls.driver.maximize_window() + cls.driver.implicitly_wait(10) + + def setUp(self): + # Navigate to the login page before each test + self.driver.get("http://127.0.0.1:5000/login") # Replace with the actual login page URL + + def test_login_with_valid_credentials_admin(self): + """Test case for logging in with valid admin credentials.""" + driver = self.driver + + # Fill in Username + username_field = driver.find_element(By.NAME, "username") + username_field.send_keys("abcdefgh") # Replace with a valid admin username in your database + + # Fill in Password + password_field = driver.find_element(By.NAME, "password") + password_field.send_keys("abcdefgh") # Replace with a valid password in your database + + # Select User Role from dropdown + user_role_dropdown = Select(driver.find_element(By.NAME, "usertype")) + user_role_dropdown.select_by_visible_text("Admin") + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + # Wait for the page to load + time.sleep(3) + + # Check for server errors + self._check_for_errors() + + # Verify if redirected to the admin dashboard page URL + expected_url = "http://127.0.0.1:5000/admin?data=abcdefgh" # Replace with the actual admin dashboard URL + current_url = driver.current_url + self.assertEqual(current_url, expected_url, "Login was successful and redirected to admin dashboard page.") + + def test_login_with_valid_credentials_student(self): + """Test case for logging in with valid student credentials.""" + driver = self.driver + + # Fill in Username + username_field = driver.find_element(By.NAME, "username") + username_field.send_keys("12345678") # Replace with a valid student username in your database + + # Fill in Password + password_field = driver.find_element(By.NAME, "password") + password_field.send_keys("12345678") # Replace with a valid password in your database + + # Select User Role from dropdown + user_role_dropdown = Select(driver.find_element(By.NAME, "usertype")) + user_role_dropdown.select_by_visible_text("Student") + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + # Wait for the page to load + time.sleep(3) + + # Check for server errors + self._check_for_errors() + + # Verify if redirected to the student dashboard page URL + expected_url = "http://127.0.0.1:5000/student?data=12345678" # Replace with the actual student dashboard URL + current_url = driver.current_url + self.assertEqual(current_url, expected_url, "Login was successful and redirected to student dashboard page.") + + def test_login_with_invalid_credentials(self): + """Test case for logging in with invalid credentials.""" + driver = self.driver + + # Fill in Username + username_field = driver.find_element(By.NAME, "username") + username_field.send_keys("invalid_user") + + # Fill in Password + password_field = driver.find_element(By.NAME, "password") + password_field.send_keys("WrongPassword!") + + # Select User Role from dropdown + user_role_dropdown = Select(driver.find_element(By.NAME, "usertype")) + user_role_dropdown.select_by_visible_text("Admin") + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + # Wait for the page to load + time.sleep(3) + + # Check for server errors + self._check_for_errors() + + # Verify if still on the login page + current_url = driver.current_url + self.assertEqual(current_url, "http://127.0.0.1:5000/login", "Page did not forward after invalid login attempt.") + + # Verify if an error message is displayed + error_message = driver.find_element(By.CLASS_NAME, "alert-danger") + self.assertTrue(error_message.is_displayed(), "Error message is not displayed for invalid login.") + + def test_login_with_blank_fields(self): + """Test case for logging in with blank fields.""" + driver = self.driver + + # Leave fields blank and submit + username_field = driver.find_element(By.NAME, "username") + password_field = driver.find_element(By.NAME, "password") + + username_field.clear() + password_field.clear() + + # Select User Role from dropdown + user_role_dropdown = Select(driver.find_element(By.NAME, "usertype")) + user_role_dropdown.select_by_visible_text("Admin") + + # Submit the form + submit_button = driver.find_element(By.NAME, "submit") + submit_button.click() + + # Wait for the page to load + time.sleep(3) + + # Check for server errors + self._check_for_errors() + + # Verify if still on the login page + current_url = driver.current_url + self.assertEqual(current_url, "http://127.0.0.1:5000/login", "Page did not forward after submitting blank fields.") + + def _check_for_errors(self): + # Check for a generic internal server error message in

+ h1_elements = self.driver.find_elements(By.TAG_NAME, "h1") + h1_texts = [h1.text for h1 in h1_elements] + # Check if any

contains the term "error" + internal_error_found = any("error" in h1.lower() for h1 in h1_texts) + # Assert that an internal server error message was not found + self.assertFalse(internal_error_found, "Internal server error detected in the response.") + + @classmethod + def tearDownClass(cls): + # Quit the driver after all tests are done + cls.driver.quit() + +# Run the tests +if __name__ == "__main__": + output_file = "login_test_report.html" + runner = HtmlTestRunner.HTMLTestRunner( + output='.', # Specify the output directory + report_name='login_test_report', # Set the report name (without extension) + report_title='Login Test Report', # Title for the report + descriptions='Unit test results' # Description for the report + ) + runner.run(unittest.TestLoader().loadTestsFromTestCase(LoginTestCase)) diff --git a/UnitTesting/selenium/login_test_report___main__.LoginTestCase_2024-10-28_19-46-46.html b/UnitTesting/selenium/login_test_report___main__.LoginTestCase_2024-10-28_19-46-46.html new file mode 100644 index 00000000..8d51e861 --- /dev/null +++ b/UnitTesting/selenium/login_test_report___main__.LoginTestCase_2024-10-28_19-46-46.html @@ -0,0 +1,92 @@ + + + + Login Test Report + + + + + +
+
+
+

Login Test Report

+

Start Time: 2024-10-28 19:46:46

+

Duration: 55.76 s

+

Summary: Total: 4, Pass: 4

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
__main__.LoginTestCaseStatus
test_login_with_blank_fields + Pass + +
test_login_with_invalid_credentials + Pass + +
test_login_with_valid_credentials_admin + Pass + +
test_login_with_valid_credentials_student + Pass + +
+ Total: 4, Pass: 4 -- Duration: 55.76 s +
+
+
+
+ + + + + + + Signup Test Report + + + + + +
+
+
+

Signup Test Report

+

Start Time: 2024-10-28 18:33:26

+

Duration: 54.25 s

+

Summary: Total: 4, Pass: 4

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
__main__.SignupTestCaseStatus
test_signup_with_blank_fields + Pass + +
test_signup_with_duplicate_username + Pass + +
test_signup_with_short_password + Pass + +
test_signup_with_unique_username + Pass + +
+ Total: 4, Pass: 4 -- Duration: 54.25 s +
+
+
+
+ + + +Wae_3X+C&*=MzxIzOZb_Um|G{a3)ph7EM#$He#qRqvC)#bK1zw5K~}br zMcUBF*u>P#+yX|c7$vC~8mR=N>sRPGMY%eq1iO2hSX8By7NmLTg%p_<=;x=Ehq`B( zMiy2Ym3fu~8I=@->z5jb7nqn8mz1WY=9R=LvNOo5H?oL_q!yPbgche3l>%|RWlD0g zfk{#l$cB2L6)D;2#p&t38HFw;zLpV5-k}w~K4t#i?%|mpIl*3m!LHdBej&Lb&W1_( zS>`3B*`8?z?*54>xtV!!3Ro>LOENT1vM^7CdO_c`z{g3?B*-TqFft;~Jg_`VKi}Ek zF()X>udKc}(agLgHM7LCG(W)AE2yH#$k@;=JR-OhY(a!PBy_|Rlafgi*{^PIZJIm+7XT!II--}OwvWS8K3!f|>_vS!_O}utI i%(9HIs8JGRR%b*BN=3K`%y4KUZrZ?@4pq6h%PYn^}q delta 67 zcmV-J0KETzpaFoO0gxL3B9R', username, usertype) + cursor = conn.cursor() + # Querying the 'client' table + cursor.execute("SELECT * FROM client WHERE username = ? AND usertype=?", (username,usertype)) + rows = cursor.fetchone() + conn.close() + print('rowsss->>>', rows) + return rows + def find_user(data,db): conn = sqlite3.connect(db) diff --git a/static/css/login.css b/static/css/login.css index f6aeddf9..150bf1b0 100755 --- a/static/css/login.css +++ b/static/css/login.css @@ -14,6 +14,11 @@ body { background-color: #e92626; padding: 30px; } +.alert-custom-red { + color: red; + font-weight: bold; +} + .container{ position: relative; max-width: 850px; diff --git a/templates/login.html b/templates/login.html index 4a930664..a7d523c9 100755 --- a/templates/login.html +++ b/templates/login.html @@ -35,6 +35,17 @@
+
+ - rows.forEach(row => { - // Skip the header row - if (row.querySelectorAll('th').length > 0) { - return; - } - let rowText = ''; - // Concatenate text from all cells - for (let cell of row.cells) { - rowText += cell.textContent || cell.innerText; - } - // Check if the row includes the filter text - row.style.display = rowText.toUpperCase().includes(filter) ? '' : 'none'; - }); - }); - - {% endblock %} From fbe7188ec822c1c8f6e9862b16666391d887762b Mon Sep 17 00:00:00 2001 From: nazmul-md Date: Wed, 30 Oct 2024 19:54:59 -0400 Subject: [PATCH 11/25] applied jobs edit and deletion done. --- app.py | 32 +++++++++---------- database.db | Bin 20480 -> 24576 bytes dbutils.py | 15 +++++---- templates/home.html | 74 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 25 deletions(-) diff --git a/app.py b/app.py index 72c987e1..888c42b2 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,7 @@ ''' MIT License -Copyright (c) 2023 Shonil B, Akshada M, Rutuja R, Sakshi B +Copyright (c) 2024 MD NAZMUL HAQUE, KISHAN KUMAR GANGULY, RAVI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -26,7 +26,7 @@ from Controller.chat_gpt_pipeline import pdf_to_text,chatgpt from Controller.data import data, upcoming_events, profile from Controller.send_email import * -from dbutils import add_job, create_tables, add_client, delete_job_application_by_company ,find_user, get_job_applications, get_job_applications_by_status, update_job_application_by_id, get_user_by_username_role +from dbutils import add_job, create_tables, add_client, delete_job_application_by_job_id ,find_user, get_job_applications, get_job_applications_by_status, update_job_application_by_id, get_user_by_username_role from login_utils import login_user import requests import urllib.parse @@ -160,11 +160,10 @@ def admin(): def student(): if(isLoggedIn()==False): return redirect(url_for('login')) - user_id = session['user_name'] - user = find_user(user_id,database) + user_name = session['user_name'] + user = find_user(user_name,database) - jobapplications = get_job_applications(database) - print(len(jobapplications)," len") + jobapplications = get_job_applications(user_name, database) return render_template('home.html', user=user, jobapplications=jobapplications) # return render_template('home-2.html', user=user, jobapplications=jobapplications) @@ -216,30 +215,29 @@ def add_job_application(): @app.route('/student/update_job_application',methods=['GET','POST']) def update_job_application(): if request.method == 'POST': + job_id = request.form['job_id'] company = request.form['company'] location = request.form['location'] jobposition = request.form['jobposition'] salary = request.form['salary'] status = request.form['status'] - user_id = request.form['user_id'] + user_name = session['user_name'] # Perform the update operation - update_job_application_by_id( company, location, jobposition, salary, status, database) # Replace this with your method to update the job + update_job_application_by_id( job_id, company, location, jobposition, salary, status, database) # Replace this with your method to update the job flash('Job Application Updated!') # Redirect to a success page or any relevant route after successful job update - return redirect(url_for('student', data=user_id)) + return redirect(url_for('student', data=user_name)) -@app.route('/student/delete_job_application/', methods=['POST']) -def delete_job_application(company): +@app.route('/student/delete_job_application', methods=['POST']) +def delete_job_application(): if request.method == 'POST': - user_id = request.form['user_id'] - # Perform the deletion operation - delete_job_application_by_company(company,database) # Using the function to delete by company name - + job_id = request.args.get('job_id') + user_name = request.args.get('user_name') + delete_job_application_by_job_id(job_id,database) flash('Job Application Deleted!') - # Redirect to a success page or any relevant route after successful deletion - return redirect(url_for('student', data=user_id)) # Redirect to the student page or your desired route + return redirect(url_for('student', data=user_name)) @app.route('/student/add_New',methods=['GET','POST']) def add_New(): diff --git a/database.db b/database.db index 353c02d4b1e07f6fe9f22cda5ff5fc7f5b0aedc7..65c13c0d3c8765e73beac96a98c5ba8449489f2a 100644 GIT binary patch delta 1261 zcmcgqOKTHR6uy(0B$IhI)|iG6lTN73*pL_`wlqy^TBapvrZOF&0U=D&DMZpt+nFkL zlRjK1Zj@OnZTBLybSvUge5`aK?ZS=VUvMSfJ5lw`djR2 zG?)Vb_~0hs#?bj$`f4}_G7pwn&I1T$2XKe{2X>Fyp`Yw;gy{BW-s=x%v)IFkrOh>U zbGbQJv-HKKnscq?T!3#vkxHtRP)p-CrG(&m7ZNEdAT;KMKv`C$DM?AgYu#8}(pqb^ zmbR!10acn+5!y8BZOv*Jtz+n}F;`nM%*JWd)SBAL+Nq4DrCF=yap0<{ulz}WT=$kz zu9TE&;)YaBAxVkSZFRaVLkAT}RyR{#e;aw(i!bv&?mcI7Dwm|T+3)NwJI`KbelRZ?i^(%y`W^k4mgoQ-*xy*7r~*xbSR{w{ z5%#ZQb_BfE5#f^K!#$84&*4$R zmWvq<;p1VLGd75egng%Q&4G#+NYIDKCZYxTLcdQWN{Litk!gy3A_?zu!~o%!5r==Tw` c4|kXtH2PvJ;uwWrD~*Dag#BjhB7s=H0f2Twga7~l delta 115 zcmZoTz}T>Wae}m>>', rows) return rows -def update_job_application_by_id(company, location, jobposition, salary, status,db): +def update_job_application_by_id(job_id, company, location, jobposition, salary, status,db): conn = sqlite3.connect(db) cursor = conn.cursor() # Update the 'jobs' table based on jobid - cursor.execute("UPDATE jobs SET company_name=?, location=?, job_position=?, salary=?, status=? WHERE company_name=?", - (company, location, jobposition, salary, status, company)) + cursor.execute("UPDATE jobs SET company_name=?, location=?, job_position=?, salary=?, status=? WHERE id=?", + (company, location, jobposition, salary, status, job_id)) conn.commit() conn.close() -def delete_job_application_by_company(company_name,db): +def delete_job_application_by_job_id(job_id,db): conn = sqlite3.connect(db) cursor = conn.cursor() # Delete the job application from the 'jobs' table based on the company name - cursor.execute("DELETE FROM jobs WHERE company_name=?", (company_name,)) + cursor.execute("DELETE FROM jobs WHERE id=?", (job_id,)) conn.commit() conn.close() diff --git a/templates/home.html b/templates/home.html index c96fca36..6f20523a 100755 --- a/templates/home.html +++ b/templates/home.html @@ -46,7 +46,81 @@

Applied Jobs

{{ row[3] }} {{ row[4] }} {{ row[5] }} + + + + + + + + + {% endfor %} From bb3feb15334b52c214524655d497dada83edf387 Mon Sep 17 00:00:00 2001 From: nazmul-md Date: Wed, 30 Oct 2024 21:03:26 -0400 Subject: [PATCH 12/25] landing page changed --- templates/index copy.html | 124 ++++++++++++++++++++ templates/index.html | 237 ++++++++++++++++++++------------------ 2 files changed, 252 insertions(+), 109 deletions(-) create mode 100644 templates/index copy.html diff --git a/templates/index copy.html b/templates/index copy.html new file mode 100644 index 00000000..045c99ca --- /dev/null +++ b/templates/index copy.html @@ -0,0 +1,124 @@ + + + + + + WolfTrack + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+
+ 100x100 +
+ +
+
Login
+
+
Signup
+
+
+
+
+
+ + + + diff --git a/templates/index.html b/templates/index.html index 045c99ca..6da8df6d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,124 +1,143 @@ - - + - WolfTrack - - - - - - - - - - - - - - + + + + {% block title %}WolfTrack{% endblock %} - - -
- - -
-
-
-
- 100x100 + + + +

Resume Suggestions

Receive personalized suggestions to optimize your resume for specific job opportunities and industries, leveraging the latest AI-powered tools.

- Get Suggestions + Get Suggestions

diff --git a/templates/layout/base.html b/templates/layout/base.html index 8bf5356f..bffc58e4 100644 --- a/templates/layout/base.html +++ b/templates/layout/base.html @@ -234,7 +234,7 @@ > +
-
-
-

-
-
- - -
-
-

{{ data }}

- -
-
-
+
+
+

Job Description Analyzer

+
+
+ +
+
+ +
+

{{ data }}

+
+
+
- - - \ No newline at end of file + + + From d8f01de786c9e4dce62b2bf28396e47321c643fa Mon Sep 17 00:00:00 2001 From: rcb1409 Date: Thu, 31 Oct 2024 15:05:38 -0400 Subject: [PATCH 25/25] Add input placeholders and validation feedback to job search form --- templates/job_search.html | 44 ++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/templates/job_search.html b/templates/job_search.html index e54f51fa..6b3d8d9a 100644 --- a/templates/job_search.html +++ b/templates/job_search.html @@ -5,26 +5,26 @@ {% block content %}
-
-

Search Jobs

-
+
+

Search Jobs

+
+
Please provide a job title.
- +
-
@@ -33,6 +33,7 @@

Search Jobs

@@ -48,8 +49,8 @@

Search Jobs

-
-

Job Search Results

+
+

Job Search Results

{% if jobs %} @@ -69,7 +70,7 @@

Job Search Results

- + @@ -78,9 +79,8 @@

Job Search Results

{{ job.title }} {{ job.company.display_name }} {{ job.location.display_name }}{{ job.contract_time}}, {{job.contract_type}}{{ job.contract_time }}, {{ job.contract_type }} Link