示例#1
0
class test_use(unittest.TestCase,Page,check):
    browser = yl['t_wc']['browser']
    url = yl['t_wc']['url']

    def setUp(self):
        self.driver = Driver(self.browser).open_browser(self.url)

    def tearDown(self):
        logger.info("测试完成,现在退出")
        self.driver.quit()
    def test_navinfo(self):
        self.click("test_homepage","chinese")
        self.click("test_homepage","english")
        #确认中英文按钮起作用
        e_list = self.driver.find_elements_by_css_selector('html body header.container-fluid.nav-color div.container nav.navbar.navbar-default.no-margin.nav-header div.container-fluid div#bs-example-navbar-collapse-1.collapse.navbar-collapse ul.nav.navbar-nav.navbar-left.nav-ml.nav-menu-list li.function_nav a')

        li_e = []
        # 将元素.textapp到list中
        for v in e_list:
            a = v.text
            li_e.append(a)
        # 去掉空
        while '' in li_e:
            li_e.remove('')
        self.check_string(li_e[0],yl['t_homepage']['english'])
class test_click(unittest.TestCase,Page,Random):
    url = yl['t_wc']['url']
    browser = yl['t_wc']['browser']
    real_title = yl['t_wc']['real_title']

    def setUp(self):
        self.driver = Driver(self.browser).open_browser(self.url)
        #self.open(self.url)
    def tearDown(self):
        logger.info('测试完成,现在退出')
        self.driver.quit()
    def test_1_click(self):
        logger.info('点击一下click click')
        self.click("w_login","宣传登陆")
        WebDriverWait(self.driver,5,0.5).until(EC.presence_of_all_elements_located)
        # 空空如也
        self.click("w_login", "confirm")
        null = self.driver.find_element_by_class_name('mistack').text
        try:
            assert null == yl['t_wc']['null']
        except:
            logger.info("不输入密码和账号时提示错误")

        #只输入密码
        #pw = self.get_random_number([1,10])
        pw = yl['t_wc']['password']
        self.send_keys("w_login", "pw_input", pw)
        self.click("w_login", "confirm")
        #pw_h = self.find_element("w_login","hint_np")
        pw_h = self.driver.find_element_by_class_name('mistack').text
        #url_now = self.driver.current_url
        try:
            assert pw_h == yl['t_wc']['nn_tips']
        except:
            logger.info("只输入密码是提示错误")
        #print(pw_h)

        #只输入账号
        c_pw=self.find_element("w_login","pw_input").clear()
        ua = yl['t_wc']['username']
        self.send_keys("w_login","un_input",ua)
        self.click("w_login", "confirm")
        un_h = self.driver.find_element_by_class_name('mistack').text
        #print(un_h)
        try:
            assert un_h == yl['t_wc']['np_tips']
        except:
            logger.info("只输入账号时提示错误")
        #正常登录
        self.send_keys("w_login","un_input",ua)
        self.send_keys("w_login","pw_input",pw)
        self.click("w_login","confirm")
        title = self.driver.title
        url_now = self.driver.current_url
        print(url_now)
        #print(title)
        logger.info('title is : %s' %title)
        assert url_now == yl['t_wc']['n_url']
示例#3
0
class test_f(unittest.TestCase,Page,check):
    browser = yl['t_wc']['browser']
    url = yl['t_wc']['url']

    def setUp(self):
        self.driver = Driver(self.browser).open_browser(self.url)
    def tearDown(self):
        logger.info('测试完成,现在退出')
        self.driver.quit()

    def test_fn(self):
        self.click("t_fun","fun")
        self.click("t_fun","free")
        url = self.driver.current_url
        t_url = yl["t_fun"]["url"]
        self.check_url(url,t_url,"free")
        self.driver.back()
        self.click("t_fun","use_now")
        url = self.driver.current_url
        t_url = yl["t_fun"]["price_url"]
        self.check_url(url,t_url,"price")
        self.driver.back()
    def test_support(self):
        self.click("t_fun","support")
        url = self.driver.current_url
        t_url = yl["t_fun"]["support_url"]
        self.check_url(url,t_url,"support")
        self.driver.back()
示例#4
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.createCourse = createCourse(driver)
     self.createCourse.open(self.url)
     self.login_ccreate = login_ccreate(driver)
     self.login_ccreate.course_login()
     self.AssertionError = []
示例#5
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.courseOutline = courseOutline(driver)
     self.courseOutline.open(self.url)
     self.courseDetaillogin = courseDetaillogin(driver)
     self.courseDetaillogin.detail_login()
     self.AssertionError = []
示例#6
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.login_create = login_create(driver)
     self.login_create.open(self.url)
     self.createLive = createLive(driver)
     self.login_create.live_login()
     self.AssertionError = []
示例#7
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.login = login(driver)
     self.login.open(self.url)
     self.list_test = Livelist(driver)
     self.login.live_login()
     self.AssertionError = []
示例#8
0
    def t_login(self, url, browser):
        self.driver = Driver(self.brower).open_browser(self.url)
        self.click("test_login", "username")

        username = yl['t_ed_student']['username']
        #print(username)
        self.send_keys("test_login", "username", username)
        password = yl['t_ed_student']['pwd']
        self.send_keys("test_login", "password", password)
        self.click("test_login", "confirm")
示例#9
0
class test_use(unittest.TestCase, Page, check):
    browser = yl['t_wc']['browser']
    url = yl['t_wc']['url']

    def setUp(self):
        self.driver = Driver(self.browser).open_browser(self.url)

    def tearDown(self):
        logger.info("测试完成,现在退出")
        self.driver.quit()

    def test_1_use(self):
        #检查url是否正确
        self.click("t_use", "t_cli")

        self.click("t_use", "quick")
        url = self.driver.current_url
        t_url = yl["t_use"]["quick"]
        self.check_url(url, t_url, "quick")
        self.driver.back()

        self.click("t_use", "Xadmin")
        url = self.driver.current_url
        t_url = yl["t_use"]["Xadmin"]
        self.check_url(url, t_url, "Xadmin")
        self.driver.back()

        self.click("t_use", "CMS")
        url = self.driver.current_url
        t_url = yl["t_use"]["CMS"]
        self.check_url(url, t_url, "CMS")
        self.driver.back()

        self.click("t_use", "LMS")
        url = self.driver.current_url
        t_url = yl["t_use"]["LMS"]
        self.check_url(url, t_url, "LMS")
        self.driver.back()
示例#10
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     #driver = webdriver.Chrome()
     self.login = Login(driver)
     self.login.open(self.url)
     self.AssertionError = []
示例#11
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.LmsLoginFun = lmsLoginFun(driver)
     self.LmsLoginFun.open(self.url)
     self.AssertionError = []
示例#12
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.lmsAF = lmsAF(driver)
     self.lmsAF.open(self.url)
     self.AssertionError = []
示例#13
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.change_pwd = change_pwd(driver)
     self.change_pwd.open(self.url)
     self.AssertionError = []
示例#14
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.app_d = app_d(driver)
     self.app_d.open(self.url)
     self.AssertionError = []
示例#15
0
    def setUp(self):
        driver = Driver(self.browser).open_browser()
        self.study_centre = study_centre(driver)
        self.study_centre.open(self.url)

        self.AssertionError = []
示例#16
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.dataSet = dataSet(driver)
     self.dataSet.open(self.url)
     self.AssertionError = []
示例#17
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.admin_login = AdminLogin(driver)
     self.admin_login.open(self.url)
     self.AssertionError = []
示例#18
0
class test_course(unittest.TestCase, Page, check):
    browser = yl['t_wc']['browser']
    url = yl['t_wc']['url']

    def setUp(self):
        self.driver = Driver(self.browser).open_browser(self.url)

    def tearDown(self):
        logger.info("测试完成,现在退出")
        self.driver.quit()

    def test_course_cli(self):
        self.click("test_course", "course_cli")
        #self.driver.close()
        sleep(3)
        #获取当前网页句柄
        self.driver.switch_to.window(self.driver.window_handles[-1])
        #self.driver.switch_to_window(self.driver.window_handles[-1])
        self.click("test_course", "course_login")
        self.click("test_course", "login_cancel")
        #获取一组元素
        li_el = self.driver.find_elements_by_css_selector(
            'html body nav.navbar.navbar-default.navbar-fixed-top div.container div#bs-example-navbar-collapse-1.collapse.navbar-collapse ul.nav.navbar-nav.bor-left li a'
        )
        li_tit = []
        #将元素.textapp到list中
        for v in li_el:
            a = v.text
            li_tit.append(a)
        print(".text数据:", li_tit)
        #去掉空
        while '' in li_tit:
            li_tit.remove('')
        print("去掉空元素:", li_tit)
        self.check_string(li_tit, yl['t_course']['li_tit'])

        #check s1
        self.click("test_course", "s1")
        dinger = self.driver.find_element_by_xpath(
            '/html/body/div[3]/div[1]/div[1]/div/div[2]/h1')
        self.check_string(dinger.text, yl['t_course']['dinger'])

        sleep(2)

        #check s2
        self.click("test_course", "s2")
        compete = self.driver.find_element_by_xpath(
            '/html/body/div[3]/div[1]/div[2]/div/div[2]/h1')
        self.check_string(compete.text, yl['t_course']['compete'])
        sleep(2)

        # check s3
        self.click("test_course", "s3")
        s_3 = self.driver.find_element_by_xpath(
            '/html/body/div[3]/div[1]/div[3]/div/div[2]/h1')
        self.check_string(s_3.text, yl['t_course']['s3'])
        sleep(2)

        # check s4
        self.click("test_course", "s4")
        s_4 = self.driver.find_element_by_xpath(
            '/html/body/div[3]/div[1]/div[4]/div/div[2]/h1')
        self.check_string(s_4.text, yl['t_course']['s4'])
        sleep(2)
示例#19
0
 def setUp(self):
     self.driver = Driver(self.browser).open_browser(self.url)
示例#20
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.livelogin = liveLogin(driver)
     self.livelogin.open(self.url)
     self.AssertionError = []
示例#21
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.test_s = test_s(driver)
     self.test_s.open('https://4xjhtu.beta.e-ducation.cn/live/1415/login')
     self.AssertionError = []
示例#22
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.addressAdd = addressAdd(driver)
     self.addressAdd.open(self.url)
     self.AssertionError = []
示例#23
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.perpmLogin = perpmLogin(driver)
     self.perpmLogin.open('https://www.eliteu.cn/')
     self.AssertionError = []
示例#24
0
 def setUp(self):
     driver = Driver(self.browser).open_browser()
     self.select_course = selectCourse(driver)
     self.select_course.open(self.url)
     self.AssertionError = []