From ed9b1d373bc0c048d581a694aa5064ce83b3511c Mon Sep 17 00:00:00 2001 From: Yash Dhanuka Date: Mon, 25 Aug 2025 16:16:04 +0530 Subject: [PATCH 1/6] vanilla_pytest --- .../test_product.cpython-39-pytest-8.3.2.pyc | Bin 0 -> 2023 bytes .../test_pytest/browserstack.yml | 28 ++++++++++ TS_AI_Django_Starter/test_pytest/local.log | 4 ++ .../test_pytest/log/key-metrics.json.lock | 0 .../test_pytest/test_product.py | 48 ++++++++++++++++++ TS_AI_Django_Starter/test_pytest/test_task.py | 45 ++++++++++++++++ TS_AI_Django_Starter/test_pytest/test_user.py | 48 ++++++++++++++++++ 7 files changed, 173 insertions(+) create mode 100644 TS_AI_Django_Starter/test_pytest/__pycache__/test_product.cpython-39-pytest-8.3.2.pyc create mode 100644 TS_AI_Django_Starter/test_pytest/browserstack.yml create mode 100644 TS_AI_Django_Starter/test_pytest/local.log create mode 100644 TS_AI_Django_Starter/test_pytest/log/key-metrics.json.lock create mode 100644 TS_AI_Django_Starter/test_pytest/test_product.py create mode 100644 TS_AI_Django_Starter/test_pytest/test_task.py create mode 100644 TS_AI_Django_Starter/test_pytest/test_user.py diff --git a/TS_AI_Django_Starter/test_pytest/__pycache__/test_product.cpython-39-pytest-8.3.2.pyc b/TS_AI_Django_Starter/test_pytest/__pycache__/test_product.cpython-39-pytest-8.3.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5793bfefb5431b939e163b12f895faa4e14b910e GIT binary patch literal 2023 zcmbVN%a7Yc7@x5n$8jF}DlHTcs{&dgu}QY2P*s3hwtJ|AmWnM@GO9+7XR`6GU(8Ip z&C20Gd*E1c=8znbIP(YaXZXsge*#?Ko3XQ6P%9y9dHg+oGv90G8^7Il5j=nNe;E&K zgnn1d`Nst27JMRtfg*|{A4i?dV7Z;5aHl#d!#5gdE3XgBQA&z})*0{+jW z|CL}|^y!!}?jQ9}QhqElKVW^ygd8&3&!%#mCjEQ*M|SVtCX~f#|Na5FeV5!h@{_}q z97vx_#`PSbM*`Defr{oSodmL%O}X;54xeyfK&FFTY#Uk{sQ8yp3kU_}J2ebM>R%0N$OO zHwJ@2pToIEr&op(DbwT|>PvrnD7Ilw9WwdJ*4tUReZtBXHp667k=MGSXlDK)BO;yffOQSe1b`Z@opyWyr%P(!^{!CD>)i{532|`?VlHZv zM21me?CpA&Sj1wMNFq}*WF&yod+ZM*##K)!TDu1a3@2eE!$cHz zlmb{3uM#m%ClS@N$YGQY{fH!x{GxMPhX!42kMool8)TI7*p~#_T;wOd>TlhaKH1*N zvVvehmDpRa1bQhFCfP)K8%r4!E?|{#-KUf+71iW+S)k=wuT<b6)8stFaZt2RcI8$M(fI(#^qEW}_Vg452yBmeGOg6s^g5tHRWA;jSA$vW}PIxGxN@t>?Udi|+HODTCTQ~yt zKoU;k@(y@o$@b2!r5;o~h9!s7ayz~G0*IJoS;}Q^66(F_U4A)+*T6hqQ$Ey3;bS@B lOjlaRb}obJis3qq&c`v_0TKIDb$Oxo<`vv3U&F$#^Eb^ZM?L@m literal 0 HcmV?d00001 diff --git a/TS_AI_Django_Starter/test_pytest/browserstack.yml b/TS_AI_Django_Starter/test_pytest/browserstack.yml new file mode 100644 index 00000000..e920a325 --- /dev/null +++ b/TS_AI_Django_Starter/test_pytest/browserstack.yml @@ -0,0 +1,28 @@ +accessKey: BROWSERSTACK_ACCESS_KEY +browserstackLocal: true +buildIdentifier: '#${BUILD_NUMBER}' +buildName: sdk_wrapper_build +logLevel: debug +networkLogs: true +platforms: +- browserName: chrome + browserVersion: latest + os: OS X + osVersion: Big Sur +- browserName: edge + browserVersion: latest + os: Windows + osVersion: '10' +- browserName: chrome + deviceName: Samsung.* + osVersion: 1[23] +projectName: sdk wrapper project +testObservability: true +#testOrchestrationOptions: + # rerunPreviouslyFailed: false + # runPreviouslyFailedFirst: false + # runSmartSelection: + # enabled: true + # mode: relevantFirst + #skipFlakyandFailed: false +userName: BROWSERSTACK_USERNAME diff --git a/TS_AI_Django_Starter/test_pytest/local.log b/TS_AI_Django_Starter/test_pytest/local.log new file mode 100644 index 00000000..12a4de13 --- /dev/null +++ b/TS_AI_Django_Starter/test_pytest/local.log @@ -0,0 +1,4 @@ + +Mon Aug 25 2025 15:23:16:646 GMT+0530 (IST) -- Press Ctrl-C to exit + + diff --git a/TS_AI_Django_Starter/test_pytest/log/key-metrics.json.lock b/TS_AI_Django_Starter/test_pytest/log/key-metrics.json.lock new file mode 100644 index 00000000..e69de29b diff --git a/TS_AI_Django_Starter/test_pytest/test_product.py b/TS_AI_Django_Starter/test_pytest/test_product.py new file mode 100644 index 00000000..3c26ef04 --- /dev/null +++ b/TS_AI_Django_Starter/test_pytest/test_product.py @@ -0,0 +1,48 @@ +import pytest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + +@pytest.fixture +def driver(): + # Setup WebDriver + driver = webdriver.Chrome() + driver.implicitly_wait(10) + yield driver + # Teardown WebDriver + driver.quit() + +def test_add_and_verify_product(driver): + # Navigate to the application + driver.get("http://127.0.0.1:8000/") + + # Navigate to products page + products_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-bs-target='#products']")) + ) + products_button.click() + + # Add a new product + product_name_input = driver.find_element(By.ID, "productName") + product_price_input = driver.find_element(By.ID, "productPrice") + add_product_button = driver.find_element(By.CSS_SELECTOR, "#products .btn-primary") + + product_name_input.send_keys("car") + product_price_input.send_keys("100000") + add_product_button.click() + + # Verify the product was added + search_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-bs-target='#search']")) + ) + search_button.click() + + search_product_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "#search .btn-secondary")) + ) + search_product_button.click() + + page_source = driver.page_source + assert "car" in page_source + assert "100000" in page_source diff --git a/TS_AI_Django_Starter/test_pytest/test_task.py b/TS_AI_Django_Starter/test_pytest/test_task.py new file mode 100644 index 00000000..029ed711 --- /dev/null +++ b/TS_AI_Django_Starter/test_pytest/test_task.py @@ -0,0 +1,45 @@ +import pytest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + +@pytest.fixture +def driver(): + # Setup WebDriver + driver = webdriver.Chrome() + driver.implicitly_wait(10) + yield driver + # Teardown WebDriver + driver.quit() + +def test_add_and_verify_task(driver): + # Navigate to the application + driver.get("http://127.0.0.1:8000/") + + # Navigate to tasks page + tasks_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-bs-target='#tasks']")) + ) + tasks_button.click() + + # Add a new task + task_title_input = driver.find_element(By.ID, "taskTitle") + add_task_button = driver.find_element(By.CSS_SELECTOR, "#tasks .btn-primary") + + task_title_input.send_keys("sell cars") + add_task_button.click() + + # Verify the task was added + search_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-bs-target='#search']")) + ) + search_button.click() + + search_task_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "#search .btn-secondary")) + ) + search_task_button.click() + + page_source = driver.page_source + assert "sell cars" in page_source diff --git a/TS_AI_Django_Starter/test_pytest/test_user.py b/TS_AI_Django_Starter/test_pytest/test_user.py new file mode 100644 index 00000000..4a46cf66 --- /dev/null +++ b/TS_AI_Django_Starter/test_pytest/test_user.py @@ -0,0 +1,48 @@ +import pytest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + +@pytest.fixture +def driver(): + # Setup WebDriver + driver = webdriver.Chrome() + driver.implicitly_wait(10) + yield driver + # Teardown WebDriver + driver.quit() + +def test_add_and_verify_user(driver): + # Navigate to the application + driver.get("http://127.0.0.1:8000/") + + # Navigate to users page + users_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-bs-target='#users']")) + ) + users_button.click() + + # Add a new user + user_name_input = driver.find_element(By.ID, "userName") + user_email_input = driver.find_element(By.ID, "userEmail") + add_user_button = driver.find_element(By.CSS_SELECTOR, "#users .btn-primary") + + user_name_input.send_keys("ui_user") + user_email_input.send_keys("ui_user@example.com") + add_user_button.click() + + # Verify the user was added + search_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-bs-target='#search']")) + ) + search_button.click() + + search_user_button = WebDriverWait(driver, 10).until( + EC.element_to_be_clickable((By.CSS_SELECTOR, "#search .btn-secondary")) + ) + search_user_button.click() + + page_source = driver.page_source + assert "ui_user" in page_source + assert "ui_user@example.com" in page_source From f19a23f1b8e43edc9495991d0c2a230fa629884c Mon Sep 17 00:00:00 2001 From: Yash Dhanuka Date: Mon, 25 Aug 2025 16:18:07 +0530 Subject: [PATCH 2/6] deleted yml --- .../test_pytest/browserstack.yml | 28 ------------------- TS_AI_Django_Starter/test_pytest/local.log | 4 --- .../test_pytest/log/key-metrics.json.lock | 0 3 files changed, 32 deletions(-) delete mode 100644 TS_AI_Django_Starter/test_pytest/browserstack.yml delete mode 100644 TS_AI_Django_Starter/test_pytest/local.log delete mode 100644 TS_AI_Django_Starter/test_pytest/log/key-metrics.json.lock diff --git a/TS_AI_Django_Starter/test_pytest/browserstack.yml b/TS_AI_Django_Starter/test_pytest/browserstack.yml deleted file mode 100644 index e920a325..00000000 --- a/TS_AI_Django_Starter/test_pytest/browserstack.yml +++ /dev/null @@ -1,28 +0,0 @@ -accessKey: BROWSERSTACK_ACCESS_KEY -browserstackLocal: true -buildIdentifier: '#${BUILD_NUMBER}' -buildName: sdk_wrapper_build -logLevel: debug -networkLogs: true -platforms: -- browserName: chrome - browserVersion: latest - os: OS X - osVersion: Big Sur -- browserName: edge - browserVersion: latest - os: Windows - osVersion: '10' -- browserName: chrome - deviceName: Samsung.* - osVersion: 1[23] -projectName: sdk wrapper project -testObservability: true -#testOrchestrationOptions: - # rerunPreviouslyFailed: false - # runPreviouslyFailedFirst: false - # runSmartSelection: - # enabled: true - # mode: relevantFirst - #skipFlakyandFailed: false -userName: BROWSERSTACK_USERNAME diff --git a/TS_AI_Django_Starter/test_pytest/local.log b/TS_AI_Django_Starter/test_pytest/local.log deleted file mode 100644 index 12a4de13..00000000 --- a/TS_AI_Django_Starter/test_pytest/local.log +++ /dev/null @@ -1,4 +0,0 @@ - -Mon Aug 25 2025 15:23:16:646 GMT+0530 (IST) -- Press Ctrl-C to exit - - diff --git a/TS_AI_Django_Starter/test_pytest/log/key-metrics.json.lock b/TS_AI_Django_Starter/test_pytest/log/key-metrics.json.lock deleted file mode 100644 index e69de29b..00000000 From 48b2c30abbe38476da684b0740cf4dd56df1b24e Mon Sep 17 00:00:00 2001 From: yash6195 <105772137+yash6195@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:40:18 +0530 Subject: [PATCH 3/6] Create requirements.txt --- TS_AI_Django_Starter/test_pytest/requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 TS_AI_Django_Starter/test_pytest/requirements.txt diff --git a/TS_AI_Django_Starter/test_pytest/requirements.txt b/TS_AI_Django_Starter/test_pytest/requirements.txt new file mode 100644 index 00000000..235aee0c --- /dev/null +++ b/TS_AI_Django_Starter/test_pytest/requirements.txt @@ -0,0 +1,3 @@ +selenium +pytest +requests==2.31.0 From 04c71476d19fdbba70f877ad27930267ba1aae09 Mon Sep 17 00:00:00 2001 From: yash6195 <105772137+yash6195@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:43:44 +0530 Subject: [PATCH 4/6] Update test_product.py --- TS_AI_Django_Starter/test_pytest/test_product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TS_AI_Django_Starter/test_pytest/test_product.py b/TS_AI_Django_Starter/test_pytest/test_product.py index 3c26ef04..f1055b04 100644 --- a/TS_AI_Django_Starter/test_pytest/test_product.py +++ b/TS_AI_Django_Starter/test_pytest/test_product.py @@ -15,7 +15,7 @@ def driver(): def test_add_and_verify_product(driver): # Navigate to the application - driver.get("http://127.0.0.1:8000/") + driver.get("http://127.0.0.1:5000/") # Navigate to products page products_button = WebDriverWait(driver, 10).until( From 1edfa592b24d9e8d0af50ac7fc1a391a513029c5 Mon Sep 17 00:00:00 2001 From: yash6195 <105772137+yash6195@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:43:54 +0530 Subject: [PATCH 5/6] Change test URL from 8000 to 5000 --- TS_AI_Django_Starter/test_pytest/test_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TS_AI_Django_Starter/test_pytest/test_task.py b/TS_AI_Django_Starter/test_pytest/test_task.py index 029ed711..2d101244 100644 --- a/TS_AI_Django_Starter/test_pytest/test_task.py +++ b/TS_AI_Django_Starter/test_pytest/test_task.py @@ -15,7 +15,7 @@ def driver(): def test_add_and_verify_task(driver): # Navigate to the application - driver.get("http://127.0.0.1:8000/") + driver.get("http://127.0.0.1:5000/") # Navigate to tasks page tasks_button = WebDriverWait(driver, 10).until( From 21a4656d406f0dd60954231ed5d4068619c13e1c Mon Sep 17 00:00:00 2001 From: yash6195 <105772137+yash6195@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:44:04 +0530 Subject: [PATCH 6/6] Update test URL from port 8000 to 5000 --- TS_AI_Django_Starter/test_pytest/test_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TS_AI_Django_Starter/test_pytest/test_user.py b/TS_AI_Django_Starter/test_pytest/test_user.py index 4a46cf66..f9e3e4ba 100644 --- a/TS_AI_Django_Starter/test_pytest/test_user.py +++ b/TS_AI_Django_Starter/test_pytest/test_user.py @@ -15,7 +15,7 @@ def driver(): def test_add_and_verify_user(driver): # Navigate to the application - driver.get("http://127.0.0.1:8000/") + driver.get("http://127.0.0.1:5000/") # Navigate to users page users_button = WebDriverWait(driver, 10).until(