diff --git a/db/comments.db b/db/comments.db
index fd2b7e0535582f9d89f5562a9a6eaad51937fdaf..57c3079d06db612f91ff8fc8be6b182faf1158a4 100644
Binary files a/db/comments.db and b/db/comments.db differ
diff --git a/db/posts.db b/db/posts.db
index 77f20641035749524fb4bea5714e166a2f123f3b..8f38db49a157b82d247ee5e6b8a79a41ee3278fe 100644
Binary files a/db/posts.db and b/db/posts.db differ
diff --git a/db/users.db b/db/users.db
index a96591cae4b89e679f0549cc4f28fc232a9ca3d5..d1f8401ffd66d8113ce9f2af93dcdcb138760a83 100644
Binary files a/db/users.db and b/db/users.db differ
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/functions/change_username.py b/tests/functions/change_username.py
new file mode 100644
index 0000000000000000000000000000000000000000..bcdf2dc42e0c1908d76fde872d255073d9a263e4
--- /dev/null
+++ b/tests/functions/change_username.py
@@ -0,0 +1,14 @@
+from playwright.sync_api import Page
+from tests.utils.constant import URL
+from tests.utils.user import UserTest
+
+def change_username(page: Page, new_username: str) -> Page:
+
+  page.goto(URL+ "/changeusername")
+
+  page.get_by_placeholder("new username").click()
+  page.get_by_placeholder("new username").fill(new_username)
+  
+  page.get_by_role("button", name="change my username").click()
+
+  return page
\ No newline at end of file
diff --git a/tests/functions/login.py b/tests/functions/login.py
new file mode 100644
index 0000000000000000000000000000000000000000..7fba9518a88978612881a183f39e7dcd814f28ed
--- /dev/null
+++ b/tests/functions/login.py
@@ -0,0 +1,18 @@
+from playwright.sync_api import Page
+from tests.utils.constant import URL
+from tests.utils.user import UserTest
+
+def login(page: Page, user: UserTest) -> Page:
+  
+  page.goto(URL)
+  page.get_by_role("button", name="î®§").click()
+
+  page.get_by_placeholder("username").click()
+  page.get_by_placeholder("username").fill(user.username)
+
+  page.get_by_placeholder("password").click()
+  page.get_by_placeholder("password").fill(user.password)
+
+  page.get_by_role("button", name="Login").click()
+
+  return page
\ No newline at end of file
diff --git a/tests/functions/register.py b/tests/functions/register.py
new file mode 100644
index 0000000000000000000000000000000000000000..8095c8d6223a5c9b383450b5a0ff103d47c2131a
--- /dev/null
+++ b/tests/functions/register.py
@@ -0,0 +1,25 @@
+from playwright.sync_api import Page
+from tests.utils.constant import URL
+from tests.utils.user import UserTest
+
+def register(page: Page, user: UserTest) -> Page:
+  
+  page.goto(URL)
+  page.get_by_role("button", name="î­‹").click()
+
+  page.get_by_placeholder("username").click()
+  page.get_by_placeholder("username").fill(user.username)
+
+  page.get_by_placeholder("email").click()
+  page.get_by_placeholder("email").fill(user.email)
+
+  page.get_by_placeholder("password", exact=True).click()
+  page.get_by_placeholder("password", exact=True).fill(user.password)
+
+  page.get_by_placeholder("confirm your password").click()
+  page.get_by_placeholder("confirm your password").fill(user.password)
+
+  page.get_by_role("button", name="Signup").click()
+  page.get_by_role("link").first.click()
+
+  return page
\ No newline at end of file
diff --git a/tests/sandbox.py b/tests/sandbox.py
index d53ba6d39074669253e3100170b700a9306a539e..7adb6c384876efc70e663e101be4f01750eaa338 100644
--- a/tests/sandbox.py
+++ b/tests/sandbox.py
@@ -1,7 +1,7 @@
 from playwright.sync_api import Playwright, sync_playwright, expect
-from tConstant import URL, DB_COMMENTS_ROOT, USE_HEADLESS
-from tUtils import login_test_user
-
+from utils.user import UserTest
+from utils.constant import URL
+from functions.login import login
 post_id = 1
 
 def run(playwright: Playwright):
@@ -10,11 +10,11 @@ def run(playwright: Playwright):
     page = context.new_page()
     page.goto(URL)
 
-    page = login_test_user(page)
+    page = login(page, UserTest("User_A"))
 
-    page.wait_for_url(URL + '/')
-    page.goto(URL + '/post/' + str(post_id))
-    page.locator("[name=commentDeleteButton]").click()
+    # page.wait_for_url(URL + '/')
+    # page.goto(URL + '/post/' + str(post_id))
+    # page.locator("[name=commentDeleteButton]").click()
 
     context.close()
     browser.close()
diff --git a/tests/tConstant.py b/tests/tConstant.py
deleted file mode 100644
index aa3ed73f4b0887fedef07c0ed47342fb7dcac8f1..0000000000000000000000000000000000000000
--- a/tests/tConstant.py
+++ /dev/null
@@ -1,166 +0,0 @@
-# Assign the URL of the local server to a variable named URL
-URL = "http://192.168.237.2:5000"
-USE_HEADLESS = True
-
-# Import necessary modules from the modules module
-import secrets, socket
-
-
-# Name of the Flask application
-APP_NAME = "flaskBlog"  # (str)
-
-# Version of the Flask application
-APP_VERSION = "2.0.0"  # (str)
-
-# Path to the root of the application files
-APP_ROOT_PATH = "."  # (str)
-
-# Hostname or IP address for the Flask application
-APP_HOST = socket.gethostbyname(socket.gethostname())  # (str)
-
-# Port number for the Flask application
-APP_PORT = 5000  # (int)
-
-# Toggle debug mode for the Flask application
-DEBUG_MODE = True  # (bool)
-
-# Name of the UI framework being used
-UI_NAME = "tailwindUI"  # (str)
-
-# Path to the templates folder
-TEMPLATE_FOLDER = f"templates/{UI_NAME}"  # (str)
-
-# Path to the static folder
-STATIC_FOLDER = f"static/{UI_NAME}"  # (str)
-
-# Toggle user login feature
-LOG_IN = True  # (bool)
-
-# Toggle user registration feature
-REGISTRATION = True  # (bool)
-
-
-### LOGGER SETTINGS ###
-# Toggle custom logging feature
-CUSTOM_LOGGER = True  # (bool)
-
-# Toggle werkzeug logging feature
-WERKZEUG_LOGGER = False  # (bool)
-
-# Root path of the log folder
-LOG_FOLDER_ROOT = "log/"  # (str)
-
-# Root path of the log file
-LOG_FILE_ROOT = LOG_FOLDER_ROOT + "log.log"  # (str)
-
-# Root path of the danger log file
-LOG_DANGER_FILE_ROOT = LOG_FOLDER_ROOT + "logDanger.log"  # (str)
-
-# Root path of the success log file
-LOG_SUCCESS_FILE_ROOT = LOG_FOLDER_ROOT + "logSuccess.log"  # (str)
-
-# Root path of the warning log file
-LOG_WARNING_FILE_ROOT = LOG_FOLDER_ROOT + "logWarning.log"  # (str)
-
-# Root path of the info log file
-LOG_INFO_FILE_ROOT = LOG_FOLDER_ROOT + "logInfo.log"  # (str)
-
-# Root path of the app log file
-LOG_APP_FILE_ROOT = LOG_FOLDER_ROOT + "logApp.log"  # (str)
-
-# Root path of the sql log file
-LOG_SQL_FILE_ROOT = LOG_FOLDER_ROOT + "logSQL.log"  # (str)
-
-
-# Secret key for Flask sessions
-APP_SECRET_KEY = secrets.token_urlsafe(32)  # (str)
-
-# Toggle permanent sessions for the Flask application
-SESSION_PERMANENT = True  # (bool)
-
-# Separator text used in log files
-BREAKER_TEXT = "\n"  # (str)
-
-
-### DATABASE SETTINGS ###
-
-# Root path of the database folder
-DB_FOLDER_ROOT = "db/"  # (str)
-
-# Root path of the users database
-DB_USERS_ROOT = DB_FOLDER_ROOT + "users.db"  # (str)
-
-# Root path of the posts database
-DB_POSTS_ROOT = DB_FOLDER_ROOT + "posts.db"  # (str)
-
-# Root path of the comments database
-DB_COMMENTS_ROOT = DB_FOLDER_ROOT + "comments.db"  # (str)
-
-
-### SMTP MAIL SETTINGS ###
-
-# SMTP server address
-SMTP_SERVER = "smtp.gmail.com"  # (str)
-
-# SMTP server port
-SMTP_PORT = 587  # (int)
-
-# SMTP mail address
-SMTP_MAIL = "flaskblogdogukanurker@gmail.com"  # (str)
-
-# SMTP mail password
-SMTP_PASSWORD = "lsooxsmnsfnhnixy"  # (str)
-
-
-### DEFAULT ADMIN ACCOUNT SETTINGS ###
-
-# Toggle creation of default admin account
-DEFAULT_ADMIN = True  # (bool)
-
-# Default admin username
-DEFAULT_ADMIN_USERNAME = "admin"  # (str)
-
-# Default admin email address
-DEFAULT_ADMIN_EMAIL = "admin@flaskblog.com"  # (str)
-
-# Default admin password
-DEFAULT_ADMIN_PASSWORD = "admin"  # (str)
-
-# Default starting point score for admin
-DEFAULT_ADMIN_POINT = 0  # (int)
-
-# Default admin profile picture URL
-DEFAULT_ADMIN_PROFILE_PICTURE = f"https://api.dicebear.com/7.x/identicon/svg?seed={DEFAULT_ADMIN_USERNAME}&radius=10"  # (str)
-
-
-### RECAPTCHA SETTINGS ###
-
-# Toggle reCAPTCHA verification
-RECAPTCHA = False  # (bool)
-
-# Toggle display of reCAPTCHA badge
-RECAPTCHA_BADGE = False  # (bool)
-
-# reCAPTCHA site key
-RECAPTCHA_SITE_KEY = ""  # (str)
-
-# reCAPTCHA secret key
-RECAPTCHA_SECRET_KEY = ""  # (str)
-
-# reCAPTCHA verify URL
-RECAPTCHA_VERIFY_URL = "https://www.google.com/recaptcha/api/siteverify"  # (str)
-
-# Toggle reCAPTCHA verification for different actions
-RECAPTCHA_LOGIN = True  # (bool)
-RECAPTCHA_SIGN_UP = True  # (bool)
-RECAPTCHA_POST_CREATE = True  # (bool)
-RECAPTCHA_POST_EDIT = True  # (bool)
-RECAPTCHA_POST_DELETE = True  # (bool)
-RECAPTCHA_COMMENT = True  # (bool)
-RECAPTCHA_COMMENT_DELETE = True  # (bool)
-RECAPTCHA_PASSWORD_RESET = True  # (bool)
-RECAPTCHA_PASSWORD_CHANGE = True  # (bool)
-RECAPTCHA_USERNAME_CHANGE = True  # (bool)
-RECAPTCHA_VERIFY_USER = True  # (bool)
-RECAPTCHA_DELETE_USER = True  # (bool)
-RECAPTCHA_PROFILE_PICTURE_CHANGE = True  # (bool)
diff --git a/tests/tUtils.py b/tests/tUtils.py
index a19ba6f0fe2fbe834249b040cf7d9e450d090475..121d473444f6332afaf7fd73ec4b9bd248efb719 100644
--- a/tests/tUtils.py
+++ b/tests/tUtils.py
@@ -1,6 +1,5 @@
 from playwright.sync_api import Page
 import sqlite3
-from tConstant import DB_USERS_ROOT
 password = "supersecret"
 confPassword = "supersecret"
 
@@ -50,19 +49,4 @@ def register(page: Page, username: str) :
   page.get_by_role("button", name="Signup").click()
   page.get_by_role("link").first.click()
 
-  return page
-
-
-def is_user_exist(username):
-    connection = sqlite3.connect(DB_USERS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT userID FROM users where username = ?
-      '''
-    exist = False
-
-    for row in cursor.execute(query,[(username)]):
-      exist = True
-
-    connection.close()
-    return exist
\ No newline at end of file
+  return page
\ No newline at end of file
diff --git a/tests/test_change_username.py b/tests/test_change_username.py
index fdf61959b4286e6f37035b34e8ef3107f9525666..0daf8425486a1bae4d82a405ac0b17205c0ae68e 100644
--- a/tests/test_change_username.py
+++ b/tests/test_change_username.py
@@ -1,66 +1,36 @@
 # Import the playwright module and the constants file
-from playwright.sync_api import Playwright, sync_playwright, expect
-from tConstant import URL, DB_USERS_ROOT, USE_HEADLESS
+from playwright.sync_api import Playwright, expect
 import pytest, sqlite3
-from tUtils import login, is_user_exist
-
-username = "username_before"
-username = username.lower()
-email = username + '@flaskblog.com'
-
-username2 = "username_after"
+from tests.utils.constant import USE_HEADLESS, URL, DB_USERS_ROOT
+from tests.utils.user import UserTest
+from tests.utils.is_user_exist import is_user_exist
+from tests.functions.change_username import change_username
+from tests.functions.login import login
 
 @pytest.fixture(autouse=True)
-def setup_data ():
-    print("\nInserting user: " + username)
-    connection = sqlite3.connect(DB_USERS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute(
-        f"""
-        insert into users(userName,email,password,profilePicture,role,points,timeStamp,isVerified) \
-        values(?, ?, ?, ?, ?, ?, ?, ?)
-        """,
-        (
-            username,
-            email,
-            "$6$rounds=656000$zLLPgD9uQRmx/NvZ$IyeIjtXGOUVamH2psNM4pgZdEI3epVC84PoI5KnDf10Pt2yurG8LRIKEhYxmZxXL52c3.cBZrxcKUdlM/X5Xy.",
-            f"https://api.dicebear.com/7.x/identicon/svg?seed={username}&radius=10",
-            "user",
-            0,
-            '1714206962',
-            "True",
-        ),
-    )
-    connection.commit()
-    yield
-    print('\nDeleting ' + email)
-    connection = sqlite3.connect(DB_USERS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM users where email = ?', [(email)])
-    connection.commit()
+def user ():
+  user = UserTest("User_A")
+    
+  yield user
+  print('\nReverting username change' )
+  connection = sqlite3.connect(DB_USERS_ROOT)
+  cursor = connection.cursor()
+  cursor.execute('UPDATE users SET username = ? where email = ?', [(user.username),(user.email)])
+  connection.commit()
 
 # Define a function that takes a playwright object as an argument
-def test_change_username(playwright: Playwright) -> None:
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
+def test_change_username(playwright: Playwright, user: UserTest) -> None:
+    browser = playwright.chromium.launch(headless=True)
     context = browser.new_context()
     page = context.new_page()
-    page.goto(URL)
 
-    
-    page = login(page, username)
-
-    page.goto(URL+ "/changeusername")
+    page = login(page, user)
 
-    
-    # Click on the input field with the placeholder "new username"
-    page.get_by_placeholder("new username").click()
-    # Fill the input field with the value "TestUserName"
-    page.get_by_placeholder("new username").fill(username2)
-    # Click on the button with the name "change my username"
-    page.get_by_role("button", name="change my username").click()
+    new_username = "NewUsername"
+    page = change_username(page, new_username)
 
-    assert is_user_exist(username) == False
-    assert is_user_exist(username2) == True
+    assert is_user_exist(user.username) == False
+    assert is_user_exist(new_username) == True
 
     # Close the browser context and the browser
     context.close()
diff --git a/tests/test_create_comment.py b/tests/test_create_comment.py
deleted file mode 100644
index 229db4fd9c5eadb67fc591d94f11cc8fe4c76cd5..0000000000000000000000000000000000000000
--- a/tests/test_create_comment.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Import the playwright module and the constants file
-from playwright.sync_api import Playwright, sync_playwright, expect
-import pytest, sqlite3
-from tConstant import URL, DB_COMMENTS_ROOT, USE_HEADLESS
-from tUtils import login_test_user
-
-comment = "Wah keren sekali saya suka"
-
-@pytest.fixture(autouse=True)
-def setup_data ():
-    yield
-    print('\nDeleting created comment')
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    comment_id = get_newest_comment()
-    cursor.execute('DELETE FROM comments where id = ?', [(comment_id)])
-    connection.commit()
-
-# Define a function that takes a playwright object as an argument
-def test_create_comment(playwright: Playwright) -> None:
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
-    context = browser.new_context()
-    page = context.new_page()
-    page.goto(URL)
-
-    page = login_test_user(page)    
-
-    # Navigate to the first post in the database
-    page.goto(f"{URL}/post/1")
-    # Click on the input field with the placeholder "What are your thoughts?"
-    page.get_by_placeholder("What are your thoughts?").click()
-    # Fill the input field with the value 
-    page.get_by_placeholder("What are your thoughts?").fill(comment)
-    # Click on the button with the name ""
-    page.get_by_role("button", name="").click()
-
-    expect(page.get_by_text(comment)).to_be_visible()
-    # Close the browser context and the browser
-    context.close()
-    browser.close()
-
-def get_newest_comment():
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT id FROM comments where id = (
-        SELECT max(id) FROM comments 
-        )
-      '''
-    comment_id = -1
-
-    for row in cursor.execute(query):
-      comment_id = row[0]
-
-    connection.close()
-    return comment_id
\ No newline at end of file
diff --git a/tests/test_create_post.py b/tests/test_create_post.py
deleted file mode 100644
index b48e7afc5b0cc99c1d9d0739ebb2e1154729358e..0000000000000000000000000000000000000000
--- a/tests/test_create_post.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# Import the playwright module and the constants file
-from playwright.sync_api import Playwright, sync_playwright, expect
-import pytest, sqlite3
-from tConstant import URL, DB_POSTS_ROOT, USE_HEADLESS
-from tUtils import login_test_user
-
-# Import the abspath function from the os.path module
-from os.path import abspath
-
-# Define the file name and location of the post banner image
-fileName = "tests/postBanner.jpg"
-fileLocation = abspath(fileName).replace("\\", "\\")
-# The replace method is used to escape the backslashes in the file path
-
-post_title = "Test Title"
-username = "testuser"
-password = "testuser"
-
-@pytest.fixture(autouse=True)
-def setup_data ():
-    yield
-    print('\nDeleting newest post')
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    post_id = get_newest_post()
-    cursor.execute('DELETE FROM posts where id = ?', [(post_id)])
-    connection.commit()
-
-# Define a function that takes a playwright object as an argument
-def test_create_post(playwright: Playwright) -> None:
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
-    context = browser.new_context()
-    page = context.new_page()
-    page.goto(URL)
-
-    page = login_test_user(page)
-
-    # Click on the button with the name "" (New Post)
-    page.get_by_role("button", name="").click()
-    # Click on the input field with the placeholder "post title"
-    page.get_by_placeholder("post title").click()
-    # Fill the input field with the value "Lorem Ipsum"
-    page.get_by_placeholder("post title").fill(post_title)
-    # Click on the input field with the placeholder "tags"
-    page.get_by_placeholder("tags").click()
-    # Fill the input field with the values "lorem, ipsum"
-    page.get_by_placeholder("tags").fill("lorem, ipsum")
-    # Select the option "Other" from the dropdown menu with the id "postCategory"
-    page.locator("#postCategory").select_option("Other")
-    # Click on the input field with the placeholder "post banner"
-    page.get_by_placeholder("post banner").click()
-    # Upload the file "postbanner.jpg" to the input field
-    page.get_by_placeholder("post banner").set_input_files(fileLocation)
-    # Click on the fourth textbox on the page
-    page.get_by_role("textbox").nth(4).click()
-    # Fill the textbox with the text "Lorem ipsum dolor sit amet, consectetur adipiscing elit, ..."
-    page.get_by_role("textbox").nth(4).fill(
-        """
-Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. In pellentesque massa placerat duis ultricies. Molestie nunc non blandit massa. Morbi tincidunt augue interdum velit euismod in pellentesque. Posuere lorem ipsum dolor sit amet consectetur. Eu mi bibendum neque egestas congue quisque. In metus vulputate eu scelerisque felis imperdiet. Ac auctor augue mauris augue neque gravida in fermentum et. Parturient montes nascetur ridiculus mus mauris vitae. Donec ac odio tempor orci dapibus ultrices. Adipiscing vitae proin sagittis nisl. Libero id faucibus nisl tincidunt eget nullam non nisi est. Ullamcorper a lacus vestibulum sed arcu non. Vulputate enim nulla aliquet porttitor lacus luctus accumsan tortor posuere. Mi eget mauris pharetra et ultrices neque ornare aenean euismod. Duis ut diam quam nulla porttitor massa id. Integer enim neque volutpat ac tincidunt. Justo laoreet sit amet cursus sit amet dictum sit.
-    
-Rhoncus est pellentesque elit ullamcorper dignissim cras. Elit ullamcorper dignissim cras tincidunt lobortis feugiat. Neque sodales ut etiam sit amet nisl. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Gravida cum sociis natoque penatibus et. Tellus elementum sagittis vitae et leo. Morbi tincidunt augue interdum velit euismod in pellentesque massa. Condimentum lacinia quis vel eros donec ac odio tempor. Auctor augue mauris augue neque gravida in fermentum. Viverra mauris in aliquam sem fringilla. Sed ullamcorper morbi tincidunt ornare massa. Amet mauris commodo quis imperdiet massa tincidunt. Amet massa vitae tortor condimentum lacinia quis vel eros donec.
-    
-Elementum nisi quis eleifend quam adipiscing vitae proin. Posuere morbi leo urna molestie at elementum eu facilisis sed. Hendrerit dolor magna eget est lorem ipsum dolor sit amet. Eu consequat ac felis donec et. Feugiat vivamus at augue eget arcu dictum varius. Nulla aliquet porttitor lacus luctus accumsan. Porta nibh venenatis cras sed. Nam at lectus urna duis convallis convallis tellus. Sed adipiscing diam donec adipiscing tristique risus nec feugiat in. Ut etiam sit amet nisl. Congue quisque egestas diam in arcu cursus euismod quis viverra.
-    
-Sit amet massa vitae tortor condimentum. Dignissim diam quis enim lobortis scelerisque fermentum dui faucibus. Augue neque gravida in fermentum et sollicitudin ac orci phasellus. Quam viverra orci sagittis eu volutpat odio facilisis mauris. Platea dictumst vestibulum rhoncus est pellentesque. Vitae semper quis lectus nulla at volutpat. Pretium viverra suspendisse potenti nullam ac tortor vitae. Faucibus interdum posuere lorem ipsum dolor sit amet. Mi quis hendrerit dolor magna eget est. Vitae et leo duis ut diam quam. Lectus magna fringilla urna porttitor rhoncus dolor purus. Massa enim nec dui nunc mattis enim. Sed elementum tempus egestas sed sed. Adipiscing elit ut aliquam purus sit amet luctus venenatis. Mauris in aliquam sem fringilla ut morbi. Nulla posuere sollicitudin aliquam ultrices sagittis orci a scelerisque purus. Dapibus ultrices in iaculis nunc sed. Nisl pretium fusce id velit. Elementum eu facilisis sed odio morbi quis commodo. Porttitor massa id neque aliquam vestibulum.
-    
-Aliquam vestibulum morbi blandit cursus risus at ultrices. Amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor. Sagittis nisl rhoncus mattis rhoncus urna neque viverra justo nec. Felis donec et odio pellentesque diam volutpat. Mauris a diam maecenas sed enim ut. Mauris pellentesque pulvinar pellentesque habitant. Purus semper eget duis at. Semper auctor neque vitae tempus. Ullamcorper sit amet risus nullam eget. Ut morbi tincidunt augue interdum velit euismod in.
-        """
-    )
-    # Click on the button with the name "Post"
-    page.get_by_role("button", name="Post").click()
-
-    expect(page).to_have_url(URL + '/')
-
-    post_id = get_newest_post()
-    response = page.request.get(URL + '/posts/' + str(post_id))
-    expect(response).to_be_ok
-
-    # Close the browser context and the browser
-    context.close()
-    browser.close()
-
-def get_newest_post():
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT id FROM posts where id = (
-        SELECT max(id) FROM posts 
-        )
-      '''
-    post_id = -1
-
-    for row in cursor.execute(query):
-      post_id = row[0]
-
-    connection.close()
-    return post_id
\ No newline at end of file
diff --git a/tests/test_delete_account.py b/tests/test_delete_account.py
deleted file mode 100644
index 26ceaa11f1ba0402ca284b3097bce2ce89553967..0000000000000000000000000000000000000000
--- a/tests/test_delete_account.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from playwright.sync_api import Playwright, sync_playwright, expect
-from tConstant import URL, DB_USERS_ROOT, USE_HEADLESS
-from tUtils import login, is_user_exist
-import pytest, sqlite3
-
-username = "TestUserDeleteAccount"
-username = username.lower()
-email = username + '@flaskblog.com'
-
-@pytest.fixture(autouse=True)
-def setup_data ():
-    print("\nInserting user: " + username)
-    connection = sqlite3.connect(DB_USERS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute(
-        f"""
-        insert into users(userName,email,password,profilePicture,role,points,timeStamp,isVerified) \
-        values(?, ?, ?, ?, ?, ?, ?, ?)
-        """,
-        (
-            username,
-            email,
-            "$6$rounds=656000$zLLPgD9uQRmx/NvZ$IyeIjtXGOUVamH2psNM4pgZdEI3epVC84PoI5KnDf10Pt2yurG8LRIKEhYxmZxXL52c3.cBZrxcKUdlM/X5Xy.",
-            f"https://api.dicebear.com/7.x/identicon/svg?seed={username}&radius=10",
-            "user",
-            0,
-            '1714206962',
-            "True",
-        ),
-    )
-    connection.commit()
-    yield
-    print('\nDeleting ' + email)
-    connection = sqlite3.connect(DB_USERS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM users where email = ?', [(email)])
-    connection.commit()
-
-
-def test_delete_account(playwright: Playwright) -> None:
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
-    context = browser.new_context()
-    page = context.new_page()
-    page.goto(URL)
-    
-    page = login(page, username)
-
-    page.goto(URL + '/accountsettings')
-    page.get_by_role("button", name=" delete account").click()
-
-    assert is_user_exist(username) == False
-        
-    context.close()
-    browser.close()
-
-
diff --git a/tests/test_delete_comment.py b/tests/test_delete_comment.py
deleted file mode 100644
index 2e3074c1cd022c0f4c45a77f60b23fd5c0808cac..0000000000000000000000000000000000000000
--- a/tests/test_delete_comment.py
+++ /dev/null
@@ -1,113 +0,0 @@
-from playwright.sync_api import Playwright, sync_playwright, expect
-from tConstant import URL, DB_COMMENTS_ROOT, USE_HEADLESS
-from tUtils import login_test_user
-import pytest, sqlite3
-
-username = "TestUser"
-otherUsername = "TestOtherUser"
-post_id = 1
-comment_content = "HelloComment"
-
-@pytest.fixture(autouse=True)
-def owned_comment():
-    print("\nInserting mock comment")
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute(
-        "insert into comments(post,comment,user,timeStamp) \
-        values(?, ?, ?, ?)",
-        (
-            post_id,
-            comment_content,
-            username,
-            1707854995,
-        ),
-    )
-    id = cursor.lastrowid
-    
-    connection.commit()
-
-    yield id
-    print('\nDeleting comment')
-
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM comments where id = ?', [(id)])
-    connection.commit()
-
-@pytest.fixture(autouse=True)
-def others_comment():
-    print("\nInserting mock comment")
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute(
-        "insert into comments(post,comment,user,timeStamp) \
-        values(?, ?, ?, ?)",
-        (
-            post_id,
-            comment_content,
-            otherUsername,
-            1707854995,
-        ),
-    )
-    id = cursor.lastrowid
-    
-    connection.commit()
-    yield id
-    print('\nDeleting comment')
-
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM comments where id = ?', [(id)])
-    connection.commit()
-
-def test_delete_comment(playwright: Playwright, owned_comment, others_comment) -> None:
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
-    context = browser.new_context()
-    page = context.new_page()
-    page.goto(URL)
-    
-    page = login_test_user(page)
-
-
-    page.wait_for_url(URL + '/')
-    page.goto(URL + '/post/' + str(post_id))
-    while page.locator("[name=commentDeleteButton]").count() > 0:
-        page.locator("[name=commentDeleteButton]").first.click()
-       
-    assert is_comment_exist(owned_comment) == False
-    assert is_comment_exist(others_comment) == True
-
-    context.close()
-    browser.close()
-
-
-def get_newest_comment():
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT id FROM comments where id = (
-        SELECT max(id) FROM comments 
-        )
-      '''
-    comment_id = -1
-
-    for row in cursor.execute(query):
-      comment_id = row[0]
-
-    connection.close()
-    return comment_id
-
-def is_comment_exist(id):
-    connection = sqlite3.connect(DB_COMMENTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT * FROM comments where id = ?
-      '''
-    exist = False
-
-    for row in cursor.execute(query,[(id)]):
-      exist = True
-
-    connection.close()
-    return exist
\ No newline at end of file
diff --git a/tests/test_delete_post.py b/tests/test_delete_post.py
deleted file mode 100644
index 2372fee77ebc4e004a36667c9ad4af59184ae52a..0000000000000000000000000000000000000000
--- a/tests/test_delete_post.py
+++ /dev/null
@@ -1,110 +0,0 @@
-from playwright.sync_api import Playwright, sync_playwright, expect
-from tConstant import URL, DB_POSTS_ROOT, USE_HEADLESS
-from tUtils import login_test_user
-import pytest, sqlite3
-from os.path import abspath
-
-username = "TestUser"
-new_title = "New Title"
-fileName = "tests/postBanner.jpg"
-fileLocation = abspath(fileName).replace("\\", "\\")
-
-@pytest.fixture(autouse=True)
-def owned_post ():
-    print("\nInserting Owned Post")
-    with open('./tests/query/insert_mock_post_owned.sql', 'r') as sql_file:
-      sql_script = sql_file.read()
-
-    db = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = db.cursor()
-    cursor.executescript(sql_script)
-    id = get_newest_post()
-    db.commit()
-    db.close()
-
-    yield id 
-
-    print('\nDeleting Post')
-
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM posts where id = ?', [(id)])
-    connection.commit()
-
-@pytest.fixture(autouse=True)
-def not_owned_post ():
-    print("\nInserting Not Owned Post")
-    with open('./tests/query/insert_mock_post_not_owned.sql', 'r') as sql_file:
-      sql_script = sql_file.read()
-
-    db = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = db.cursor()
-    cursor.executescript(sql_script)
-    id = get_newest_post()
-    db.commit()
-    db.close()
-
-    yield id 
-
-    print('\nDeleting Post')
-
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM posts where id = ?', [(id)])
-    connection.commit()
-
-def test_delete_post(playwright: Playwright, owned_post, not_owned_post) -> None:
-    print(owned_post)
-    print(not_owned_post)
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
-    context = browser.new_context()
-    page = context.new_page()
-    page.goto(URL)
-    
-    page = login_test_user(page)
-    page.wait_for_url(URL + '/')
-
-    page.goto(URL + '/post/' + str(owned_post))
-
-    page.locator("[name=postDeleteButton]").click()
-
-    expect(page).to_have_url(URL+'/')
-    assert is_post_exist(owned_post) == False
-
-    page.goto(URL + '/post/' + str(not_owned_post))
-    expect(page.locator("[name=postDeleteButton]")).not_to_be_visible()
-
-
-    context.close()
-    browser.close()
-
-def get_newest_post() -> int:
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT id FROM posts where id = (
-        SELECT max(id) FROM posts 
-        )
-      '''
-    comment_id = -1
-
-    for row in cursor.execute(query):
-      comment_id = row[0]
-
-    connection.close()
-    return comment_id
-
-
-def is_post_exist(id):
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT * FROM posts where id = ?
-      '''
-    exist = False
-
-    for row in cursor.execute(query,[(id)]):
-      exist = True
-
-    connection.close()
-    return exist
\ No newline at end of file
diff --git a/tests/test_edit_post.py b/tests/test_edit_post.py
deleted file mode 100644
index 2d499a2563723a92300ee9909243da00aa0f965a..0000000000000000000000000000000000000000
--- a/tests/test_edit_post.py
+++ /dev/null
@@ -1,98 +0,0 @@
-from playwright.sync_api import Playwright, sync_playwright, expect
-from tConstant import URL, DB_POSTS_ROOT, USE_HEADLESS
-from tUtils import login_test_user
-import pytest, sqlite3
-from os.path import abspath
-
-username = "TestUser"
-new_title = "New Title"
-fileName = "tests/postBanner.jpg"
-fileLocation = abspath(fileName).replace("\\", "\\")
-
-
-@pytest.fixture(autouse=True)
-def owned_post ():
-    print("\nInserting Owned Post")
-    with open('./tests/query/insert_mock_post_owned.sql', 'r') as sql_file:
-      sql_script = sql_file.read()
-
-    db = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = db.cursor()
-    cursor.executescript(sql_script)
-    id = get_newest_post()
-    db.commit()
-    db.close()
-
-    yield id 
-
-    print('\nDeleting Post')
-
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM posts where id = ?', [(id)])
-    connection.commit()
-
-@pytest.fixture(autouse=True)
-def not_owned_post ():
-    print("\nInserting Not Owned Post")
-    with open('./tests/query/insert_mock_post_not_owned.sql', 'r') as sql_file:
-      sql_script = sql_file.read()
-
-    db = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = db.cursor()
-    cursor.executescript(sql_script)
-    id = get_newest_post()
-    db.commit()
-    db.close()
-
-    yield id 
-
-    print('\nDeleting Post')
-
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    cursor.execute('DELETE FROM posts where id = ?', [(id)])
-    connection.commit()
-
-def test_edit_post(playwright: Playwright, owned_post, not_owned_post) -> None:
-    browser = playwright.chromium.launch(headless=USE_HEADLESS)
-    context = browser.new_context()
-    page = context.new_page()
-    page.goto(URL)
-    
-    page = login_test_user(page)
-    page.wait_for_url(URL + '/')
-
-    page.goto(URL + '/editpost/' + str(owned_post))
-
-    page.get_by_placeholder("post title").click()
-    page.get_by_placeholder("post title").fill(new_title)
-    page.get_by_placeholder("post banner").click()
-    page.get_by_placeholder("post banner").set_input_files(fileLocation)
-    page.get_by_role("button", name="Save").click()
-
-    expect(page).to_have_url(URL + '/post/' + str(owned_post))
-    expect(page).to_have_title(new_title)
-
-    page.goto(URL + '/editpost/' + str(not_owned_post))
-    expect(page).not_to_have_url(URL + '/editpost/' + str(not_owned_post))
-
-    context.close()
-    browser.close()
-
-def get_newest_post():
-    connection = sqlite3.connect(DB_POSTS_ROOT)
-    cursor = connection.cursor()
-    query = '''
-      SELECT id FROM posts where id = (
-        SELECT max(id) FROM posts 
-        )
-      '''
-    comment_id = -1
-
-    for row in cursor.execute(query):
-      comment_id = row[0]
-
-    connection.close()
-    return comment_id
-
diff --git a/tests/test_login.py b/tests/test_login.py
index 2583f3f31a0f1794aed82e5fae9aecd385eb5d47..918abfb28c7f9c313dec50380b3be005dd8e26d5 100644
--- a/tests/test_login.py
+++ b/tests/test_login.py
@@ -1,22 +1,25 @@
 # Import the playwright module and the constants file
 from playwright.sync_api import Playwright, expect
-from tConstant import URL, USE_HEADLESS
-from tUtils import login_test_user
+import pytest, sqlite3
+from tests.utils.constant import USE_HEADLESS, URL, DB_USERS_ROOT
+from tests.utils.user import UserTest
+from tests.functions.login import login
 
-username = "testuser"
-password = "testuser"
+@pytest.fixture()
+def user():
+    user = UserTest("User_A")
+    yield user
 
 # Define a function that takes a playwright object as an argument
-def test_login(playwright: Playwright) -> None:
+def test_login(playwright: Playwright, user) -> None:
     # Launch a chromium browser in non-headless mode
     browser = playwright.chromium.launch(headless=USE_HEADLESS)
     context = browser.new_context()
     page = context.new_page()
-    page.goto(URL)
 
-    page = login_test_user(page)
+    page = login(page, user)
 
     expect(page).to_have_url(URL + '/')
-    expect(page.locator('[href*="/user/' + username + '"]')).to_be_visible()
+    expect(page.locator('[href*="/user/' + user.username + '"]')).to_be_visible()
     browser.close()
 
diff --git a/tests/test_register.py b/tests/test_register.py
index a217ad634c08875d0e7069a0bc2a0996f492c22e..b09933e3a777db3dd9d56f75833c701ba16965bc 100644
--- a/tests/test_register.py
+++ b/tests/test_register.py
@@ -1,36 +1,30 @@
 # Import the playwright module and the constants file
-from playwright.sync_api import Playwright, sync_playwright, expect
+from playwright.sync_api import Playwright, expect
 import pytest, sqlite3
-from tUtils import register
-from tConstant import URL, DB_USERS_ROOT, USE_HEADLESS
-
-username = "TestUserRegister"
-username = username.lower()
-email = username + '@flaskblog.com'
-
-@pytest.fixture(autouse=True)
-def setup_data ():
-    yield
-    print('\nDeleting ' + email)
+from tests.utils.constant import USE_HEADLESS, URL, DB_USERS_ROOT
+from tests.utils.user import UserTest
+from tests.functions.register import register
+
+@pytest.fixture()
+def user ():
+    user = UserTest("User_Test_Register")
+    yield user
+    print('\nDeleting ' + user.username)
     connection = sqlite3.connect(DB_USERS_ROOT)
     cursor = connection.cursor()
-    cursor.execute('DELETE FROM users where email = ?', [(email)])
+    cursor.execute('DELETE FROM users where email = ?', [(user.email)])
     connection.commit()
 
-
-
 # Define a function that takes a playwright object as an argument
-def test_register(playwright: Playwright) -> None:
-    # Launch a chromium browser in non-headless mode
+def test_register(playwright: Playwright, user: UserTest) -> None:
     browser = playwright.chromium.launch(headless=USE_HEADLESS)
     context = browser.new_context()
     page = context.new_page()
-    page.goto(URL)
 
-    page = register(page, username)
+    page = register(page, user)
 
     expect(page).to_have_url(URL + '/')
-    expect(page.locator('[href*="/user/' + username + '"]')).to_be_visible()
+    expect(page.locator('[href*="/user/' + user.username + '"]')).to_be_visible()
 
     context.close()
     browser.close()
diff --git a/tests/utils/constant.py b/tests/utils/constant.py
new file mode 100644
index 0000000000000000000000000000000000000000..d64bdf82a30d6bc542181271c3e7b5b4a25d6794
--- /dev/null
+++ b/tests/utils/constant.py
@@ -0,0 +1,17 @@
+# Assign the URL of the local server to a variable named URL
+URL = "http://192.168.237.2:5000"
+USE_HEADLESS = False
+
+### DATABASE SETTINGS ###
+
+# Root path of the database folder
+DB_FOLDER_ROOT = "db/"  # (str)
+
+# Root path of the users database
+DB_USERS_ROOT = DB_FOLDER_ROOT + "users.db"  # (str)
+
+# Root path of the posts database
+DB_POSTS_ROOT = DB_FOLDER_ROOT + "posts.db"  # (str)
+
+# Root path of the comments database
+DB_COMMENTS_ROOT = DB_FOLDER_ROOT + "comments.db"  # (str)
\ No newline at end of file
diff --git a/tests/utils/is_user_exist.py b/tests/utils/is_user_exist.py
new file mode 100644
index 0000000000000000000000000000000000000000..dcd05cdaabce30fa7850e5d1f8b5392598c38fb7
--- /dev/null
+++ b/tests/utils/is_user_exist.py
@@ -0,0 +1,16 @@
+import sqlite3
+from tests.utils.constant import DB_USERS_ROOT
+
+def is_user_exist(username):
+    connection = sqlite3.connect(DB_USERS_ROOT)
+    cursor = connection.cursor()
+    query = '''
+      SELECT userID FROM users where username = ?
+      '''
+    exist = False
+
+    for row in cursor.execute(query,[(username)]):
+      exist = True
+
+    connection.close()
+    return exist
\ No newline at end of file
diff --git a/tests/utils/user.py b/tests/utils/user.py
new file mode 100644
index 0000000000000000000000000000000000000000..e99a6965387c32a6477333bb0d728ef5107da5dd
--- /dev/null
+++ b/tests/utils/user.py
@@ -0,0 +1,5 @@
+class UserTest:
+  def __init__(self, username: str) -> None:
+    self.username = username.lower()
+    self.email = self.username + "@mail.com"
+    self.password = self.username + "secret"
\ No newline at end of file