-
Notifications
You must be signed in to change notification settings - Fork 0
/
TC007_Create_Group.py
70 lines (54 loc) · 2.09 KB
/
TC007_Create_Group.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
#Author : Erdenebileg
import unittest
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
class TC007_Create_Group(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
def test_create_group(self):
user = "huskyUser"
pwd = "husker@123"
driver = self.driver
driver.maximize_window()
driver.get("https://huskersapp.herokuapp.com")
time.sleep(1)
# Click on the Sign in button
driver.find_element_by_xpath("/html/body/div/div/div[1]/div/a[1]/button").click()
time.sleep(1)
# Fetch the user ID and password by giving the below codes
elem = driver.find_element_by_id("id_username")
elem.send_keys(user)
elem = driver.find_element_by_id("id_password")
elem.send_keys(pwd)
elem.send_keys(Keys.RETURN)
time.sleep(1)
# Click Create Button
driver.find_element_by_xpath("/html[1]/body[1]/div[1]/div[1]/div[2]/div[1]/a[1]").click()
time.sleep(1)
elem = driver.find_element_by_id("id_name")
elem.send_keys("Unit Test Group")
elem = driver.find_element_by_id("id_venue")
for option in elem.find_elements_by_tag_name('option'):
if option.text == 'Caniglia Field':
option.click()
break
elem = driver.find_element_by_id("id_meeting_time")
elem.send_keys("3 PM")
elem = driver.find_element_by_id("id_group_details")
elem.send_keys("Test Detail")
elem = driver.find_element_by_id("id_groupAdmin")
for option in elem.find_elements_by_tag_name('option'):
if option.text == 'admin':
option.click()
break
elem = driver.find_element_by_id("id_hashtag")
elem.send_keys("#testcase")
time.sleep(2)
driver.find_element_by_xpath("/html[1]/body[1]/div[1]/div[1]/form[1]/div[8]/div[1]/button[1]").click()
time.sleep(3)
def tearDown(self):
self.driver.close()
if __name__ == "__main__":
unittest.main()