How to use test_change_settings method in pytest-django

Best Python code snippet using pytest-django_python

test_IO_Port.py

Source:test_IO_Port.py Github

copy

Full Screen

1'''2Created on Aug 26, 201934@author: DTE_ADMIN5'''6from time import sleep78import pytest9from selenium.webdriver.common.by import By10from selenium.webdriver.common.keys import Keys11from selenium.webdriver.support import expected_conditions12from selenium.webdriver.support.select import Select13from selenium.webdriver.support.wait import WebDriverWait1415from Utils.commonFunctions import Util161718@pytest.mark.DTE_COMMON19class Test_IO_Port_settings():2021 @pytest.fixture()22 def test_setUp(self):23 object_util=Util()24 self.driver=object_util.init_ChromeDriver()25 self.LOGGER=object_util.init_Logger()26 #Util.init_IE_Driver(self)27 yield28 self.defaultValues()29 self.driver.find_element_by_name("action").click()30 self.driver.quit()3132 def defaultValues(self):33 self.driver.find_element_by_xpath("//*[@id='failsafeOff']").click()34 Select(self.driver.find_element_by_id("selektor_channel_io1")).select_by_value("rwh_rw")35 Select(self.driver.find_element_by_name("dataHoldTime_io1")).select_by_visible_text("0")36 Select(self.driver.find_element_by_id("selektor_channel_io2")).select_by_value("portmode_off")37 Select(self.driver.find_element_by_id("selektor_channel_io3")).select_by_value("portmode_off") 38 self.driver.find_element_by_name("action").click()39 sleep(1)40 self.driver.find_element_by_name("action").click()41 42 def test_change_Settings(self,test_setUp):43 """Test_IO_Port_settings.test_change_Settings4445 @DESCRIBE[[Test sequence:46 - verify [1] that changes should be saved 47 - verify [2] same values that are saved are reflecting on page.]]48 @TESTS[DTE80x_DTE90x-1352]49 """50 self.driver.find_element_by_xpath("//*[@id='ioportconfig']/a").click()51 self.driver.switch_to.frame("center")52 sleep(2)53 self.defaultValues()54 55 # Global_Settings56 self.driver.find_element_by_xpath("//*[@id='failsafeOn']").click()57 58 Select(self.driver.find_element_by_id("selektor_channel_io1")).select_by_value("rwh_rw")59 Select(self.driver.find_element_by_name("dataHoldTime_io1")).select_by_visible_text("100")60 61 # IO-1 Settings62 Select(self.driver.find_element_by_id("selektor_channel_io2")).select_by_value("input")63 Select(self.driver.find_element_by_name("dataHoldTime_io2")).select_by_visible_text("2000")64 65 # IO-2 Settings66 Select(self.driver.find_element_by_id("selektor_channel_io3")).select_by_value("output")67 Select(self.driver.find_element_by_name("dataHoldTime_io3")).select_by_visible_text("20")68 69 # Click on Activate and Save70 self.driver.find_element_by_name("action").click()71 72 # Verification73 wait = WebDriverWait(self.driver, 10)74 wait.until(expected_conditions.visibility_of_element_located((By.XPATH, "//*[@id='tblPortconfig']/tbody[1]/tr[1]/td[2]/span")))75 76 if (self.driver.find_element_by_xpath("//*[@id='tblPortconfig']/tbody[1]/tr[1]/td[2]/span").text == "on"):77 flag1 = True78 else: 79 flag1 = False80 if (self.driver.find_element_by_xpath("//*[@id='currmode_channel_io1']/span").text == "RWH RW"):81 flag2 = True82 else: 83 flag2 = False84 if(self.driver.find_element_by_xpath("//*[@id='tblPortconfig']/tbody[2]/tr[2]/td[2]").text == "100"):85 flag3 = True86 else: 87 flag3 = False88 89 if(self.driver.find_element_by_xpath("//*[@id='currmode_channel_io2']/span").text == "Input"):90 flag4 = True91 else: 92 flag4 = False93 if(self.driver.find_element_by_xpath("//*[@id='tblPortconfig']/tbody[3]/tr[2]/td[2]").text == "2000"):94 flag5 = True95 else: 96 flag5 = False97 98 if(self.driver.find_element_by_xpath("//*[@id='currmode_channel_io3']/span").text == "Output"):99 flag6 = True100 else: 101 flag6 = False102 if(self.driver.find_element_by_xpath("//*[@id='tblPortconfig']/tbody[4]/tr[2]/td[2]").text == "20"):103 flag7 = True104 else: 105 flag7 = False106 107 self.driver.find_element_by_xpath("//input[@name='action']").click()108 assert(flag1==True and flag2==True and flag3==True and109 flag4==True and flag5==True and flag6==True and110 flag7==True)111 ...

Full Screen

Full Screen

test_directories.py

Source:test_directories.py Github

copy

Full Screen

...20 def test_load_settings(self):21 dirs.update(self.dirs_dict)22 self.assertEqual('./folder1', dirs.folder1.root)23 self.assertFalse(Path(str(dirs.folder1)).exists())24 def test_change_settings(self):25 dirs.update(self.dirs_dict)26 dirs.update_root('other_place')27 self.assertEqual('other_place/folder2/folder2_1', str(dirs.folder2.folder2_1))28 def test_creating_dir(self):29 with mlsuite.create_dirs(True):30 dirs.update(self.dirs_dict)31 with mlsuite.create_dirs(False):32 path = dirs.folder1.root33 self.assertFalse(Path(path).exists())34 self.assertTrue(Path(dirs.folder1.root).exists())35 Path('folder1').rmdir()36 def test_dots(self):37 dirs.update({'.hidden': []})38 self.assertEqual('./.hidden', str(dirs._H_hidden))...

Full Screen

Full Screen

user_model_test.py

Source:user_model_test.py Github

copy

Full Screen

...23 def test_comment_on_post(self, test_setup):24 pass25 def test_share_post(self, test_setup):26 pass27 def test_change_settings(self, test_setup):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-django automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful