-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathGroup role change.py
More file actions
58 lines (50 loc) · 2.02 KB
/
Group role change.py
File metadata and controls
58 lines (50 loc) · 2.02 KB
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
__author__= 'shubh'
import unittest
from decouple import config
from selenium.webdriver.support.select import Select
from selenium import webdriver
class signup(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Firefox()
def login(self,var,driver):
driver.get(config('IP_ADDRESS'))
driver.find_element_by_xpath('//a [@href="/login/?next=/"]').click()
driver.get(config('IP_ADDRESS') + 'login/?next=/')
elem = driver.find_element_by_id("id_username")
user = config('NOTIFICATION_USER').split(',')
elem.send_keys(user[var])
elem = driver.find_element_by_id("id_password")
elem.send_keys(config('NOTIFICATION_PASSWORD'))
driver.find_element_by_class_name('btn-block').click()
def fillTheForm(self,driver,var,roleid):
elem = driver.find_element_by_id("username")
user = config('NOTIFICATION_USER').split(',')
elem.send_keys(user[var])
role = config('NOTIFICATION_GROUP_ROLE').split(',')
elem = driver.find_element_by_id("role")
elem.send_keys(role[roleid])
driver.find_element_by_id('update').click()
driver.get(config('IP_ADDRESS') + 'logout/')
self.login(var,driver)
driver.get(config('IP_ADDRESS') + 'notifications/')
driver.get(config('IP_ADDRESS') + 'communities/')
driver.find_element_by_xpath('//a [@href="/community-view/2/"]').click()
driver.find_element_by_xpath('//a [@href="/group-view/1/"]').click()
driver.find_element_by_xpath('//a [@href="/group-feed/1/"]').click()
driver.get(config('IP_ADDRESS') + 'logout/')
def test_draftToVisisbleState(self):
driver = webdriver.Firefox()
for i in range(1,4):
for j in range(0,3):
self.login(0,driver)
driver.get(config('IP_ADDRESS') + 'communities/')
driver.find_element_by_xpath('//a [@href="/community-view/2/"]').click()
driver.find_element_by_xpath('//a [@href="/group-view/1/"]').click()
driver.find_element_by_xpath('//a [@href="/manage_group/1/"]').click()
self.fillTheForm(driver,i,j)
@classmethod
def tearDown(cls):
cls.driver.quit()
if __name__ == '__main__':
unittest.main()