Skip to content
Open

Main #54

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
638ec3e
make debugging false
nazmul-me Oct 26, 2024
f023307
added selenium tests for sign-up page
KKGanguly Oct 27, 2024
087b265
fixes issues of signup pages according to selenium test cases
nazmul-me Oct 27, 2024
697cde9
modified signup test
KKGanguly Oct 27, 2024
dd08087
login and signup pages' issues solved and tested with selenium
nazmul-me Oct 29, 2024
1bf1b51
fixed: users have to be logged in to perform any actions except login…
nazmul-me Oct 29, 2024
759171e
refactor user dashboard and advanced search jobs
nazmul-me Oct 30, 2024
523ee04
job detail modal added
nazmul-me Oct 30, 2024
03711cd
user homepage added
nazmul-me Oct 30, 2024
416c00f
pagination added
nazmul-me Oct 30, 2024
fbe7188
applied jobs edit and deletion done.
nazmul-me Oct 30, 2024
bb3feb1
landing page changed
nazmul-me Oct 31, 2024
174a2c9
login page UI changed and make consistent with others.
nazmul-me Oct 31, 2024
3c81c49
signup page is changed so that it is consistent to other pages.
nazmul-me Oct 31, 2024
14a268c
requires login to perform any activity
nazmul-me Oct 31, 2024
f1dc48f
logging logout button show on/off bug fixed
nazmul-me Oct 31, 2024
ce6ff5c
added Gemini API with bug fixes
KKGanguly Oct 31, 2024
2684f9b
Update License Statement
KKGanguly Oct 31, 2024
1deb47a
apply searching and filtering on search jobs page
nazmul-me Oct 31, 2024
138dc51
clear the modal for deleting job application
nazmul-me Oct 31, 2024
550d9c0
updated with structure and design feedback
KKGanguly Oct 31, 2024
8118990
Merge branch 'feature_gemini_resumeanalyzer' of https://github.com/Te…
KKGanguly Oct 31, 2024
fe59d06
Merge branch 'feature_gemini_resumeanalyzer' into Main
KKGanguly Oct 31, 2024
f7bcd3a
resume analyzer page redesign, bug fix in this page
nazmul-me Oct 31, 2024
fc70df7
Implement real-time validation and flash messages in signup forms
rcb1409 Oct 31, 2024
668242d
Update login pages for consistency and functionality
rcb1409 Oct 31, 2024
3619ff7
update resume analyze to be consistent with other pages
rcb1409 Oct 31, 2024
d8f01de
Add input placeholders and validation feedback to job search form
rcb1409 Oct 31, 2024
1de24a9
analyze resume option fixed and create a new table for storing resumes
nazmul-me Oct 31, 2024
be33881
added skills extraction from the job profile
nazmul-me Oct 31, 2024
29b0755
Merge branch 'consistent_ui'
rcb1409 Oct 31, 2024
84e3370
delete duplicate home_page
rcb1409 Oct 31, 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
40 changes: 40 additions & 0 deletions Controller/gemini_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'''
MIT License

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''

from PyPDF2 import PdfFileReader
import numpy as np
import os
import google.generativeai as genai

API_KEY = "AIzaSyBvVbnHMiCIN143GgN6P1u4w7iBbGucb0E" #add gemini API key
def get_gemini_feedback(pdf_path):
if pdf_path:
genai.configure(api_key=API_KEY)
model = genai.GenerativeModel("gemini-1.5-flash")
sample_pdf = genai.upload_file(pdf_path)
prompt = "critique the following resume on the basis of its conciseness, use of action words and numbers. Give suggestions on the 1. structure and design section, then the 2. education section, then the 3. experiences section, then the 4. skills section and finally the 5. projects section. At first give a paragraph summarizing your suggestions. Then, give these suggestions on these five sections in the form of five paragraphs and label them Section 1, Section 2, Section 3, Section 4 and Section 5 respectively, each separated by a line. Make sure each paragraph is atleast 50-70 words long."
try:
response = model.generate_content(
[prompt, sample_pdf],
generation_config=genai.types.GenerationConfig(
# Only one candidate for now.
candidate_count=1,
max_output_tokens=40000,
temperature=0.8,
),
)
return response.text

except Exception as e:
print(f"An error occurred: {e}")

return None
170 changes: 170 additions & 0 deletions UnitTesting/selenium/login_test.py
Original file line number Diff line number Diff line change
@@ -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>
h1_elements = self.driver.find_elements(By.TAG_NAME, "h1")
h1_texts = [h1.text for h1 in h1_elements]
# Check if any <h1> 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))
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html>
<head>
<title>Login Test Report</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2 class="text-capitalize">Login Test Report</h2>
<p class='attribute'><strong>Start Time: </strong>2024-10-28 19:46:46</p>
<p class='attribute'><strong>Duration: </strong>55.76 s</p>
<p class='attribute'><strong>Summary: </strong>Total: 4, Pass: 4</p>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-10">
<table class='table table-hover table-responsive'>
<thead>
<tr>
<th>__main__.LoginTestCase</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<tr class='success'>
<td class="col-xs-10">test_login_with_blank_fields</td>
<td class="col-xs-1">
<span class="label label-success" style="display:block;width:40px;">Pass</span>
</td>
<td class="col-xs-1">
</td>
</tr>
<tr class='success'>
<td class="col-xs-10">test_login_with_invalid_credentials</td>
<td class="col-xs-1">
<span class="label label-success" style="display:block;width:40px;">Pass</span>
</td>
<td class="col-xs-1">
</td>
</tr>
<tr class='success'>
<td class="col-xs-10">test_login_with_valid_credentials_admin</td>
<td class="col-xs-1">
<span class="label label-success" style="display:block;width:40px;">Pass</span>
</td>
<td class="col-xs-1">
</td>
</tr>
<tr class='success'>
<td class="col-xs-10">test_login_with_valid_credentials_student</td>
<td class="col-xs-1">
<span class="label label-success" style="display:block;width:40px;">Pass</span>
</td>
<td class="col-xs-1">
</td>
</tr>
<tr>
<td colspan="3">
Total: 4, Pass: 4 -- Duration: 55.76 s
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('td').on('click', '.btn', function(e){
e.preventDefault();
e.stopImmediatePropagation();
var $this = $(this);
var $nextRow = $this.closest('tr').next('tr');
$nextRow.slideToggle("fast");
$this.text(function(i, text){
if (text === 'View') {
return 'Hide';
} else {
return 'View';
};
});
});
});
</script>
</body>
</html
Loading