-
Notifications
You must be signed in to change notification settings - Fork 1
feat: E2E Test, Google Login #65
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f3b3c98
feat: integration test - resume evaluate
Stanford997 17e1d2c
remove unnecessary file
Stanford997 18ad2e5
Update: app.py Add in login methods for backend
andyasdd1 a8605c8
Update app.py Changes: fixed login issue, partial implemented session…
andyasdd1 3858881
feat: new logic for compute correlated score
Stanford997 bb8db05
Merge remote-tracking branch 'origin/dev/backend' into dev/backend
Stanford997 1eb58fe
feat: e2e test
Stanford997 7858c7f
update requirements.txt
Stanford997 9c88ec6
update requirements.txt
Stanford997 cf698a3
test_e2e.py moved from tests to test_e2e
Stanford997 31bcc73
modify ci_be.yml to ignore test_e2e when testing with pytest
Stanford997 4157931
bug fixed
Stanford997 a736210
bug fixed
Stanford997 01abb37
feat: CI for E2E
Stanford997 8aff245
bug fixed
Stanford997 a668a73
[Fix]: null value in ChatBox.tsx and indents->2
Stanford997 2ef0eca
bug fixed
Stanford997 6b7cb36
feat: add unit test for parser
Stanford997 9909182
[Fix]: add path to test_resume.pdf
Stanford997 7816a66
Update app.py Security, delete google_client_id code
andyasdd1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ jobs: | |
|
||
- name: Test with pytest | ||
run: | | ||
pytest | ||
pytest --ignore=tests/test_e2e.py | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.common.keys import Keys | ||
from selenium.webdriver.support.ui import WebDriverWait | ||
from selenium.webdriver.chrome.options import Options | ||
from selenium.webdriver.support import expected_conditions as EC | ||
import time | ||
|
||
FRONTEND_URL = "http://localhost:3001" | ||
API_URL = "http://127.0.0.1:5001" | ||
|
||
options = Options() | ||
# options.add_argument("--headless") | ||
driver = webdriver.Chrome(options=options) | ||
driver.get(FRONTEND_URL) | ||
wait = WebDriverWait(driver, 10) | ||
|
||
try: | ||
WebDriverWait(driver, 10).until( | ||
EC.presence_of_element_located((By.CLASS_NAME, "nsm7Bb-HzV7m-LgbsSe-MJoBVe")) | ||
Stanford997 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
) | ||
|
||
# Google login | ||
google_login_button = driver.find_element(By.CLASS_NAME, "nsm7Bb-HzV7m-LgbsSe") | ||
Stanford997 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
# google_login_button.click() | ||
|
||
# Upload Resume | ||
upload_div = driver.find_element(By.CSS_SELECTOR, "div[style*='cursor: pointer'][style*='display: flex']") | ||
# upload_div.click() | ||
|
||
wait = WebDriverWait(driver, 10) | ||
file_input = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "input[type='file']"))) | ||
|
||
file_path = "/Users/caozhen/PycharmProjects/seprojects-cs673a2f24_team5/be_repo/tests/test_resume.pdf" | ||
file_input.send_keys(file_path) | ||
|
||
alert = WebDriverWait(driver, 10).until(EC.alert_is_present()) | ||
alert_text = alert.text | ||
assert "Resume uploaded successfully" in alert_text | ||
alert.accept() | ||
|
||
# Analyze resume | ||
analyze_button = driver.find_element(By.CLASS_NAME, "cursor-pointer") | ||
analyze_button.click() | ||
|
||
submit_button = driver.find_element(By.CLASS_NAME, "mt-6") | ||
submit_button.click() | ||
|
||
time.sleep(20) | ||
|
||
keywords = [ | ||
"Analysis Result", | ||
"Consistency and Chronology", | ||
"Education", | ||
"Project and Work Experience", | ||
"Resume Structure and Presentation", | ||
"Skills and Certifications", | ||
"Soft Skills" | ||
] | ||
|
||
elements = driver.find_elements(By.CLASS_NAME, "font-bold") | ||
content_text = " ".join([element.text for element in elements]) | ||
for keyword in keywords: | ||
count = content_text.count(keyword) | ||
assert count == 1, f"'{keyword}' does not appear exactly twice in the content (found {count} times)" | ||
|
||
# Analyze resume with JD | ||
analyze_button.click() | ||
textarea = WebDriverWait(driver, 10).until( | ||
EC.presence_of_element_located((By.CSS_SELECTOR, "textarea.w-full.h-40.p-4.border-2")) | ||
) | ||
textarea.send_keys("Sample job description text") | ||
submit_button = driver.find_element(By.CLASS_NAME, "mt-6") | ||
submit_button.click() | ||
|
||
time.sleep(20) | ||
|
||
elements = driver.find_elements(By.CLASS_NAME, "font-bold") | ||
content_text = " ".join([element.text for element in elements]) | ||
for keyword in keywords: | ||
count = content_text.count(keyword) | ||
assert count == 2, f"'{keyword}' does not appear exactly twice in the content (found {count} times)" | ||
|
||
finally: | ||
driver.quit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
Flask Integration Test. | ||
""" | ||
import pytest | ||
from flask import Flask | ||
from app import app | ||
from configs.database import get_resume_database | ||
|
||
|
||
@pytest.fixture | ||
def client(): | ||
# Create testing client | ||
app.config['TESTING'] = True | ||
app.config['DEBUG'] = False | ||
client = app.test_client() | ||
|
||
with app.app_context(): | ||
database = get_resume_database() | ||
resume_collection = database.get_collection("resumes") | ||
resume_collection.delete_many({"user_id": "test"}) | ||
yield client, resume_collection | ||
resume_collection.delete_many({"user_id": "test"}) | ||
|
||
|
||
def test_resume_evaluate(client): | ||
client, resume_collection = client | ||
|
||
resume_collection.insert_one({ | ||
'user_id': 'test', | ||
'resume_text': 'Sample resume content for evaluation.' | ||
}) | ||
|
||
response = client.post('/resume_evaluate', data={'user_id': 'test'}) | ||
assert response.status_code == 200 | ||
json_data = response.get_json() | ||
assert 'analysis' in json_data | ||
|
||
|
||
def test_resume_evaluate_with_JD(client): | ||
client, resume_collection = client | ||
|
||
resume_collection.insert_one({ | ||
'user_id': 'test', | ||
'resume_text': 'Sample resume content for JD evaluation.' | ||
}) | ||
|
||
response = client.post('/resume_evaluate_with_JD', data={ | ||
'user_id': 'test', | ||
'jd_text': 'Sample job description text for matching.' | ||
}) | ||
assert response.status_code == 200 | ||
json_data = response.get_json() | ||
assert 'analysis' in json_data |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.