-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
97 lines (91 loc) · 3.86 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from django.test import LiveServerTestCase
class SafeTestCase(LiveServerTestCase):
def testDisease(self):
driver = webdriver.Chrome()
driver.get("http://127.0.0.1:8000/")
time.sleep(2)
driver.set_window_size(1552, 840)
time.sleep(1)
driver.find_element(By.LINK_TEXT, "Diagnose").click()
time.sleep(1)
driver.find_element(By.CSS_SELECTOR, ".box:nth-child(6) h1").click()
time.sleep(1)
driver.find_element(By.ID, "Pregnancies").click()
driver.find_element(By.ID, "Pregnancies").send_keys("2")
time.sleep(0.5)
driver.find_element(By.ID, "Glucose").click()
driver.find_element(By.ID, "Glucose").send_keys("60")
time.sleep(0.5)
driver.find_element(By.ID, "BloodPressure").click()
driver.find_element(By.ID, "BloodPressure").send_keys("120")
time.sleep(0.5)
driver.find_element(By.ID, "BMI").click()
driver.find_element(By.ID, "BMI").send_keys("50")
time.sleep(0.5)
driver.find_element(By.ID, "DiabetesPedigreeFunction").click()
driver.find_element(By.ID, "DiabetesPedigreeFunction").send_keys("0")
time.sleep(0.5)
driver.find_element(By.ID, "Age").click()
driver.find_element(By.ID, "Age").send_keys("30")
time.sleep(0.5)
driver.find_element(By.CSS_SELECTOR, ".btn-danger").click()
assert "You are Safe" in driver.page_source
time.sleep(0.5)
driver.find_element(By.LINK_TEXT, "Go Back").click()
time.sleep(0.5)
driver.find_element(By.LINK_TEXT, "Home").click()
time.sleep(0.5)
driver.close()
class RiskTestCase(LiveServerTestCase):
def testDisease(self):
driver = webdriver.Chrome()
driver.get("http://127.0.0.1:8000/")
time.sleep(2)
driver.set_window_size(1552, 840)
time.sleep(1)
driver.find_element(By.LINK_TEXT, "Diagnose").click()
time.sleep(1)
driver.find_element(By.CSS_SELECTOR, ".box:nth-child(6) h1").click()
time.sleep(1)
driver.find_element(By.ID, "Pregnancies").click()
driver.find_element(By.ID, "Pregnancies").send_keys("4")
time.sleep(0.5)
driver.find_element(By.ID, "Glucose").click()
driver.find_element(By.ID, "Glucose").send_keys("90")
time.sleep(0.5)
driver.find_element(By.ID, "BloodPressure").click()
driver.find_element(By.ID, "BloodPressure").send_keys("100")
time.sleep(0.5)
driver.find_element(By.ID, "BMI").click()
driver.find_element(By.ID, "BMI").send_keys("80")
time.sleep(0.5)
driver.find_element(By.ID, "DiabetesPedigreeFunction").click()
driver.find_element(By.ID, "DiabetesPedigreeFunction").send_keys("1")
time.sleep(0.5)
driver.find_element(By.ID, "Age").click()
driver.find_element(By.ID, "Age").send_keys("55")
time.sleep(0.5)
driver.find_element(By.CSS_SELECTOR, ".btn-danger").click()
assert "You are at Risk" in driver.page_source
time.sleep(0.5)
driver.find_element(By.LINK_TEXT, "Go Back").click()
time.sleep(0.5)
driver.find_element(By.LINK_TEXT, "Home").click()
time.sleep(0.5)
driver.close()
class ServerTest(LiveServerTestCase):
def testServer(self):
driver = webdriver.Chrome()
driver.get('http://127.0.0.1:8000/')
assert "eVaidyahCare" in driver.title