Best Python code snippet using avocado_python
test_courier_menu.py
Source:test_courier_menu.py
1#!/usr/bin/env python32# -*- coding:utf-8 -*-3import re4import pytest5import allure6from datetime import datetime7from utils.times import sleep8from utils.logger import log9from common.readconfig import ini10from page_object.loginpage import LoginPage11from page_object.menupage import MenuPage, Service, Link, ServiceConfig, ConfigManage, Blacklist, Location, Conditional, Statistics12# ç³»ç»runæ¶æ¹ä¸ºFalse13auto = False14# @pytest.mark.skip(reason="ææ¶è·³è¿æµè¯")15@allure.feature("courierèåæ ç¹å»")16class TestService:17 @pytest.fixture(scope='session', autouse=True)18 def open_devops(self, drivers):19 """æå¼courier"""20 login = LoginPage(drivers)21 login.get_url(ini.url)22 login.input_username_login('admin')23 login.input_password_login('password')24 login.click_login()25 login.click_Menu("æå¡ç®¡ç")26 @allure.story("ç¹å»æå¡ç®¡ç")27 def test_001(self, drivers):28 """ç¹å»æå¡ç®¡ç"""29 serv = Service(drivers)30 serv.click_Menu('æå¡ç®¡ç')31 serv.waite_element('æå¡å')32 result = re.search(r'æå¡å表', serv.get_source)33 log.info(result)34 assert result35 @allure.story("æå¡ç®¡çæç´¢åè½")36 def test_002(self, drivers):37 """æå¡ç®¡çæç´¢åè½"""38 serv = Service(drivers)39 serv.input_servername("æå¡åæç´¢æµè¯")40 serv.click_search()41 serv.click_reset()42 serv.input_devname("设å¤å称æç´¢æµè¯")43 serv.click_search()44 serv.click_reset()45 serv.input_colonyname("é群å称æç´¢æµè¯")46 serv.click_search()47 serv.click_reset()48 serv.input_servername("æå¡åæç´¢æµè¯")49 serv.input_devname("设å¤å称æç´¢æµè¯")50 serv.input_colonyname("é群å称æç´¢æµè¯")51 serv.click_search()52 serv.click_reset()53 @allure.story("注éå¼å¸¸æé®")54 def test_003(self, drivers):55 """注éå¼å¸¸æé®"""56 serv = Service(drivers)57 serv.click_logoff()58 result = re.search(r'注éå¼å¸¸æå¡æå', serv.get_source)59 log.info(result)60 assert result61 @allure.story("å·æ°æé®")62 def test_004(self, drivers):63 """ç¹å»å·æ°æé®"""64 serv = Service(drivers)65 serv.click_refresh()66 @allure.story("ä¿®æ¹æé®")67 def test_005(self, drivers):68 """ç¹å»ä¿®æ¹æé®"""69 serv = Service(drivers)70 serv.click_change(0)71 result = re.search(r'ä¿®æ¹æå¡', serv.get_source)72 log.info(result)73 assert result74 serv.click_Canle()75 @allure.story("è¾å
¥ç»åº¦")76 def test_006(self, drivers):77 """ç»åº¦æµè¯"""78 longtitude = "13.24"79 serv = Service(drivers)80 serv.click_change(0)81 serv.input_longtitude(longtitude)82 serv.click_Canle()83 serv.click_change(0)84 serv.input_longtitude(longtitude)85 serv.click_Define()86 result = re.search(r'ä¿®æ¹æå¡æå', serv.get_source)87 log.info(result)88 assert result89 serv.click_change(0)90 result = re.search(longtitude, serv.get_source)91 log.info(result)92 assert result93 serv.click_Canle()94 @allure.story("è¾å
¥çº¬åº¦")95 def test_007(self, drivers):96 """纬度æµè¯"""97 latitude = "165.24"98 serv = Service(drivers)99 serv.click_change(0)100 serv.input_latitude(latitude)101 serv.click_Canle()102 serv.click_change(0)103 serv.input_latitude(latitude)104 serv.click_Define()105 result = re.search(r'ä¿®æ¹æå¡æå', serv.get_source)106 log.info(result)107 assert result108 serv.click_change(0)109 result = re.search(latitude, serv.get_source)110 log.info(result)111 assert result112 serv.click_Canle()113 @allure.story("æå¡æè¿°")114 def test_008(self, drivers):115 """æå¡æè¿°æµè¯"""116 basic = "æµè¯æå¡æè¿°ï¼é便åçä¸ç¹ææ¬å
容"117 serv = Service(drivers)118 serv.click_change(0)119 serv.input_basic(basic)120 serv.click_Canle()121 serv.click_change(0)122 serv.input_basic(basic)123 serv.click_Define()124 result = re.search(r'ä¿®æ¹æå¡æå', serv.get_source)125 log.info(result)126 assert result127 serv.click_change(0)128 result = re.search(basic, serv.get_source)129 log.info(result)130 assert result131 serv.click_Canle()132 @allure.story("ä¿®æ¹æå¡æ¨¡ååæ°ä¸åä¿®æ¹")133 def test_09(self, drivers):134 """ä¿®æ¹æå¡åæ°æ¨¡åä¸åä¿®æ¹æµè¯"""135 longtitude, latitude, basic = "12.31","123.98","æµè¯æå¡æè¿°ï¼é便åçä¸ç¹ææ¬å
容"136 serv = Service(drivers)137 # click_change(0) 代表修æ¹å
ç´ å表ä¸ç¬¬ä¸ä¸ªå
ç´ 138 serv.click_change(0)139 serv.input_longtitude(longtitude)140 serv.input_latitude(latitude)141 serv.input_basic(basic)142 serv.click_Canle()143 serv.click_change(0)144 serv.input_longtitude(longtitude)145 serv.input_latitude(latitude)146 serv.input_basic(basic)147 serv.click_Define()148 result = re.search(r'ä¿®æ¹æå¡æå', serv.get_source)149 log.info(result)150 assert result151 serv.click_change(0)152 result1 = re.search(basic, serv.get_source)153 result2 = re.search(longtitude, serv.get_source)154 result3 = re.search(latitude, serv.get_source)155 log.info(f"å¹é
ä¿¡æ¯ï¼result1ï¼{result1},\nresult2ï¼{result2},\nresult3ï¼{result3}")156 assert result1 and result2 and result3157 serv.click_Canle()158 @pytest.mark.skip("ç³»ç»runçæ¶åä¸éè¦æ³¨éï¼å¦ååç»ç¨ä¾æ æ³æ£å¸¸è¿è¡")159 @allure.story("注éæé®")160 def test_010(self, drivers):161 """注éæé®æµè¯"""162 serv = Service(drivers)163 serv.click_logoffs(0)164 serv.click_ButtoNo(0)165 sleep()166 serv.click_logoffs(0)167 serv.click_ButtonYes(0)168 result = re.search(r'注éæå', serv.get_source)169 log.info(result)170 assert result171@allure.feature("courieré¾è·¯è¿½è¸ª")172class TestLink:173 # @pytest.mark.skip("æ´ä½runçæ¶åï¼ä¸å¯å¨åç½®æ¡ä»¶")174 @pytest.fixture(scope='session', autouse=auto)175 def open_devops(self, drivers):176 """æå¼courier"""177 login = LoginPage(drivers)178 login.get_url(ini.url)179 login.input_username_login('admin')180 login.input_password_login('password')181 login.click_login()182 login.click_Menu("é¾è·¯è¿½è¸ª")183 @allure.story("ç¹å»é¾è·¯è¿½è¸ª")184 def test_001(self, drivers):185 """ç¹å»æå¡ç®¡ç"""186 link = Link(drivers)187 link.click_Menu('é¾è·¯è¿½è¸ª')188 link.waite_element("æ ¹æå¡å")189 result = re.search(r'é¾è·¯è¿½è¸ªè®°å½å表', link.get_source)190 log.info(result)191 assert result192 @allure.story("æ ¹æå¡åæç´¢åè½")193 def test_002(self, drivers):194 """é¾è·¯è¿½è¸ªæç´¢åè½"""195 link = Link(drivers)196 link.input_rootservername("conditionservice")197 link.click_search()198 result = re.search(r'<span>conditionservice', link.get_source)199 log.info(result)200 assert result201 link.click_reset()202 link.input_rootservername("æ ¹æå¡åæç´¢åè½")203 link.click_search()204 result = re.search(r'ææ æ°æ®', link.get_source)205 log.info(result)206 assert result207 link.click_reset()208 @allure.story("æ¥æèå´æç´¢åè½")209 def test_003(self, drivers):210 """æå¡ç®¡çæç´¢åè½"""211 # å¼å§æ¥æ212 link = Link(drivers)213 link.click_Menu("å¼å§æ¥æ")214 result = re.search(r'2022å¹´', link.get_source)215 log.info(result)216 assert result217 link.click_Menu('年份æé®')218 link.click_Menu('2020å¹´')219 link.click_Menu('æ份æé®')220 link.click_Menu('1æ')221 link.click_Menu('1æ¥')222 link.click_datesubmit()223 result = re.search(r'2020-01-01', link.get_source)224 log.info(result)225 assert result226 # ç»ææ¥æ227 link.input_enddate(datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S"))228 link.click_datesubmit()229 result = re.search(datetime.strftime(datetime.now(), "%Y-%m-%d"), link.get_source)230 log.info(result)231 assert result232 link.click_search()233 link.click_search()234 result = re.search(r'å¼å§æ¥æ', link.get_source)235 log.info(result)236 assert result237 @allure.story("é¾è·¯è¿½è¸ªå表å·æ°")238 def test_004(self, drivers):239 """é¾è·¯è¿½è¸ªå表å·æ°"""240 link = Link(drivers)241 link.click_refresh()242 result = re.search(r'disabled', link.get_source)243 log.info(result)244 assert result245 @allure.story("æ¥çå表第ä¸ä¸ªé¾è·¯è¿½è¸ªè¯¦æ
")246 def test_005(self, drivers):247 """æ¥çå表第ä¸ä¸ªé¾è·¯è¿½è¸ªè¯¦æ
"""248 link = Link(drivers)249 link.click_lookup(0)250 link.click_Linkinfo(1)251 result = re.search(r'é¾è·¯è¿½è¸ªè¯¦æ
', link.get_source)252 log.info(result)253 assert result254 link.click_Menu('è¿åé¾è·¯è¿½è¸ª')255 result = re.search(r'é¾è·¯è¿½è¸ªè®°å½å表', link.get_source)256 log.info(result)257@allure.feature("courieræå¡é
ç½®")258class TestServiceConfig:259 @pytest.fixture(scope='session', autouse=auto)260 def open_devops(self, drivers):261 """æå¼courier"""262 login = LoginPage(drivers)263 login.get_url(ini.url)264 login.input_username_login('admin')265 login.input_password_login('password')266 login.click_login()267 login.click_Menu("æå¡é
ç½®")268 @allure.story("ç¹å»æå¡é
ç½®")269 def test_001(self, drivers):270 """ç¹å»æå¡ç®¡ç"""271 sercof = ServiceConfig(drivers)272 sercof.click_Menu('æå¡é
ç½®')273 sercof.waite_element("key")274 result = re.search(r'é
置类å', sercof.get_source)275 log.info(result)276 assert result277 @allure.story("æ°å»ºé
ç½®å个Global")278 def test_002(self, drivers):279 """æ°å»ºé
ç½®å个Global"""280 sercof = ServiceConfig(drivers)281 sercof.click_add(0)282 result = re.search(r'data.prop', sercof.get_source)283 log.info(result)284 assert result285 sercof.click_Menu('Global')286 sercof.input_key1("key1")287 sercof.input_value1('value1')288 sercof.click_Canle()289 result = re.search(r'é
置类å', sercof.get_source)290 log.info(result)291 assert result292 # æ°å»ºé
ç½®ä¿å293 sercof.click_add(0)294 result = re.search(r'data.prop', sercof.get_source)295 log.info(result)296 assert result297 sercof.click_Menu('Global')298 sercof.input_key1("key1")299 sercof.input_value1('value1')300 sercof.click_Define()301 result = re.search(r'key1', sercof.get_source)302 log.info(result)303 assert result304 sercof.click_del(0)305 result = re.search(r'å é¤æå', sercof.get_source)306 log.info(result)307 assert result308 @allure.story("æ°å»ºé
ç½®å¤ä¸ªGlobal")309 def test_003(self, drivers):310 """æ°å»ºé
ç½®å¤ä¸ªGlobal"""311 sercof = ServiceConfig(drivers)312 sercof.click_add(0)313 result = re.search(r'data.prop', sercof.get_source)314 log.info(result)315 assert result316 sercof.click_Menu('Global')317 sercof.input_key1("key1")318 sercof.input_value1('value1')319 sercof.click_Menu('æ·»å ä¸è¡æ°æ®')320 result = re.search(r'å é¤', sercof.get_source)321 log.info(result)322 assert result323 sercof.input_key2("key2")324 sercof.input_value2("value2")325 sercof.click_contentdel(1)326 # sleep()327 # sercof.click_ButtoNo(0)328 # sercof.click_contentdel(1)329 # sleep(2)330 sercof.click_ButtonYes(0)331 sercof.click_Menu('æ·»å ä¸è¡æ°æ®')332 result = re.search(r'å é¤', sercof.get_source)333 log.info(result)334 assert result335 sercof.input_key2("key2")336 sercof.input_value2("value2")337 sercof.click_Define()338 result = re.search(r'value2', sercof.get_source)339 log.info(result)340 assert result341 sercof.click_del(0)342 sercof.click_del(0)343 result = re.search(r'å é¤æå', sercof.get_source)344 log.info(result)345 assert result346 @allure.story("ç¼è¾é
ç½®Global")347 def test_004(self, drivers):348 """ç¼è¾é
ç½®Global"""349 # æ°å»ºé
ç½®350 sercof = ServiceConfig(drivers)351 sercof.click_add(0)352 result = re.search(r'data.prop', sercof.get_source)353 log.info(result)354 assert result355 sercof.click_Menu('Global')356 sercof.input_key1("key1")357 sercof.input_value1('value1')358 sercof.click_Define()359 result = re.search(r'key1', sercof.get_source)360 log.info(result)361 assert result362 # ç¼è¾é
ç½®363 sercof.click_edit(0)364 sercof.input_value1('value2')365 sercof.click_Define()366 result = re.search(r'value2', sercof.get_source)367 log.info(result)368 assert result369 sercof.click_del(0)370 result = re.search(r'å é¤æå', sercof.get_source)371 log.info(result)372 assert result373 @allure.story("æ°å»ºé
ç½®å个Service")374 def test_005(self, drivers):375 """æ°å»ºé
ç½®å个Service"""376 sercof = ServiceConfig(drivers)377 sercof.click_add(0)378 result = re.search(r'data.prop', sercof.get_source)379 log.info(result)380 assert result381 sercof.click_Menu('service')382 result = re.search(r'æå¡å', sercof.get_source)383 log.info(result)384 assert result385 sercof.input_servicename('service')386 sercof.input_key1("key1")387 sercof.input_value1('value1')388 sercof.click_Canle()389 result = re.search(r'é
置类å', sercof.get_source)390 log.info(result)391 assert result392 # æ°å»ºé
ç½®ä¿å393 sercof.click_add(0)394 result = re.search(r'data.prop', sercof.get_source)395 log.info(result)396 assert result397 sercof.click_Menu('service')398 sercof.input_servicename('service1')399 sercof.input_key1("key1")400 sercof.input_value1('value1')401 sercof.click_Define()402 result = re.search(r'service1', sercof.get_source)403 log.info(result)404 assert result405 sercof.click_del(0)406 result = re.search(r'å é¤æå', sercof.get_source)407 log.info(result)408 assert result409 @allure.story("æ°å»ºé
ç½®å¤ä¸ªService")410 def test_006(self, drivers):411 """æ°å»ºé
ç½®å¤ä¸ªService"""412 sercof = ServiceConfig(drivers)413 sercof.click_add(0)414 result = re.search(r'data.prop', sercof.get_source)415 log.info(result)416 assert result417 sercof.click_Menu('service')418 result = re.search(r'æå¡å', sercof.get_source)419 log.info(result)420 assert result421 sercof.input_servicename('service1')422 sercof.input_key1("key1")423 sercof.input_value1('value1')424 sercof.click_Menu('æ·»å ä¸è¡æ°æ®')425 result = re.search(r'å é¤', sercof.get_source)426 log.info(result)427 assert result428 sercof.input_key2("key2")429 sercof.input_value2("value2")430 # sercof.click_contentdel(1)431 # sercof.click_ButtoNo(0)432 sercof.click_contentdel(1)433 sercof.click_ButtonYes(0)434 sercof.click_Menu('æ·»å ä¸è¡æ°æ®')435 result = re.search(r'å é¤', sercof.get_source)436 log.info(result)437 assert result438 sercof.input_key2("key2")439 sercof.input_value2("value2")440 sercof.click_Define()441 result = re.search(r'value2', sercof.get_source)442 log.info(result)443 assert result444 sercof.click_del(0)445 sercof.click_del(0)446 result = re.search(r'å é¤æå', sercof.get_source)447 log.info(result)448 assert result449 @allure.story("ç¼è¾é
ç½®Global")450 def test_007(self, drivers):451 """ç¼è¾é
ç½®Global"""452 # æ°å»ºé
ç½®453 sercof = ServiceConfig(drivers)454 sercof.click_add(0)455 result = re.search(r'data.prop', sercof.get_source)456 log.info(result)457 assert result458 sercof.click_Menu('service')459 result = re.search(r'æå¡å', sercof.get_source)460 log.info(result)461 assert result462 sercof.input_servicename('service1')463 sercof.input_key1("key1")464 sercof.input_value1('value1')465 sercof.click_Define()466 result = re.search(r'service1', sercof.get_source)467 log.info(result)468 assert result469 # ç¼è¾é
ç½®470 sercof.click_edit(0)471 sercof.input_value1('value2')472 sercof.click_Define()473 result = re.search(r'value2', sercof.get_source)474 log.info(result)475 assert result476 sercof.click_del(0)477 result = re.search(r'å é¤æå', sercof.get_source)478 log.info(result)479 assert result480 @allure.story("æå¡é
ç½®å·æ°")481 def test_008(self, drivers):482 """æå¡é
ç½®å·æ°"""483 # æ°å»ºé
ç½®484 sercof = ServiceConfig(drivers)485 sercof.click_refresh()486 result = re.search(r'anticon anticon-reload ant-tooltip-open', sercof.get_source)487 log.info(result)488 assert result489 @allure.story("æå¡é
ç½®æç´¢")490 def test_009(self, drivers):491 """æå¡é
ç½®æç´¢"""492 # æ°å»ºGlobalé
ç½®493 sercof = ServiceConfig(drivers)494 sercof.click_add(0)495 result = re.search(r'data.prop', sercof.get_source)496 log.info(result)497 assert result498 sercof.click_Menu('Global')499 sercof.input_key1("key1")500 sercof.input_value1('value1')501 sercof.click_Define()502 result = re.search(r'key1', sercof.get_source)503 log.info(result)504 assert result505 # æ°å»ºserviceé
ç½®506 sercof = ServiceConfig(drivers)507 sercof.click_add(0)508 result = re.search(r'data.prop', sercof.get_source)509 log.info(result)510 assert result511 sercof.click_Menu('service')512 result = re.search(r'æå¡å', sercof.get_source)513 log.info(result)514 assert result515 sercof.input_servicename('service1')516 sercof.input_key1("key2")517 sercof.input_value1('value2')518 sercof.click_Define()519 result = re.search(r'service1', sercof.get_source)520 log.info(result)521 assert result522 # keyæç´¢523 sercof.input_key("key1")524 sercof.click_search()525 result = re.search(r'key2', sercof.get_source)526 log.info(result)527 assert not result528 sercof.click_reset()529 sercof.input_key('key2')530 sercof.click_search()531 result = re.search(r'key1', sercof.get_source)532 log.info(result)533 assert not result534 sercof.click_reset()535 sercof.input_key('key3')536 sercof.click_search()537 result = re.search(r'key1', sercof.get_source)538 result2 = re.search(r'key2', sercof.get_source)539 log.info("{result} \n {result2}")540 assert not result and not result2541 sercof.click_reset()542 # æå¡å称æç´¢543 sercof.input_configType('global')544 sercof.click_search()545 result = re.search(r'service1', sercof.get_source)546 log.info(result)547 assert not result548 sercof.click_reset()549 sercof.input_configType('service1')550 sercof.click_search()551 result = re.search(r'global</td>', sercof.get_source)552 log.info(result)553 assert not result554 sercof.click_reset()555 sercof.input_configType('key3')556 sercof.click_search()557 result = re.search(r'global</td>', sercof.get_source)558 result2 = re.search(r'service1', sercof.get_source)559 log.info("{result} \n {result2}")560 assert not result and not result2561 sercof.click_reset()562 sercof.click_del(0)563 sercof.click_del(0)564 result = re.search(r'å é¤æå', sercof.get_source)565 log.info(result)566 assert result567@allure.feature("é
置管ç")568class TestConfigManage:569 @pytest.fixture(scope='session', autouse=auto)570 def open_devops(self, drivers):571 """æå¼courier"""572 login = LoginPage(drivers)573 login.get_url(ini.url)574 login.input_username_login('admin')575 login.input_password_login('password')576 login.click_login()577 login.click_Menu("æå¡ç½å
³")578 login.click_Menu("é
置管ç")579 @allure.story("ç¹å»é
置管ç")580 def test_001(self, drivers):581 """ç¹å»æå¡ç®¡ç"""582 confma = ConfigManage(drivers)583 # ç³»ç»runçæ¶åå¼å¯è¿ä¸æ¡ï¼å¦åæ æ³è·³è½¬é
置管ç584 confma.click_Menu("æå¡ç½å
³")585 confma.click_Menu('é
置管ç')586 confma.waite_element('éæº')587 result = re.search(r'è´è½½åè¡¡', confma.get_source)588 log.info(result)589 assert result590 @allure.story("è´è½½åè¡¡éæ©")591 def test_002(self, drivers):592 """è´è½½åè¡¡éæ©"""593 confma = ConfigManage(drivers)594 confma.click_Menu('è´è½½åè¡¡')595 result = re.search(r'éæº', confma.get_source)596 log.info(result)597 assert result598 confma.click_Menu("轮询")599 confma.click_Canle()600 confma.click_Menu("轮询")601 confma.click_close()602 confma.click_Menu("轮询")603 confma.click_Define()604 confma.click_Menu("ä¸è´æ§åå¸")605 confma.click_Canle()606 confma.click_Menu("ä¸è´æ§åå¸")607 confma.click_close()608 confma.click_Menu("ä¸è´æ§åå¸")609 confma.click_Define()610 confma.click_Menu("æå°è¿æ¥æ°")611 confma.click_Canle()612 confma.click_Menu("æå°è¿æ¥æ°")613 confma.click_close()614 confma.click_Menu("æå°è¿æ¥æ°")615 confma.click_Define()616 confma.click_Menu("éæº")617 confma.click_Canle()618 confma.click_Menu("éæº")619 confma.click_close()620 confma.click_Menu("éæº")621 confma.click_Define()622 @allure.story("æå¡çæ")623 def test_003(self, drivers):624 """æå¡çææµè¯"""625 confma = ConfigManage(drivers)626 confma.click_Menu('æå¡çæ')627 result = re.search(r'æå¡çæé»è®¤éå¼', confma.get_source)628 log.info(result)629 assert result630 # æå¡çæå¼å
³631 confma.click_switch(0)632 result = re.search(r'aria-checked="true"', confma.get_source)633 log.info(result)634 assert result635 confma.click_switch(0)636 result = re.search(r'aria-checked="false"', confma.get_source)637 log.info(result)638 assert result639 # æå¡é»è®¤éå¼640 confma.click_DefaultEdit()641 confma.input_box('')642 confma.click_Tick()643 result = re.search(r'æå¡çæé»è®¤éå¼ä¸è½ä¸ºç©º', confma.get_source)644 log.info(result)645 assert result646 confma.input_box('0')647 confma.click_Tick()648 result = re.search(r'å¼ä¸è½å°äº1', confma.get_source)649 log.info(result)650 assert result651 confma.input_box('101')652 confma.click_Tick()653 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)654 log.info(result)655 assert result656 confma.input_box('6')657 confma.click_fork()658 confma.click_DefaultEdit()659 confma.input_box('11')660 confma.click_Tick()661 result = re.search(r'æä½æå', confma.get_source)662 log.info(result)663 assert result664 # çæéå¼665 confma.click_list(0)666 confma.input_box('')667 confma.click_Tick()668 result = re.search(r'æä½æå', confma.get_source)669 log.info(result)670 assert result671 confma.click_list(0)672 confma.input_box('0')673 confma.click_Tick()674 result = re.search(r'å¼ä¸è½å°äº1', confma.get_source)675 log.info(result)676 assert result677 confma.input_box('101')678 confma.click_Tick()679 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)680 log.info(result)681 assert result682 confma.click_fork()683 sleep()684 confma.click_list(0)685 confma.input_box('6')686 confma.click_fork()687 confma.click_list(0)688 confma.input_box('13')689 confma.click_Tick()690 result = re.search(r'<span>13</span>', confma.get_source)691 log.info(result)692 assert result693 @allure.story("æµéæ§å¶")694 def test_004(self, drivers):695 """æµéæ§å¶æµè¯"""696 confma = ConfigManage(drivers)697 confma.click_Menu('æµéæ§å¶')698 result = re.search(r'æµéæ§å¶é»è®¤ç½é', confma.get_source)699 log.info(result)700 assert result701 # æµéæ§å¶å¼å
³702 confma.click_switch(0)703 result = re.search(r'aria-checked="true"', confma.get_source)704 log.info(result)705 assert result706 confma.click_switch(0)707 result = re.search(r'aria-checked="false"', confma.get_source)708 log.info(result)709 assert result710 # æµéæ§å¶é»è®¤ç½é711 confma.click_DefaultEdit()712 confma.input_box('-1')713 confma.click_Tick()714 result = re.search(r'å¼ä¸è½å°äº0', confma.get_source)715 log.info(result)716 assert result717 confma.input_box('101')718 confma.click_Tick()719 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)720 log.info(result)721 assert result722 confma.input_box('6')723 confma.click_fork()724 confma.click_DefaultEdit()725 confma.input_box('11')726 confma.click_Tick()727 result = re.search(r'æä½æå', confma.get_source)728 log.info(result)729 assert result730 # æµéæé731 confma.click_list(0)732 confma.input_box('-1')733 confma.click_Tick()734 result = re.search(r'å¼ä¸è½å°äº0', confma.get_source)735 log.info(result)736 assert result737 confma.input_box('0.1')738 confma.click_Tick()739 result = re.search(r'åªè½è¾å
¥æ´æ°', confma.get_source)740 log.info(result)741 assert result742 confma.input_box('101')743 confma.click_Tick()744 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)745 log.info(result)746 assert result747 confma.click_fork()748 sleep()749 confma.click_list(0)750 confma.input_box('6')751 confma.click_fork()752 confma.click_list(0)753 confma.input_box('13')754 confma.click_Tick()755 result = re.search(r'<span>13</span>', confma.get_source)756 log.info(result)757 assert result758 @allure.story("æå¡è´¨é")759 def test_005(self, drivers):760 """æå¡è´¨éæµè¯"""761 confma = ConfigManage(drivers)762 confma.click_Menu('æå¡è´¨é')763 result = re.search(r'ä¿çå¼', confma.get_source)764 log.info(result)765 assert result766 # æå¡è´¨éå¼å
³767 confma.click_switch(0)768 result = re.search(r'aria-checked="true"', confma.get_source)769 log.info(result)770 assert result771 confma.click_switch(0)772 result = re.search(r'aria-checked="false"', confma.get_source)773 log.info(result)774 assert result775 # æå¡è´¨éæä½ä¿çå¼776 confma.click_list(0)777 confma.input_retain('-1')778 confma.click_Tick()779 result = re.search(r'å¼ä¸è½å°äº0', confma.get_source)780 log.info(result)781 assert result782 confma.input_retain('0.1')783 confma.click_Tick()784 result = re.search(r'åªè½è¾å
¥æ´æ°', confma.get_source)785 log.info(result)786 assert result787 confma.input_retain('101')788 confma.click_Tick()789 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)790 log.info(result)791 assert result792 confma.input_retain('22')793 confma.click_Tick()794 result = re.search(r'<span>22</span>', confma.get_source)795 log.info(result)796 assert result797 # æå¡è´¨éæä½ä¿çå¼798 confma.click_list(0)799 confma.input_upper('-1')800 confma.click_Tick()801 result = re.search(r'å¼ä¸è½å°äº0', confma.get_source)802 log.info(result)803 assert result804 confma.input_upper('0.1')805 confma.click_Tick()806 result = re.search(r'åªè½è¾å
¥æ´æ°', confma.get_source)807 log.info(result)808 assert result809 confma.input_upper('101')810 confma.click_Tick()811 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)812 log.info(result)813 assert result814 confma.input_upper('23')815 confma.click_Tick()816 result = re.search(r'<span>23</span>', confma.get_source)817 log.info(result)818 assert result819 # æå¡è´¨éæä½æé820 confma.click_list(0)821 confma.input_weight('-1')822 confma.click_Tick()823 result = re.search(r'å¼ä¸è½å°äº0', confma.get_source)824 log.info(result)825 assert result826 confma.input_weight('0.1')827 confma.click_Tick()828 result = re.search(r'åªè½è¾å
¥æ´æ°', confma.get_source)829 log.info(result)830 assert result831 confma.input_weight('101')832 confma.click_Tick()833 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)834 log.info(result)835 assert result836 confma.input_weight('24')837 confma.click_Tick()838 result = re.search(r'<span>24</span>', confma.get_source)839 log.info(result)840 assert result841 # æå¡è´¨éä¸èµ·æä½842 confma.click_list(0)843 confma.input_retain('')844 confma.input_upper('')845 confma.input_weight('')846 confma.click_Tick()847 result = re.search(r'æä½æå', confma.get_source)848 log.info(result)849 assert result850 confma.click_list(0)851 confma.input_retain('66')852 confma.input_upper('77')853 confma.input_weight('88')854 confma.click_fork()855 confma.click_ButtoNo(0)856 sleep()857 confma.click_fork()858 sleep()859 confma.click_ButtonYes(0)860 result = re.search(r'<span>66</span>', confma.get_source)861 log.info(result)862 assert not result863 confma.click_list(0)864 confma.input_retain('66')865 confma.input_upper('77')866 confma.input_weight('88')867 confma.click_Tick()868 result = re.search(r'<span>66</span>', confma.get_source)869 log.info(result)870 assert result871 @allure.story("æå¡é级")872 def test_006(self, drivers):873 """æå¡è´¨éæµè¯"""874 confma = ConfigManage(drivers)875 confma.click_Menu('æå¡é级')876 result = re.search(r'æå¡é级é»è®¤éå¼', confma.get_source)877 log.info(result)878 assert result879 # æå¡è´¨éå¼å
³880 confma.click_switch(0)881 result = re.search(r'aria-checked="true"', confma.get_source)882 log.info(result)883 assert result884 confma.click_switch(0)885 result = re.search(r'aria-checked="false"', confma.get_source)886 log.info(result)887 assert result888 # æå¡é级é»è®¤éå¼889 confma.click_DefaultEdit()890 confma.input_box('0')891 confma.click_Tick()892 result = re.search(r'å¼ä¸è½å°äº1', confma.get_source)893 log.info(result)894 assert result895 confma.input_box('101')896 confma.click_Tick()897 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)898 log.info(result)899 assert result900 confma.input_box('6')901 confma.click_fork()902 confma.click_DefaultEdit()903 confma.input_box('26')904 confma.click_Tick()905 result = re.search(r'æä½æå', confma.get_source)906 log.info(result)907 assert result908 # æå¡é级éå¼909 confma.click_list(0)910 confma.input_box('0')911 confma.click_Tick()912 result = re.search(r'å¼ä¸è½å°äº1', confma.get_source)913 log.info(result)914 assert result915 confma.input_box('0.1')916 confma.click_Tick()917 result = re.search(r'åªè½è¾å
¥æ´æ°', confma.get_source)918 log.info(result)919 assert result920 confma.input_box('101')921 confma.click_Tick()922 result = re.search(r'å¼ä¸è½å¤§äº100', confma.get_source)923 log.info(result)924 assert result925 confma.input_box('25')926 confma.click_fork()927 result = re.search(r'<span>25</span>', confma.get_source)928 log.info(result)929 assert not result930 confma.click_list(0)931 confma.input_box('26')932 confma.click_Tick()933 result = re.search(r'<span>26</span>', confma.get_source)934 log.info(result)935 assert result936 # é级æå¡937 confma.click_DegradServList(0)938 result = re.search(r'ant-select ant-select-focused ant-select-single ant-select-show-arrow ant-select-open', confma.get_source)939 log.info(result)940 assert result941 confma.click_DegradServ(0)942 result = re.search(r'æä½æå', confma.get_source) # å¦æä¹åå°±éä¸äºç¬¬ä¸ä¸ªå
ç´ ï¼è¿éä¸ä¼åºç°æä½æåæé®ï¼ä¼æ¥é943 log.info(result)944 assert result945 # æåéä¸ç©ºç½å
ç´ ï¼å°ç¯å¢è¿å946 confma.click_DegradServList(0)947 confma.click_DegradServEnd()948 result = re.search(r'æä½æå', confma.get_source)949 log.info(result)950 assert result951@allure.feature("é»ç½åå")952class TestBlacklist:953 @pytest.fixture(scope='session', autouse=auto)954 def open_devops(self, drivers):955 """æå¼courier"""956 login = LoginPage(drivers)957 login.get_url(ini.url)958 login.input_username_login('admin')959 login.input_password_login('password')960 login.click_login()961 login.click_Menu("æå¡ç½å
³")962 login.click_Menu("é»ç½åå")963 @allure.story("ç¹å»é»ç½åå")964 def test_001(self, drivers):965 """ç¹å»é»ç½åå"""966 blackli = Blacklist(drivers)967 blackli.click_Menu('é»ç½åå')968 blackli.waite_element('ç½åå管ç')969 result = re.search(r'IPå°å', blackli.get_source)970 log.info(result)971 assert result972 @allure.story("ç½ååæ·»å ")973 def test_002(self, drivers):974 """ç½ååæ·»å æµè¯"""975 blackli = Blacklist(drivers)976 blackli.click_Menu('ç½åå管ç')977 blackli.click_add(0)978 result = re.search(r'æ·»å ç½åå', blackli.get_source)979 log.info(result)980 assert result981 blackli.click_Define()982 result = re.search(r'请è¾å
¥æ£ç¡®çIPå°å', blackli.get_source)983 log.info(result)984 assert result985 blackli.input_ip('1234')986 blackli.click_Define()987 result = re.search(r'请è¾å
¥æ£ç¡®çIPå°å', blackli.get_source)988 log.info(result)989 assert result990 blackli.input_ip('10.0.2.3')991 blackli.click_Canle()992 blackli.click_add(0)993 blackli.input_ip('10.0.2.3')994 blackli.click_close()995 blackli.click_add(0)996 blackli.input_ip('10.0.2.4')997 blackli.click_Define()998 result = re.search(r'10.0.2.4', blackli.get_source)999 log.info(result)1000 assert result1001 @allure.story("ç½ååå·æ°")1002 def test_003(self, drivers):1003 """ç½ååå·æ°æµè¯"""1004 blackli = Blacklist(drivers)1005 blackli.click_refresh()1006 result = re.search(r'anticon anticon-reload ant-tooltip-open', blackli.get_source)1007 log.info(result)1008 assert result1009 @allure.story("ç½ååç¼è¾")1010 def test_004(self, drivers):1011 """ç½ååç¼è¾æµè¯"""1012 blackli = Blacklist(drivers)1013 blackli.click_edit(0)1014 blackli.input_ip('')1015 blackli.click_Define()1016 blackli.input_ip('4.3.2.1')1017 blackli.click_Define()1018 result = re.search(r'4.3.2.1', blackli.get_source)1019 log.info(result)1020 assert result1021 @allure.story("ç½ååå é¤")1022 def test_005(self, drivers):1023 """ç½ååå é¤æµè¯"""1024 blackli = Blacklist(drivers)1025 # blackli.click_gatedel(0)1026 # blackli.click_ButtoNo(0)1027 blackli.click_gatedel(0)1028 blackli.click_ButtonYes(0)1029 result = re.search(r'å é¤æå', blackli.get_source)1030 log.info(result)1031 assert result1032 @allure.story("é»ååæ·»å ")1033 def test_006(self, drivers):1034 """é»ååæ·»å æµè¯"""1035 blackli = Blacklist(drivers)1036 blackli.click_Menu('é»åå管ç')1037 blackli.click_add(1)1038 result = re.search(r'æ·»å é»åå', blackli.get_source)1039 log.info(result)1040 assert result1041 blackli.click_Define()1042 result = re.search(r'请è¾å
¥æ£ç¡®çIPå°å', blackli.get_source)1043 log.info(result)1044 assert result1045 blackli.input_ip('1234')1046 blackli.click_Define()1047 result = re.search(r'请è¾å
¥æ£ç¡®çIPå°å', blackli.get_source)1048 log.info(result)1049 assert result1050 blackli.input_ip('10.0.2.4')1051 blackli.click_Canle()1052 blackli.click_add(1)1053 blackli.input_ip('10.0.2.4')1054 blackli.click_close()1055 blackli.click_add(1)1056 blackli.input_ip('10.0.2.5')1057 blackli.click_Define()1058 result = re.search(r'10.0.2.5', blackli.get_source)1059 log.info(result)1060 assert result1061 @allure.story("é»ååç¼è¾")1062 def test_007(self, drivers):1063 """é»ååç¼è¾æµè¯"""1064 blackli = Blacklist(drivers)1065 blackli.click_edit(0)1066 blackli.input_ip('')1067 blackli.click_Define()1068 blackli.input_ip('4.3.2.1')1069 blackli.click_Define()1070 result = re.search(r'4.3.2.1', blackli.get_source)1071 log.info(result)1072 assert result1073 @allure.story("é»ååå é¤")1074 def test_008(self, drivers):1075 """é»ååå é¤æµè¯"""1076 blackli = Blacklist(drivers)1077 # blackli.click_gatedel(0)1078 # blackli.click_ButtoNo(0)1079 blackli.click_gatedel(0)1080 blackli.click_ButtonYes(0)1081 result = re.search(r'å é¤æå', blackli.get_source)1082 log.info(result)1083 assert result1084@allure.feature("å°çä½ç½®")1085class TestLocation:1086 @pytest.fixture(scope='session', autouse=auto)1087 def open_devops(self, drivers):1088 """æå¼courier"""1089 login = LoginPage(drivers)1090 login.get_url(ini.url)1091 login.input_username_login('admin')1092 login.input_password_login('password')1093 login.click_login()1094 login.click_Menu("æå¡ç½å
³")1095 login.click_Menu("å°çä½ç½®")1096 @allure.story("ç¹å»å°çä½ç½®")1097 def test_001(self, drivers):1098 """ç¹å»å°çä½ç½®"""1099 local = Location(drivers)1100 local.click_Menu('å°çä½ç½®')1101 local.waite_element('å¼å
³æé®')1102 result = re.search(r'åºåç»çº¬åº¦', local.get_source)1103 log.info(result)1104 assert result1105 @allure.story("å°çä½ç½®å¯ç¨å¼å
³")1106 def test_002(self, drivers):1107 """å°çä½ç½®å¯ç¨å¼å
³æµè¯"""1108 local = Location(drivers)1109 local.click_switch(0)1110 sleep()1111 result = re.search(r'aria-checked="true"', local.get_source)1112 log.info(result)1113 assert result1114 local.click_switch(0)1115 result = re.search(r'aria-checked="false"', local.get_source)1116 log.info(result)1117 assert result1118 @allure.story("å°çä½ç½®æ·»å ")1119 def test_003(self, drivers):1120 """å°çä½ç½®æ·»å æµè¯"""1121 local = Location(drivers)1122 local.click_add(0)1123 result = re.search(r'æ·»å å°çä½ç½®', local.get_source)1124 log.info(result)1125 assert result1126 local.click_Define()1127 result = re.search(r'请è¾å
¥åºååå¾', local.get_source)1128 log.info(result)1129 assert result1130 # æ°å¢æ¡åæ¶ä¸å
³é1131 local.input_locationame("åºå1")1132 local.input_longtitude("12.3")1133 local.input_latitude('31.5')1134 local.input_radius('13.6')1135 local.click_Canle()1136 result = re.search(r'<span>[12.3, 31.5]', local.get_source)1137 log.info(result)1138 assert not result1139 local.click_add(0)1140 local.input_locationame("åºå1")1141 local.input_longtitude("12.3")1142 local.input_latitude('31.6')1143 local.input_radius('13.6')1144 local.click_close()1145 result = re.search(r'<span>[12.3, 31.6]', local.get_source)1146 log.info(result)1147 assert not result1148 local.click_add(0)1149 local.input_locationame("åºå1")1150 local.input_longtitude("22.3")1151 local.input_latitude('33.5')1152 local.input_radius('15')1153 local.click_Define()1154 result = re.search(r'<span>[22.3, 33.5]', local.get_source)1155 log.info(result)1156 assert not result1157 @allure.story("å°çä½ç½®å·æ°")1158 def test_004(self, drivers):1159 """å°çä½ç½®å·æ°æµè¯"""1160 local = Location(drivers)1161 local.click_refresh()1162 result = re.search(r'anticon anticon-reload ant-tooltip-open', local.get_source)1163 log.info(result)1164 assert result1165 @allure.story("å°çä½ç½®å±ç¤ºæ°éä¸ææ¡")1166 def test_005(self, drivers):1167 """å°çä½ç½®å±ç¤ºæ°éä¸ææ¡æµè¯"""1168 local = Location(drivers)1169 local.click_Menu('ä¸æå±ç¤ºæ¡')1170 local.click_Menu('10æ¡')1171 result = re.search(r'<span.*?10 æ¡/页', local.get_source)1172 log.info(result)1173 assert result1174 local.click_Menu('ä¸æå±ç¤ºæ¡')1175 local.click_Menu('20æ¡')1176 result = re.search(r'<span.*?20 æ¡/页', local.get_source)1177 log.info(result)1178 assert result1179 local.click_Menu('ä¸æå±ç¤ºæ¡')1180 local.click_Menu('50æ¡')1181 result = re.search(r'<span.*?50 æ¡/页', local.get_source)1182 log.info(result)1183 assert result1184 local.click_Menu('ä¸æå±ç¤ºæ¡')1185 local.click_Menu('100æ¡')1186 result = re.search(r'<span.*?100 æ¡/页', local.get_source)1187 log.info(result)1188 assert result1189 @allure.story("å°çä½ç½®å¼å¯å¼ºå¶å·æ°")1190 def test_006(self, drivers):1191 """å°çä½ç½®å·æ°æµè¯"""1192 local = Location(drivers)1193 local.click_switch(1)1194 result = re.search(r'æ´æ¹æå', local.get_source)1195 log.info(result)1196 assert result1197 local.click_switch(1)1198 result = re.search(r'æ´æ¹æå', local.get_source)1199 log.info(result)1200 assert result1201 @allure.story("å°çä½ç½®ç¼è¾")1202 def test_007(self, drivers):1203 """å°çä½ç½®ç¼è¾æµè¯"""1204 local = Location(drivers)1205 local.click_edit(0)1206 result = re.search(r'ç¼è¾å°çä½ç½®', local.get_source)1207 log.info(result)1208 assert result1209 try:1210 local.input_locationame("åºå2")1211 except Exception as e:1212 log.info(f"æ¥éï¼{e}, \nç¼è¾æ¶ï¼åºååæ æ³ç¹å»")1213 local.input_longtitude("3")1214 local.input_latitude('4')1215 local.input_radius('5')1216 local.click_Define()1217 result = re.search(r'ç¼è¾æå', local.get_source)1218 log.info(result)1219 assert result1220 @allure.story("å°çä½ç½®å é¤")1221 def test_008(self, drivers):1222 """å°çä½ç½®å é¤æµè¯"""1223 local = Location(drivers)1224 local.click_gatedel(0)1225 # sleep()1226 # local.click_ButtoNo(0)1227 # local.click_gatedel(0)1228 # sleep(2)1229 local.click_ButtonYes(0)1230 result = re.search(r'å é¤æå', local.get_source)1231 log.info(result)1232 assert result1233@allure.feature("æ¡ä»¶è¡¨è¾¾å¼")1234class TestConditional:1235 @pytest.fixture(scope='session', autouse=auto)1236 def open_devops(self, drivers):1237 """æå¼courier"""1238 login = LoginPage(drivers)1239 login.get_url(ini.url)1240 login.input_username_login('admin')1241 login.input_password_login('password')1242 login.click_login()1243 login.click_Menu("æå¡ç½å
³")1244 login.click_Menu("æ¡ä»¶è¡¨è¾¾å¼")1245 @allure.story("ç¹å»æ¡ä»¶è¡¨è¾¾å¼")1246 def test_001(self, drivers):1247 """ç¹å»å°çä½ç½®"""1248 condit = Location(drivers)1249 condit.click_Menu('æ¡ä»¶è¡¨è¾¾å¼')1250 condit.waite_element('æå¡åè¾å
¥')1251 result = re.search(r'å¼å¯', condit.get_source)1252 log.info(result)1253 assert result1254 @allure.story("æ·»å æ¡ä»¶è¡¨è¾¾å¼åæ¶éåº")1255 def test_002(self, drivers):1256 """æ·»å æ¡ä»¶è¡¨è¾¾å¼æµè¯"""1257 # æ·»å æ¡åæ¶éåº1258 condit = Conditional(drivers)1259 condit.click_add(0)1260 condit.click_Define()1261 result = re.search(r'请è¾å
¥æå¡å', condit.get_source)1262 log.info(result)1263 assert result1264 condit.input_servicename(num=1, content='æå¡å1')1265 condit.click_Menu('force')1266 result = re.search(r'<button id="force.*?aria-checked="true"', condit.get_source)1267 log.info(result)1268 assert result1269 condit.click_Menu('force')1270 condit.click_Menu('enabled')1271 result = re.search(r'<button id="enabled.*?aria-checked="true"', condit.get_source)1272 log.info(result)1273 assert result1274 condit.click_Menu('enabled')1275 condit.click_Canle()1276 condit.click_add(0)1277 condit.click_close()1278 @allure.story("æ·»å æ¡ä»¶è¡¨è¾¾å¼")1279 def test_003(self, drivers):1280 """æ·»å æ¡ä»¶è¡¨è¾¾å¼æµè¯"""1281 # æ·»å æ¡è¾å
¥1282 condit = Conditional(drivers)1283 condit.click_add(0)1284 condit.input_servicename(num=1, content='æå¡å1')1285 condit.click_Menu('force')1286 condit.click_Menu('enabled')1287 # tag11288 condit.input_tagname1('æ ç¾å称1')1289 condit.input_address1("10.0.1.1")1290 condit.click_address(0)1291 result = re.search(r'tags_0_address_1', condit.get_source)1292 log.info(result)1293 assert result1294 condit.input_address2("10.0.1.2")1295 result = re.search(r'10.0.1.2', condit.get_source)1296 log.info(result)1297 assert result1298 # tag21299 condit.click_Menu('æ·»å tag')1300 condit.input_tagname2('æ ç¾å称2')1301 condit.input_2address1("10.0.2.1")1302 condit.click_address(1)1303 result = re.search(r'tags_1_address_1', condit.get_source)1304 log.info(result)1305 assert result1306 condit.input_2address2("10.0.2.2")1307 result = re.search(r'10.0.2.2', condit.get_source)1308 log.info(result)1309 assert result1310 condit.click_Define()1311 result = re.search(r'æå¡å1', condit.get_source)1312 log.info(result)1313 assert result1314 @allure.story("æ¡ä»¶è¡¨è¾¾å¼æç´¢")1315 def test_004(self, drivers):1316 """æ¡ä»¶è¡¨è¾¾å¼æç´¢æµè¯"""1317 # æ°å»ºä¸¤ä¸ªæå¡1318 condit = Conditional(drivers)1319 condit.click_add(0)1320 condit.input_servicename(num=1, content='æå¡å2')1321 condit.input_tagname1('æ ç¾å称2')1322 condit.input_address1("10.0.1.2")1323 condit.click_Define()1324 result = re.search(r'æå¡å2', condit.get_source)1325 log.info(result)1326 assert result1327 condit.click_add(0)1328 condit.input_servicename(num=1, content='æå¡å3')1329 condit.input_tagname1('æ ç¾å称3')1330 condit.input_address1("10.0.1.3")1331 condit.click_Define()1332 result = re.search(r'æå¡å3', condit.get_source)1333 log.info(result)1334 assert result1335 # æç´¢æå¡å21336 condit.input_servicename(num=0, content='æå¡å2')1337 condit.click_search()1338 result = re.search(r'æå¡å3', condit.get_source)1339 log.info(result)1340 assert not result1341 condit.click_gatedel(0)1342 condit.click_ButtonYes(0)1343 condit.click_reset()1344 result = re.search(r'æå¡å2', condit.get_source)1345 log.info(result)1346 assert not result1347 # æç´¢æå¡å31348 condit.input_servicename(num=0, content='æå¡å3')1349 condit.click_search()1350 result = re.search(r'æå¡å3', condit.get_source)1351 log.info(result)1352 assert result1353 condit.click_gatedel(0)1354 condit.click_ButtonYes(0)1355 condit.click_reset()1356 result = re.search(r'æå¡å3', condit.get_source)1357 log.info(result)1358 assert not result1359 @allure.story("æ¡ä»¶è¡¨è¾¾å¼å·æ°")1360 def test_005(self, drivers):1361 """æ¡ä»¶è¡¨è¾¾å¼å·æ°æµè¯"""1362 condit = Conditional(drivers)1363 condit.click_refresh()1364 result = re.search(r'anticon anticon-reload ant-tooltip-open', condit.get_source)1365 log.info(result)1366 assert result1367 @allure.story("æ¡ä»¶è¡¨è¾¾å¼å±ç¤ºæ°éä¸ææ¡")1368 def test_006(self, drivers):1369 """æ¡ä»¶è¡¨è¾¾å¼å·æ°æµè¯"""1370 condit = Conditional(drivers)1371 condit.click_Menu('ä¸æå±ç¤ºæ¡')1372 condit.click_Menu('10æ¡')1373 result = re.search(r'<span.*?10 æ¡/页', condit.get_source)1374 log.info(result)1375 assert result1376 condit.click_Menu('ä¸æå±ç¤ºæ¡')1377 condit.click_Menu('20æ¡')1378 result = re.search(r'<span.*?20 æ¡/页', condit.get_source)1379 log.info(result)1380 assert result1381 condit.click_Menu('ä¸æå±ç¤ºæ¡')1382 condit.click_Menu('50æ¡')1383 result = re.search(r'<span.*?50 æ¡/页', condit.get_source)1384 log.info(result)1385 assert result1386 condit.click_Menu('ä¸æå±ç¤ºæ¡')1387 condit.click_Menu('100æ¡')1388 result = re.search(r'<span.*?100 æ¡/页', condit.get_source)1389 log.info(result)1390 assert result1391 @allure.story("æ¡ä»¶è¡¨è¾¾å¼è¯¦æ
")1392 def test_007(self, drivers):1393 """æ¡ä»¶è¡¨è¾¾å¼å·æ°æµè¯"""1394 condit = Conditional(drivers)1395 condit.click_details(0)1396 result = re.search(r'æ¡ä»¶è¡¨è¾¾å¼è¯¦æ
', condit.get_source)1397 log.info(result)1398 assert result1399 condit.click_close()1400 condit.click_details(0)1401 condit.click_Canle()1402 result = re.search(r'æ¡ä»¶è¡¨è¾¾å¼è¯¦æ
', condit.get_source)1403 log.info(result)1404 assert not result1405 @allure.story("æ¡ä»¶è¡¨è¾¾å¼ç¼è¾")1406 def test_008(self, drivers):1407 """æ¡ä»¶è¡¨è¾¾å¼ç¼è¾æµè¯"""1408 condit = Conditional(drivers)1409 condit.click_edit(0)1410 result = re.search(r'ç¼è¾æ¡ä»¶è¡¨è¾¾å¼', condit.get_source)1411 log.info(result)1412 assert result1413 condit.input_tagname1("newæ ç¾")1414 condit.input_address1("10.0.1.5")1415 condit.click_Define()1416 result = re.search(r'ç¼è¾æå', condit.get_source)1417 log.info(result)1418 assert result1419 @allure.story("æ¡ä»¶è¡¨è¾¾å¼å¼å¯å
³é")1420 def test_009(self, drivers):1421 """æ¡ä»¶è¡¨è¾¾å¼å¼å¯å
³éæµè¯"""1422 condit = Conditional(drivers)1423 # å
³é1424 condit.click_shut(0)1425 # sleep()1426 # condit.click_ButtoNo(0)1427 # condit.click_shut(0)1428 # sleep(2)1429 sleep()1430 condit.click_ButtonYes(0)1431 result = re.search(r'æ´æ¹æå', condit.get_source)1432 log.info(result)1433 assert result1434 #å¼å¯1435 condit.click_opens(0)1436 # sleep()1437 # condit.click_ButtoNo(0)1438 # condit.click_opens(0)1439 # sleep(2)1440 sleep()1441 condit.click_ButtonYes(0)1442 result = re.search(r'æ´æ¹æå', condit.get_source)1443 log.info(result)1444 assert result1445 @allure.story("æ¡ä»¶è¡¨è¾¾å¼å é¤")1446 def test_010(self, drivers):1447 """æ¡ä»¶è¡¨è¾¾å¼å é¤æµè¯"""1448 condit = Conditional(drivers)1449 condit.click_gatedel(0)1450 # å½å
¨é¨æ§è¡æ¶ï¼ä¸ä¸ªç¨ä¾æä½åï¼é¡µé¢å
ç´ ä¸ä¼å¤ä¸ä¸ªéå¤å
ç´ ï¼è¿æ¶æ¹ä¸º11451 # condit.click_ButtoNo(1)1452 # condit.click_gatedel(0)1453 # åç¬æ§è¡è¯¥ç¨ä¾æ¶ï¼åæ°ä¸º 01454 # condit.click_ButtoNo(0)1455 # condit.click_gatedel(0)1456 # condit.click_ButtonYes(0)1457 condit.click_ButtonYes(1)1458 result = re.search(r'å é¤æå', condit.get_source)1459 log.info(result)1460 assert result1461@allure.feature("ææ ç»è®¡")1462class TestStatistics:1463 @pytest.fixture(scope='session', autouse=auto)1464 def open_devops(self, drivers):1465 """æå¼courier"""1466 login = LoginPage(drivers)1467 login.get_url(ini.url)1468 login.input_username_login('admin')1469 login.input_password_login('password')1470 login.click_login()1471 login.click_Menu("ææ ç»è®¡")1472 @allure.story("ç¹å»ææ ç»è®¡")1473 def test_001(self, drivers):1474 """ç¹å»ææ ç»è®¡"""1475 stati = Statistics(drivers)1476 stati.click_Menu('ææ ç»è®¡')1477 stati.waite_element('端å£')1478 result = re.search(r'æå次æ°', stati.get_source)1479 log.info(result)1480 assert result1481 @allure.story("ææ ç»è®¡æç´¢")1482 def test_002(self, drivers):1483 """ç¹å»ææ ç»è®¡"""1484 stati = Statistics(drivers)1485 stati.click_search()1486 result = re.search(r'请è¾å
¥IP', stati.get_source)1487 log.info(result)1488 assert result1489 # æç´¢1490 stati.input_ip('192.168.31.10')1491 stati.click_search()1492 result = re.search(r'请è¾å
¥ç«¯å£å·', stati.get_source)1493 log.info(result)1494 assert result1495 stati.input_port('1523')1496 stati.click_search()1497 result = re.search(r'请è¾å
¥æå¡å', stati.get_source)1498 log.info(result)1499 assert result1500 stati.input_serviceName('conditionservice')1501 stati.click_search()1502 result = re.search(r'请è¾å
¥æå¡å', stati.get_source)1503 log.info(result)1504 assert not result1505 #éç½®1506 stati.click_reset()1507 result = re.search(r'192.168.31.10', stati.get_source)1508 log.info(result)1509 assert not result1510 @allure.story("ææ ç»è®¡å·æ°")1511 def test_003(self, drivers):1512 """ææ ç»è®¡å·æ°æµè¯"""1513 stati = Statistics(drivers)1514 stati.click_refresh()1515 result = re.search(r'anticon anticon-reload ant-tooltip-open', stati.get_source)1516 log.info(result)1517 assert result1518if __name__ == '__main__':1519 pytest.main(['TestCase/test_courier_login.py', '-sv'])1520# if __name__ == '__main__':1521# ä¸é¢ç代ç 使ç¨pycharmè¿è¡å¯è½ä¼æ²¡æçææ¥åï¼å»ºè®®ä½¿ç¨vscodeæ§è¡1522# import os1523# pytest.main(['TestCase/test_search.py', '--alluredir', './allure'])...
py2php.py
Source:py2php.py
...37 # node body of the module, a <tt class="class">Stmt</tt>38 self.src += '<?php\n' 39 if t.doc:40 self.src += self.comment_start + t.doc + self.comment_end41 self.src += get_source(t.getChildNodes()[0])42 self.src += '?>'43 44 def visitStmt(self,node):45 #print '***stmt nodes****',len(node.nodes), node.nodes46 self.src += '\n'.join( [ get_source(n) for n in node.nodes ]) + '\n'47 def visitClass(self, node):48 # Class attributes49 # name the name of the class, a string50 # bases a list of base classes51 # doc doc string, a string or <code>None</code>52 # code the body of the class statement53 global current_class_name, is_parsing_class54 is_parsing_class = True # important, must be in the beginning !55 current_class_name = node.name56 if node.doc != None:57 self.src += self.comment_start + node.doc + self.comment_end58 self.src += 'class %s ' % node.name59 if len(node.bases) > 0:60 self.src += 'extends %s' % get_source( node.bases[0] )[1:] # php has no multiple inheritance61 self.src += ' {\n'62 self.src += get_source( node.code )63 self.src += '}\n'64 is_parsing_class = False # important, must be at the end!65 def visitFunction(self, node):66 # Function attributes67 # name name used in def, a string68 # argnames list of argument names, as strings69 # defaults list of default values70 # flags xxx71 # doc doc string, a string or <code>None</code>72 # code the body of the function73 global current_class_name, is_parsing_class74 if is_parsing_class: # if class method, delete the Python's self argument75 node.argnames = node.argnames[1:]76 if node.doc != None:77 self.src += self.comment_start + node.doc + self.comment_end78 if (PHPVERSION == 5 and 79 node.name == '__init__' and 80 is_parsing_class):81 node.name = '__construct'82 elif (PHPVERSION == 4 and83 node.name == '__init__' and84 is_parsing_class and85 current_class_name != ''):86 node.name = current_class_name87 self.src += 'function %s (' % node.name88 nb_defaults = len(node.defaults)89 if nb_defaults > 0 : # there are some default args90 simple_args = node.argnames[:len(node.argnames)-nb_defaults]91 assigned_args = node.argnames[len(node.argnames)-nb_defaults:]92 assg_args_w_vals = []93 j = 094 for assign in assigned_args:95 valu = get_source( node.defaults[j] )96 assg_args_w_vals.append( '%s = %s' % (assign,valu) )97 j+=198 self.src += ', '.join( ['$%s'%n for n in99 simple_args+assg_args_w_vals ])100 else: 101 self.src += ', '.join( '$%s'%n for n in node.argnames)102 self.src += ') {\n'103 self.src += get_source( node.code )104 self.src += '}\n'105 def visitGetattr(self, node):106 # Getattr attributes107 # expr 108 # attrname 109 self.src += get_source( node.expr ) + '->' + node.attrname110 111 def visitAssAttr(self, node):112 # AssAttr attributes113 # expr expression on the left-hand side of the dot114 # attrname the attribute name, a string115 # flags XXX116 self.src += get_source( node.expr ) + '->'117 self.src += node.attrname118 def visitDiscard(self, node):119 # Discard attributes120 # expr 121 if node.expr.__class__ is compiler.ast.Const :122 self.src += '/* ' + get_source( node.expr )[1:-1] + ' */'123 else:124 self.src += get_source( node.expr )125 def visitReturn(self, node):126 self.src += 'return '+get_source(node.value)127 def visitContinue(self, node):128 # Continue attributes129 self.src += 'continue'130 def visitBreak(self, node):131 # Break attributes132 self.src += 'break'133 def visitPrintnl(self, node):134 # Printnl attributes135 # nodes 136 # dest 137 # PHP print statement takes only one parameter so we take the first one :138 self.src += 'print '+ get_source( node.nodes[0] ) 139 def visitName(self, node):140 if node.name == 'self':141 self.src += '$this'142 elif node.name == 'False':143 self.src += 'false'144 elif node.name == 'True':145 self.src += 'true'146 elif node.name == 'None':147 self.src += 'null'148 elif re.match( '^[A-Z][_A-Z]*$', node.name ): # it's a constant if ALL CAPS149 self.src += node.name150 elif (node.name in self.magic_constants):151 self.src += node.name152 else:153 self.src += '$%s'%node.name154 def visitConst(self, node):155 # Const attributes156 # value 157 if type(node.value) is str:158 self.src += '"%s"' % node.value159 else:160 self.src += str(node.value)161 def visitMod(self, node):162 # Mod attributes163 # left 164 # right 165 left = get_source( node.left )166 if '%' in left and type(left) is str and left.startswith('"'):167 # sprintf168 self.src += 'sprintf(' + left + ', '169 if node.right.__class__ is compiler.ast.Tuple:170 self.src += ', '.join( [ get_source(n) for n in node.right ] )171 else:172 self.src += get_source(node.right)173 self.src += ')'174 else:175 # modulo normal176 self.src += '('+get_source( node.left ) + ' % ' + get_source(177 node.right )+')'178 pass179 def visitMul(self, node):180 # Mul attributes181 # left 182 # right 183 self.src += '('+get_source( node.left ) + ' * ' + get_source(184 node.right )+')'185 def visitDiv(self, node):186 # Div attributes187 # left 188 # right 189 self.src += '('+get_source( node.left ) + ' / ' + get_source(190 node.right )+')'191 def visitAdd(self, node):192 # Add attributes193 # left left operand194 # right right operand195 if ((node.left.__class__ is compiler.ast.Const and 196 type(node.left.getChildren()[0]) is str) or197 (node.right.__class__ is compiler.ast.Const and198 type(node.right.getChildren()[0]) is str)):199 self.src += get_source(node.left) + ' . ' + get_source(node.right)200 else: 201 self.src += '('+get_source( node.left ) + ' + ' + get_source(202 node.right )+')'203 def visitSub(self, node):204 # Sub attributes205 # left 206 # right 207 self.src += '('+get_source( node.left ) + ' - ' + get_source(208 node.right )+')'209 def visitUnaryAdd(self, node):210 # UnaryAdd attributes211 # expr 212 self.src += '+'+get_source( node.expr )213 def visitUnarySub(self, node):214 # UnarySub attributes215 # expr 216 self.src += '-'+get_source( node.expr )217 def visitAssign(self, node):218 # Assign attributes219 # nodes a list of assignment targets, one per equal sign220 # expr the value being assigned221 parsed_expr = get_source( node.expr )222 if ( len(node.nodes)==1 and 223 type(node.nodes[0].getChildren()[0]) is StringType and 224 re.match('^[A-Z][_A-Z]*$', node.nodes[0].getChildren()[0]) ):225 self.src += 'define("'+node.nodes[0].getChildren()[0]+'", '+parsed_expr+')' 226 else:227 self.src += ', '.join( [get_source( n ) for n in node.nodes ] ) + ' = ' 228 self.src += parsed_expr229 def visitAugAssign(self, node):230 # AugAssign attributes231 # node 232 # op 233 # expr 234 def nodeLoop(node):235 try:236 if node.getChildren()[0].__class__ is compiler.ast.Add:237 return nodeLoop(node.getChildren()[0])238 elif node.getChildren()[0].__class__ is compiler.ast.Const:239 return node.getChildren()[0]240 else:241 return node242 except Exception, e:243 return node244 245 if (node.op == '+=' and246 node.expr.__class__ is compiler.ast.Const and247 type(node.expr.getChildren()[0]) is str):248 self.src += get_source( node.node )249 self.src += ' .= '250 self.src += get_source( node.expr )251 else:252 try:253 if (nodeLoop(node.expr).__class__ is compiler.ast.Const and254 type(nodeLoop(node.expr).getChildren()[0]) is str):255 node.op = '.='256 except Exception, e:257 pass258 self.src += get_source( node.node )259 self.src += ' '+node.op+' '260 self.src += get_source( node.expr )261 def visitOr(self, node):262 # Or attributes263 # nodes 264 self.src += ' || '.join( [ get_source( n ) for n in node.nodes ] )265 266 def visitAnd(self, node):267 # And attributes268 # nodes list of operands269 self.src += ' && '.join( [ get_source( n ) for n in node.nodes ] )270 def visitNot(self, node):271 # Not attributes272 # expr 273 self.src += '!%s' % get_source(node.expr)274 def visitGlobal(self, node):275 # Global attributes276 # names 277 self.src += 'global '+ ( ', '.join( ['$%s' % name for name in node.names ] ) )278 def visitCompare(self, node):279 # Compare attributes280 # expr 281 # ops 282 self.src += get_source( node.expr )283 for comp in node.ops:284 if comp[0] == '!=':285 operator = '!=='286 elif comp[0] == '==':287 operator = '==='288 elif comp[0] == 'is':289 raise visitor_base.NotImplementedException('IS keyword')290 else:291 operator = comp[0]292 self.src += ' '+operator+' ' + get_source( comp[1] )293 def visitIf(self, node):294 # if attributes295 # tests 296 # else_ 297 i = 0298 for test in node.tests:299 if i==0:300 self.src += 'if ('301 else:302 self.src += 'elseif ('303 # for compare in test:304 self.src += get_source( test[0] )305 self.src += ') {\n'306 self.src += ''.join( [ get_source(n) for n in test[1:] ] )307 self.src += '}\n'308 i+= 1309 if node.else_:310 self.src += 'else {\n'311 self.src += get_source( node.else_ )312 self.src += '}\n'313 def visitTryExcept(self, node):314 # TryExcept attributes315 # body 316 # handlers 317 # else_ 318 self.src += 'try {\n'319 self.src += get_source( node.body )320 self.src += '}\n' 321 for handler in node.handlers:322 self.src += 'catch ('323 if handler[1] == None:324 self.src += 'Exception '+get_source(handler[0])325 else:326 self.src += handler[0].getChildren()[0] + ' '327 self.src += get_source( handler[1] )328 self.src += ') {\n'329 self.src += get_source( handler[2] )330 self.src += '}\n'331 def visitFor(self, node):332 # For attributes333 # assign 334 # list 335 # body 336 # else_ 337 self.src += 'foreach ('+get_source(node.list)+' as '338 self.src += get_source( node.assign ) + ') {\n'339 self.src += get_source( node.body )340 self.src += '}\n'341 def visitWhile(self, node):342 # While attributes343 # test 344 # body 345 # else_ 346 self.src += 'while ('347 self.src += get_source( node.test )348 self.src += ') {\n'349 self.src += get_source( node.body )350 self.src += '}\n'351 def visitCallFunc(self, node):352 # CallFunc attributes353 # node expression for the callee354 # args a list of arguments355 # star_args the extended *-arg value356 # dstar_args the extended **-arg value357 # call a function :358 if type(node.node.getChildren()[0]) is str:359 # if it's an instanciation:360 if re.match('^[A-Z]', node.node.getChildren()[0] ):361 self.src += 'new ' + node.node.getChildren()[0] + '('362 else: # we have a function:363 funcname = node.node.getChildren()[0]364 if self.funcs_to_replace.has_key(funcname):365 funcname = self.funcs_to_replace[funcname]366 self.src += funcname + '('367 else: # call a method :368 if len( node.node.getChildren() ) == 2 :369 self.src += get_source( node.node.getChildren()[0] )370 self.src += '->' + node.node.getChildren()[1] + '('371 self.src += ', '.join( [get_source(n) for n in node.args ] )372 self.src += ')'373 def visitAssName(self, node):374 # AssName attributes375 # name name being assigned to376 # flags XXX377 if re.match( '^[A-Z][_A-Z]*$', node.name ): # it's a constant if ALL CAPS378 self.src += node.name379 elif (node.name in self.magic_constants):380 self.src += node.name381 else:382 self.src += '$%s' % node.name383 def visitAssTuple(self, node):384 # AssTuple attributes385 # nodes list of tuple elements being assigned to386 # ** Tuple assignment does not exist in PHP so i'm gonna use it for the387 # foreach key => value pair, or value only if there is only one element388 if len(node.nodes) == 2:389 self.src += get_source(node.nodes[0]) + ' => ' 390 self.src += get_source(node.nodes[1])391 elif len(node.nodes) == 1:392 self.src += get_source(node.nodes[0])393 else:394 raise visitor_base.NotImplementedException('Tuple assignment does not exist in PHP')395 def visitList(self,t):396 self.src += 'array('397 self.src += ', '.join ( [ get_source(n) for n in t.nodes ])398 self.src += ')'399 def visitDict(self, node):400 # Dict attributes401 # items 402 self.src += 'array('403 self.src += ', '.join( [get_source(k)+'=>'+get_source(v) for k,v in404 node.items] )405 self.src += ')'406 def visitSubscript(self, node):407 # Subscript attributes408 # expr 409 # flags 410 # subs 411 if node.flags == 'OP_ASSIGN' or node.flags == 'OP_APPLY':412 self.src += get_source(node.expr) +'['413 self.src += get_source(node.subs[0]) # [0] parce qu'on ne peut faire de [0:2] en PHP414 self.src += ']'415 def visitPass(self, node):416 pass417 418def get_source(node):419 """Return the source code of the node, built by an instance of420 ge_visitor"""421 return compiler.walk(node,visitor()).src422def add_semicolons(code):423 global LINEEND424 lines_list = code.split('\n')425 in_comment = False426 new_lines = []427 for line in lines_list:428 if line.startswith('/*') and not line.endswith('*/'):429 in_comment = True430 elif line.endswith('*/'):431 in_comment = False432 if (line.strip() != '<?php' and433 line.strip() != '?>' and434 line.strip() != '' and 435 not in_comment and 436 not (437 line.endswith('}') or438 line.endswith('{') or 439 line.endswith('*/')440 )441 ):442 new_lines.append( line + LINEEND )443 else:444 new_lines.append( line )445 return '\n'.join(new_lines)446def indent_source(code):447 global INDENT448 lines_list = code.split('\n')449 tab_count = 0450 new_lines = []451 for line in lines_list:452 if line == '}':453 tab_count -= 1454 val = (INDENT*tab_count) + line455 indentation = INDENT*tab_count456 if not (line.strip() == '' and tab_count != 0):457 new_lines.append( val )458 if line.endswith('{'):459 tab_count += 1460 return '\n'.join(new_lines)461if __name__ == '__main__':462 unindented_source = get_source(compiler.parseFile('source.py'))...
decompile_lambda_test.py
Source:decompile_lambda_test.py
...4from raco.python.exceptions import PythonConvertException5from raco.python.util import decompile6class TestDecompileLambdas(unittest.TestCase):7 def test_simple(self):8 s = decompile.get_source(lambda: 0)9 self.assertEquals(eval(s)(), 0)10 def test_no_space(self):11 s = decompile.get_source(lambda:0)12 self.assertEquals(eval(s)(), 0)13 def test_space_after_colon(self):14 s = decompile.get_source(lambda :0)15 self.assertEquals(eval(s)(), 0)16 def test_variable(self):17 f = lambda: 018 s = decompile.get_source(f)19 self.assertEquals(eval(s)(), f())20 def test_newline(self):21 f = \22 lambda: 023 s = decompile.get_source(f)24 self.assertEquals(eval(s)(), f())25 def test_newline2(self):26 f = lambda: \27 028 s = decompile.get_source(f)29 self.assertEquals(eval(s)(), f())30 def test_tuple(self):31 t = (lambda: 0), 532 s = decompile.get_source(t[0])33 self.assertEquals(eval(s)(), t[0]())34 def test_tuple2(self):35 f = lambda : (0, 5)36 s = decompile.get_source(f)37 self.assertEquals(eval(s)(), f())38 def test_multiple_lambdas(self):39 t = lambda: 1, lambda: 2, lambda: 340 for f in t:41 s = decompile.get_source(f)42 self.assertEquals(eval(s)(), f())43 def test_embedded_lambda_token(self):44 f = lambda: "lambda: 0"45 s = decompile.get_source(f)46 self.assertEquals(eval(s)(), f())47 def test_parameters(self):48 f = lambda x: x49 s = decompile.get_source(f)50 self.assertEquals(eval(s)(5), f(5))51 def test_multiple_parameters(self):52 f = lambda x, y: x + y53 s = decompile.get_source(f)54 self.assertEquals(eval(s)(5, 6), f(5, 6))55 def test_args_kwargs(self):56 f = lambda *args, **kwargs: args[0] + kwargs['foo']57 s = decompile.get_source(f)58 self.assertEqual(eval(s)(5, foo=6), f(5, foo=6))59 def test_unpacking(self):60 """ Unpacking is not currently supported """61 f = lambda (x, y): x + y62 self.assertRaises(PythonConvertException,...
views.py
Source:views.py
...7def index():8 '''9 View root page function that returns the index page and its data i.e news source10 '''11 general = get_source('general')12 science = get_source('science')13 business = get_source('business')14 technology = get_source('technology')15 health = get_source('health')16 entertainment = get_source('entertainment')17 sports = get_source('sports')18 return render_template('index.html',general = general, science = science, business = business,technology = technology, health = health, entertainment = entertainment, sports = sports)19@main.route('/sources/<id>')20def articles(id):21 '''22 view articles page23 '''24 articles = get_articles(id)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!