예제 #1
0
파일: testlog.py 프로젝트: lml0608/pagedemo
class Test(unittest.TestCase):
    driver = browser('chrome')

    def setUp(self):



        self.driver.get("http://www.baidu.com")

        self.driver.implicitly_wait(20)
    def test_01(self):

        log.info("---测试用例开始----")

        self.driver.find_element_by_id("kw").send_keys("selemiu")

        log.info("输入内容:selenium")

        self.driver.find_element_by_id("su").click()

        log.info("点击按钮:id=su")

        time.sleep(2)

        t = self.driver.title

        log.info("获取title内容:%s" % t)

        self.assertIn("百度搜索",t)

    def tearDown(self):

        self.driver.quit()

        log.info("-----用例测试结束--------")
예제 #2
0
    def setUp(self):

        logger.info("测试前准备.")
        self.driver = browser(glo.GLO_BROWSER_TYPE)

        PMCloudIndexActions(self.driver).openPMCloudIndex()
        PMCloudIndexActions(self.driver).clickLoginButton()
        PMCloudLoginActions(self.driver).pmcloudLogin(remember_selected=True)
    def setUp(self):

        logger.info("测试前准备.")
        self.__driver = browser(glo.GLO_BROWSER_TYPE)
        PMCloudIndexActions(self.__driver).login()
        PMCloudLoginActions(self.__driver).pmcloudLogin()
        ApptenantActions(self.__driver).apptenantLogin()
        WorkbenchActions(self.__driver).clickContactType()
        self.contacttype_page = ContactTypeActions(self.__driver)
예제 #4
0
    def setUp(self):

        logger.info("测试前准备.")
        self.__driver = browser(glo.GLO_BROWSER_TYPE)

        PMCloudIndexActions(self.__driver).openPMCloudIndex()
        PMCloudIndexActions(self.__driver).clickLoginButton()
        PMCloudLoginActions(self.__driver).pmcloudLogin()
        ApptenantActions(self.__driver).apptenantLogin()
        WorkbenchActions(self.__driver).clickProject()
        WorkbenchActions(self.__driver).switchToIframe()
예제 #5
0
class Testcangku(unittest.TestCase):
    driver = browser('chrome')
    log = get_logger()

    def setUp(self):

        #option = webdriver.ChromeOptions()
        #option.add_argument('disable-infobars')
        #option.add_argument('headless')

        #self.driver = browser('chrome')
        self.base_url = 'http://192.168.2.119:8088/wgmfjz/shoppingmall/index.html'

    @Screen(driver)
    def test_add_buynow01(self):
        '''添加活动'''
        self.log.info("-----------测试开始----------------")

        cangku = cangku_page(self.driver)
        login_page = LoginPage(self.driver)

        login_page.get_url(self.base_url)

        #login_page.login()

        #login_page.open_yunyingshangc()

        cangku.open_cangku()

        #切换iframe
        cangku.switch_to_frame()

        cangku.click_add_btn()

        # time.sleep(10)
        #
        #
        # buynow.add_buynow('ceshi','2','54','100','1','2018-03-06 09:25:16','2018-03-09 09:25:16')
        #
        #
        # alert = buynow.is_alert_present()
        # self.assertEqual(alert.text,"产品id54已配置秒杀活动!")
        #
        #
        # self.assertEqual(self.driver.switch_to.alert.text,"产品id54已配置秒杀活动!")
        # buynow_page.accept_alert()
        #
        # alert.accept()

    def tearDown(self):

        self.driver.quit()
예제 #6
0
    def setUpClass(cls):
        logger.info("测试前准备.")
        cls.__driver = browser(glo.GLO_BROWSER_TYPE)
        PMCloudIndexActions(cls.__driver).login()
        PMCloudLoginActions(cls.__driver).pmcloudLogin()
        ApptenantActions(cls.__driver).apptenantLogin()
        WorkbenchActions(cls.__driver).clickContactType()

        # 提前新建好联系类型
        cls.contacttype_page = ContactTypeActions(cls.__driver)
        cls.contacttype_page.clickAddContactTypeCancelButton()
        cls.contacttype_page.saveAddContactType()
        cls.contacttype_page.clickAddContactTypeCancelButton()
예제 #7
0
    def setUp(self):

        logger.info("测试前准备.")
        self.__driver = browser(glo.GLO_BROWSER_TYPE)

        PMCloudIndexActions(self.__driver).openPMCloudIndex()
        PMCloudIndexActions(self.__driver).clickLoginButton()
        PMCloudLoginActions(self.__driver).pmcloudLogin()
        ApptenantActions(self.__driver).apptenantLogin()
        WorkbenchActions(self.__driver).clickProject()
        WorkbenchActions(self.__driver).switchToIframe()
        ProjectActions(self.__driver).saveCreateProject()
        ProjectActions(self.__driver).closeListToast()
        ProjectActions(self.__driver).selectFirstProject()
        ProjectActions(self.__driver).clickEnterpriseButton()
예제 #8
0
class TestBuynowPage(unittest.TestCase):
    driver = browser('phantomjs')
    log = get_logger()

    def setUp(self):

        #option = webdriver.ChromeOptions()
        #option.add_argument('disable-infobars')
        #option.add_argument('headless')

        #self.driver = browser('chrome')
        self.base_url = 'http://portaltest.wgmf.com/index.html'

    @Screen(driver)
    def test_add_buynow01(self):

        '''添加活动'''
        self.log.info("-----------测试开始----------------")

        buynow = BuynowPage(self.driver)
        login_page = LoginPage(self.driver)


        login_page.open(self.base_url)


        login_page.login()

        login_page.open_yunyingshangc()

        buynow.open_buynowpage()

        #切换iframe
        buynow.switch_to_frame()

        buynow.click_add_btn()



        time.sleep(10)


        buynow.add_buynow('ceshi','2','54','100','1','2018-03-06 09:25:16','2018-03-09 09:25:16')


        alert = buynow.is_alert_present()
        self.assertEqual(alert.text,"产品id54已配置秒杀活动!")
        #
        #
        # self.assertEqual(self.driver.switch_to.alert.text,"产品id54已配置秒杀活动!")
        # buynow_page.accept_alert()

        alert.accept()


    @Screen(driver)
    def test_add_buynow02(self):

        '''添加活动'''
        self.log.info("-----------测试开始----------------")

        buynow = BuynowPage(self.driver)
        login_page = LoginPage(self.driver)


        login_page.open(self.base_url)


        login_page.login()

        login_page.open_yunyingshangc()

        buynow.open_buynowpage()

        #切换iframe
        buynow.switch_to_frame()

        buynow.click_add_btn()



        time.sleep(10)


        buynow.add_buynow('ceshi','2','36','100','1','2018-03-06 09:25:16','2018-03-09 09:25:16')


        alert = buynow.is_alert_present()
        self.assertEqual(alert.text,"产品id54已配置秒杀活动!")
        #
        #
        # self.assertEqual(self.driver.switch_to.alert.text,"产品id54已配置秒杀活动!")
        # buynow_page.accept_alert()

        alert.accept()






    def tearDown(self):
        self.driver.quit()
        self.log.info("-----------测试结束----------------")
예제 #9
0
    def setUp(self):

        logger.info("测试前准备.")
        self.__driver = browser(glo.GLO_BROWSER_TYPE)
예제 #10
0
    def setUp(self):

        self.driver = browser.browser('chrome')

        self.base_url = 'http://www.baidu.com'