Example #1
0
def test_switch_univer(webdriver):
	visit(url)
	page = BasiliskPage(driver = driver.browser)
	page.login_link.click()
	wait(lambda: page.is_element_present('log_btn'))
	page.login(user, passw)
	wait(lambda: page.is_element_present('university'))
	page.university.click()
	page = UniversityListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('univer_add'))
	page.univer_links[0].click()
	page = UniverPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_admin'))
	if page.status.get_attribute('checked'):
		test = "on"
		page.on.click()
		set_value(page.disable_pass, "123123")
		page.change.click()
	else:
		test = "off"
		page.off.click()
	time.sleep(3)
	page.save_btn.click()
	page = UniversityListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('univer_add'))
	page.univer_links[0].click()
	page = UniverPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_admin'))
	allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
	if test == "on":
		assert page.status.get_attribute('checked') == None
	elif test == "off":
		assert page.status.get_attribute('checked') == 'true'
Example #2
0
def test_addteacher(webdriver):
	user="******"
	passw = "123123"
	name = fake.first_name()
	uname = fake.user_name() 
	passwt = fake.password() 
	email = fake.email()
	print email
	visit(url)
	page = BasiliskPage(driver = driver.browser)
	page.login_link.click()
	wait(lambda: page.is_element_present('log_btn'))
	page.login(user, passw)
	wait(lambda: page.is_element_present('log_menu'))
	page.users.click()
	page = TeachersListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_teacher'))
	page.add_teacher.click()
	page = TeacherPage(driver = driver.browser)
	wait(lambda: page.is_element_present('save'))
	page.add_teacher(name, uname, email, passwt, passwt)
	page = TeachersListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_teacher'))
	#time.sleep(3)
	allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
	assert page.teachers_list[-1].text == email
    def test_global_info_about_person(self, person):
        try:
            persons_page = self.app.persons_page
            persons_page.is_this_page()
            # Find new person by surname (Alexey test 'add person')
            add_person_pattern = AddPersonPattern()
            add_person_pattern.search_person_by_surname(self.app, person.surname_ukr)
            persons_page.wait_until_page_generate()
            persons_page.view_first_person_in_page
            persons_page.wait_until_page_generate()
            # Is it current view person page?
            assert self.app.person_papers_view_page.get_text_person_profile() == u"Перегляд персони"

            personUkrFIO = person.surname_ukr + " " + person.first_name_ukr + " " + person.second_name_ukr
            personEngFIO = person.surname_eng + " " + person.first_name_eng
            private_case_chars = person.private_case_chars
            private_case_number = str(person.private_case_number)

            actual_person = self.app.person_current_view_page

            assert personUkrFIO == actual_person.get_fio_ukranian().text
            assert personEngFIO == actual_person.get_fio_english().text
            assert private_case_chars == actual_person.get_serial_person_record()
            assert private_case_number == actual_person.get_number_person_record()
        except AssertionError:
            allure.attach('screenshot', self.app.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
            raise
Example #4
0
 def test_order_6(self):
     """产线列表页入口-EAS用户下单-不开票-超过审批额"""
     with allure.step('读取账号配置信息'):
         login_name = self.page.config_reader('test_order.conf', 'EAS账号', 'login_name')
         password = self.page.config_reader('test_order.conf', 'EAS账号', 'password')
         allure.attach('账号信息: ', 'login_name: %s\npassword: %s' % (login_name, password))
     self.home.login(login_name, password)
     self.home.category_tree_click()
     self.product_list.list_add_to_cart()
     for i in range(10):
         try:
             self.cart.element_find(self.cart.quantity_input).send_keys(0)  # 修改数量为10,使其超出审批额1000
             time.sleep(2)
             break
         except StaleElementReferenceException:
             continue
     self.cart.element_find(self.cart.go_to_order).click()
     self.order.choose_none_invoice()
     self.order.submit_order_eas(none_invoice=True)
     for i in range(30):
         try:
             message = self.order_result.element_find(self.order_result.eas_message).text
             assert message == '您已成功提交请购单,等待审批结果!'
             break
         except AssertionError:
             continue
Example #5
0
def test_add_to_cart1(webdriver):
	#Lesson choose
	url = "http://brainacad.demo.site/"
	lesson = 1
	if lesson != 0:
		url = url + 'lesson_' + str(lesson)	

	#Open site http://brainacad.demo.site/
	visit(url)
	page = MadisonPage(driver = driver.browser)
	wait(lambda: page.is_element_present('account'))

	#Go to ACCESSORIES -> Jewerly
	page.go_to_menuitem(driver.browser,2,12)
	page = GoodsList(driver = driver.browser)

	#Add to cart 1 item 1 qty
	page.items[0].add_to_cart.click()

	page = ShoppingCart(driver = driver.browser)
	price = float(page.items[0].price.text[1:])
	qty = int(page.items[0].qty.get_attribute('value'))
	subtotal = float(page.items[0].subtotal.text[1:])
	allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
	assert subtotal == price * qty, "Subtotal price wrong"
Example #6
0
def test_add_faculty_from_list(webdriver):
	user="******"
	passw = "123123"
	visit(url)
	#driver.browser.maximize_window()
	page = BasiliskPage(driver = driver.browser)
	page.login_link.click()
	wait(lambda: page.is_element_present('log_btn'))
	page.login(user, passw)
	wait(lambda: page.is_element_present('log_menu'))
	page.university.click()
	page = UniversityListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('univer_add'))
	page.univer_links[10].click()
	page = UniverPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_admin'))
	page.faculty_dep.click()
	page = FacultyListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add'))
	time.sleep(1)
	page.add.click()
	time.sleep(2)
	if len(page.all_faculties) > 1:
		faculty = page.all_faculties[1].text
		page.all_faculties[1].click()
		wait(lambda: page.is_element_present('add'))
		test = False
		for i in range(len(page.univer_faculties)):
			if page.univer_faculties[i].text == faculty:
				test = True
		allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
		assert test		
	else:
		 pytest.fail("There is no more Faculties in the list")
Example #7
0
def test_add_to_cart2(webdriver):		
	#Lesson choose
	url = "http://brainacad.demo.site/"
	lesson = 1
	if lesson != 0:
		url = url + 'lesson_' + str(lesson)	

	#Open site http://brainacad.demo.site/
	visit(url)
	page = MadisonPage(driver = driver.browser)
	wait(lambda: page.is_element_present('account'))

	#Go to ACCESSORIES -> Jewerly
	page.go_to_menuitem(driver.browser,2,13)
	page = GoodsList(driver = driver.browser)

	#Open product details
	page.items[0].link.click()
	page = ProductDetals(driver = driver.browser)

	#Add to cart 1 item 5 qty
	set_value(page.qty, '5')
	page.add_button.click()

	page = ShoppingCart(driver = driver.browser)
	qty = int(page.items[0].qty.get_attribute('value'))
	allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
	assert qty == 5, "Items Qty Wrong"
 def test_verify_edited_proposition(self, app):
     with pytest.allure.step('Assert speciality id (proposition) edited'):
         try:
             assert str(TestEditEnrollment.speciality_id) == app.enrollments_main_page.find_first_specialities_id_in_view_table().text
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
Example #9
0
 def select_from_list(self, element=None, value=None):
     locator, _type = element
     if not self.wait_element(element):
         allure.attach('screenshot', self.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         pytest.fail("element {} not found".format(locator))
     select = Select(self.driver.find_element(by=_type, value=locator))
     select.select_by_value(value)
    def test_sorting_person(self):
        # variable list
        list_of_all_columns_values = []
        column_number = 1
        try:

            with pytest.allure.step("Prepare TestSortingPerson"):
                pers_page = self.app.persons_page
                pers_page.is_this_page()
            with pytest.allure.step("Check all checkbox"):
                pers_page.show_all_columns()
            with pytest.allure.step("start generate test array of value"):
                pers_page.try_get_last_page_ref().click()
                pers_page.wait_until_page_generate()

                # How many pages do we have in pagination
                looping_over_pagination = int(pers_page.get_number_from_selector(pers_page.LAST_NUMBERED_PAGE))
                for page_count in range(looping_over_pagination):
                    pers_page.wait_until_page_generate()
                    pers_page.driver.find_element(*pers_page.PREVIOUS_PAGE).click()
                    list_of_all_columns_values.extend(pers_page.column_as_list(column_number))

            with pytest.allure.step("start generate tested data"):
                pers_page.wait_until_page_generate()
                pers_page.driver.find_element(*pers_page.get_table_selector(column_number)).click()  # sort column
                pers_page.wait_until_page_generate()
                items_per_page = int(pers_page.get_number_from_selector(pers_page.ACTIVE_ITEMS_PER_PAGE_BUTTON))
                column_after_clicking = pers_page.column_as_list(column_number)
                assert sorted(list_of_all_columns_values, reverse=True)[:items_per_page] == column_after_clicking
        except AssertionError:
            allure.attach('screenshot', self.app.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
            raise
Example #11
0
def test_add_faculty_custom(webdriver):
	user="******"
	passw = "123123"
	visit(url)
	#driver.browser.maximize_window()
	page = BasiliskPage(driver = driver.browser)
	page.login_link.click()
	wait(lambda: page.is_element_present('log_btn'))
	page.login(user, passw)
	wait(lambda: page.is_element_present('log_menu'))
	page.university.click()
	page = UniversityListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('univer_add'))
	page.univer_links[9].click()
	page = UniverPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_admin'))
	page.faculty_dep.click()
	page = FacultyListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add'))
	time.sleep(1)
	page.add.click()
	time.sleep(2)
	page.all_faculties[0].click()
	wait(lambda: page.is_element_present('save'))
	faculty = fake.company()
	set_value(page.name, faculty)
	page.save.click()
	wait(lambda: page.is_element_present('add'))
	allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
	assert page.univer_faculties[-1].text == faculty		
Example #12
0
 def input_text(self, element=None, text=''):
     locator, _type = element
     if not self.wait_element(element):
         allure.attach('screenshot', self.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         pytest.fail("element {} not found".format(locator))
     self.driver.find_element(by=_type, value=locator).clear()
     self.driver.find_element(by=_type, value=locator).send_keys(text.decode('utf-8'))
Example #13
0
def test_addadmin2(webdriver):
	user="******"
	passw = "123123"
	'''name = "Mihail"
	lname = "Cherniavskiy"
	uname = "mihaadmin24"
	email = "*****@*****.**"'''
	name = fake.first_name()
	lname = fake.last_name() 
	uname = fake.user_name() 
	passwa = fake.password() 
	email = fake.email()
	visit(url)
	#driver.browser.maximize_window()
	page = BasiliskPage(driver = driver.browser)
	page.login_link.click()
	wait(lambda: page.is_element_present('log_btn'))
	page.login(user, passw)
	wait(lambda: page.is_element_present('log_menu'))
	page.university.click()
	page = UniversityListPage(driver = driver.browser)
	wait(lambda: page.is_element_present('univer_add'))
	page.univer_links[5].click()
	page = UniverPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_admin'))
	time.sleep(3)
	page.add_admin.click()
	page = UniverAdminPage(driver = driver.browser)
	wait(lambda: page.is_element_present('name'))
	page.add_uadmin(name, lname, uname, email, passwa, passwa)
	page = UniverPage(driver = driver.browser)
	wait(lambda: page.is_element_present('add_admin'))
	time.sleep(3)
	allure.attach("Results", driver.browser.page_source, AttachmentType.HTML)
	assert email == page.email_list[-1].text
Example #14
0
 def attach_screen_to_report(self, text_label="Screen shot"):
     """
     Attaches screenshot to allure report as file.png
     :param text_label: text label for attachment in allure report which characterizes content of the screen shot
     """
     text_label = unicode(text_label)
     screen = self.driver.get_screenshot_as_png()
     allure.attach(text_label, screen, AttachmentType.PNG)
Example #15
0
 def teardown_method(self, method):
     test_method_name = self._testMethodName
     with allure.step('保存截图'):
         self.driver.save_screenshot('../TestResult/ScreenShot/%s.png' % test_method_name)
         f = open('../TestResult/ScreenShot/%s.png' % test_method_name, 'rb').read()
         allure.attach('自动化截图', f, allure.attach_type.PNG)
     with allure.step('---End---'):
         self.driver.quit()
Example #16
0
 def assert_and_get_screenshot(self, app, expression):
     try:
         assert expression
         allure.attach('screenshot', app.persons_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
     except AssertionError:
         allure.attach('screenshot', app.persons_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         self.print_simple_stacktrace()
         raise
 def test_verify_document(self, app, enrollment):
     with pytest.allure.step('Assert the document of person'):
         actual_value_document_text = app.enrollments_main_page.get_document_title().text
         try:
             assert actual_value_document_text == enrollment.document
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
 def test_verify_edited_person_in_enrollment(self, app, enrollment):
     with pytest.allure.step('Assert current person FIO with expected'):
         actual_person_in_enrollment = app.enrollments_main_page.person_fio_already_added_view().text
         try:
             assert actual_person_in_enrollment == enrollment.person_name
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
 def test_verify_structural_unit_enrollment(self, app, enrollment):
     with pytest.allure.step('Assert structural unit'):
         actual_value_structural_unit = app.enrollments_main_page.get_structural_unit_text().text
         try:
             assert actual_value_structural_unit == enrollment.structural_unit
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
Example #20
0
    def clear_field(self, element=None):
        if isinstance(element, types.DictType):
            element = element['element']
        locator, _type = element

        if not self.wait_element(element):
            allure.attach('screenshot', self.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
            pytest.fail("element {} not found".format(locator))
        self.driver.find_element(by=_type, value=locator).clear()
Example #21
0
    def click_element(self, element=None):
        locator, _type = element

        wait_res = self.wait_element(element)
        if not wait_res:
            allure.attach('screenshot', self.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
            pytest.fail("element {} not found".format(locator))

        self.driver.find_element(by=_type, value=locator).click()
Example #22
0
 def test_quick_auth(self):
     try:
         with pytest.allure.step('test general function login()'):
             self.model.current_page = self.model.get_welcome_page().login()
             assert self.model.persons_page == self.model.current_page
             assert self.model.current_page.is_this_page_displayed()
     except Exception:
         allure.attach('screenshot', self.model.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         raise
Example #23
0
 def is_element_present(self, element=None):
     log = logging.getLogger("{}".format("is_element_present"))
     locator, _type = element
     try:
        self.driver.find_element(by=_type, value=locator)
        log.info("element {} present".format(locator))
     except NoSuchElementException, e:
         allure.attach('screenshot', self.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         log.error("element {} not present".format(locator))
         return False
 def test_verify_priority_enrollment(self, app, enrollment):
     with pytest.allure.step('Assert priority'):
         field_priority = app.enrollments_main_page.get_priority()
         common_methods = CommonMethods(app.driver)
         actual_value_priority = common_methods.get_value_from_text_field(field_priority)
         try:
             assert actual_value_priority == enrollment.priority
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
 def test_verify_date_of_entry_closing_enrollment(self, app, enrollment):
     with pytest.allure.step('Assertdate of entry and closing of enrollment'):
         actual_value_date_of_entry = app.enrollments_main_page.find_date_of_begining().get_attribute("value")
         actual_value_date_of_closing = app.enrollments_main_page.find_date_of_ending().get_attribute("value")
         try:
             assert actual_value_date_of_entry == str(enrollment.date_of_entry)
             assert actual_value_date_of_closing == str(enrollment.date_closing)
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
 def test_search_by_proposal_id(self, app):
     en_page = app.enrollments_page
     with pytest.allure.step("Searching by proposal ID"):
         expected_id = "5"
         actual_search_results = en_page.search_enrollment(en_page.SEARCH_METHOD["proposal_id"], "5")
         try:
             assert expected_id in actual_search_results
         except AssertionError:
             allure.attach('screenshot', en_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             self.print_simple_stacktrace()
             raise
Example #27
0
 def read_expected_results_from_file(self, filename, section):
     """
     reads specified
     :param filename: path to config file with test page data
     :param section: section of properties that should be tested
     :return: dictionary with expected results
     """
     options = self.convert_to_dict(filename)
     for option, value in options[section].items():
         allure.attach(option, value)
     return options[section]
Example #28
0
 def test_incorrect_auth(self):
     try:
         with pytest.allure.step('Invalid login test'):
             self.model.current_page = self.model.get_welcome_page()
             self.model.current_page.input_in_username_field('incorrect')
             self.model.current_page.input_in_password_field('incorrect')
             self.model.current_page = self.model.current_page.submit_button_click()
             assert self.model.current_page.is_alert_show()
     except Exception:
         allure.attach('screenshot', self.model.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         raise
 def test_surname_search(self, person):
     try:
         with pytest.allure.step("Prepare Data"):
             add_person_pattern = AddPersonPattern()
             add_person_pattern.search_person_by_surname(self.app, person.surname_ukr)
         with pytest.allure.step("Check Data"):
             assert self.app.persons_page.try_get_searched_surname(person.surname_ukr).text.partition(' ')[
                        0] == person.surname_ukr
     except Exception:
         allure.attach('screenshot', self.app.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
         raise
Example #30
0
 def _insert_png_screenshot_to_allure_report(
         self, name='screenshot'
 ):
     if Browser.current and self.context and self.step:
         try:
             attach(
                 name=name,
                 body=Browser.current.take_screenshot(),
                 attachment_type=attachment_type.PNG
             )
         except:
             raise
Example #31
0
 def test_wireshark_news(self, auth):
     welcome_page: WelcomePage = auth
     assert isinstance(welcome_page.to_wiresharkNews(), WiresharkNewsPage)
     allure.attach(body=self.driver.get_screenshot_as_png(),
                   name='/registration/test_registration_existing_user',
                   attachment_type=allure.attachment_type.PNG)
Example #32
0
 def test003(self):
     with open("./img/fail.png", "rb") as f:
         allure.attach("失败原因:", f.read(), allure.attach_type.PNG)
         print("test003被执行")
         assert 0
Example #33
0
 def input_search(self, value):
     allure.attach("输入", value, allure.attach_type.TEXT)
     self.input(self.search_edit_text, value)
     allure.attach("截图", self.driver.get_screenshot_as_png(),
                   allure.attach_type.PNG)
Example #34
0
    def Sendrequest(self,
                    method,
                    url,
                    headers=None,
                    data=None,
                    files=None,
                    Content_Type=None,
                    isallure=True,
                    **kwargs):
        '''
        request请求方法封装
        :param method: 请求方法
        :param url: 请求url
        :param data: 请求参数
        :param headers: 请求头
        :param files: 要上传的文件
        :param Content_Type: 请求头请求方式
        :param isallure: 是否写入allure报告
        :param kwargs:可变的关键字参数,字典
        :return:
        '''
        print("======", data)
        try:
            url = self.conf.HOST + url
            if method.lower() == "get":
                req = self.__req_get(url, data, headers)
            elif method.lower() == "post":
                req = self.__req_post(url,
                                      data=data,
                                      headers=headers,
                                      file=files,
                                      Content_Type=Content_Type)
            elif method.lower() == "put":
                req = self.__req_put(url, data, headers)
            elif method.lower().lower() == "delete":
                req = self.__req_delete(url, data, headers)
            if isallure:
                # 子功能
                allure.dynamic.story(dict(**kwargs).get("story"))
                # 接口标题
                allure.dynamic.title(dict(**kwargs).get("title"))
                # 接口描述
                allure.dynamic.description(dict(**kwargs).get("description"))
                allure.attach(name="请求url", body=f"{url}")
                allure.attach(name="请求方式", body=f"{method}")
                allure.attach(name="请求头", body=f"{headers}")
                allure.attach(name="请求参数", body=f"{data}")
                exportfile = dict(**kwargs).get("exportfile")
                if exportfile:
                    with open(exportfile, 'wb') as fn:
                        fn.write(req.content)
                        # allure.attach.file('d:\\1.png', " png 图片", allure.attachment_type.PNG)  #添加附件
                        allure.attach.file(
                            exportfile, " csv 文件",
                            allure.attachment_type.CSV)  # 添加附件,附件类型为csv

            if req.status_code != 200:
                self.log.logger.warning(
                    "\n[请求url]:{} \n[请求参数]:{} \n[相应码]:{} \n[相应内容]{}".format(
                        url, json.dumps(data, indent=4, ensure_ascii=False),
                        req.status_code, req.text))
                return req.status_code, req.text
            else:
                # self.log.logger.info("\n[请求url]:{} \n[请求参数]:{} \n[相应码]:{} \n[相应内容]{}".format(url, json.dumps(data,indent=4,ensure_ascii=False), req.status_code,json.dumps(req.json(),indent=4,ensure_ascii=False)))
                return req.status_code, req.json()
        except Exception as e:
            self.log.logger.error("\n[请求url]:{} \n[请求参数]:{} \n[异常错误]{}".format(
                url, json.dumps(data, indent=4, ensure_ascii=False), e))
    def test_register_with_existing_username(self):
        with allure.step("Send a register request with existing username"):
            register_with_existing_username = SendRequest(
                Register.get_test_case("test_register_with_existing_username"))

        with allure.step('Checking Err_msg'):
            allure.attach("Err_msg contains: " + constants.ERR_MSG_EXISTING_USERNAME, "Expected:")
            allure.attach("Err_msg: " + register_with_existing_username.get_err_msg(), "Actual:")
            assert constants.ERR_MSG_EXISTING_USERNAME in register_with_existing_username.get_err_msg()

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_200), "Expected:")
            allure.attach("Ret: " + str(register_with_existing_username.get_ret()), "Actual:")
            assert register_with_existing_username.get_ret() == constants.RET_200

        with allure.step('Checking Err_code'):
            allure.attach("Err_code: " + str(constants.ERR_CODE_1), "Expected:")
            allure.attach("Err_code: " + str(register_with_existing_username.get_err_code()), "Actual:")
            assert register_with_existing_username.get_err_code() == constants.ERR_CODE_1
Example #36
0
 def test_about_flask(self, auth):
     welcome_page: WelcomePage = auth
     assert isinstance(welcome_page.to_aboutFlask(), AboutFlaskPage)
     allure.attach(body=self.driver.get_screenshot_as_png(),
                   name='/registration/test_registration_existing_user',
                   attachment_type=allure.attachment_type.PNG)
Example #37
0
 def input_password(self, text):
     allure.attach("密码:", text)
     self.input(self.password_edit_text, text)
Example #38
0
 def test_001(self):
     print("-->test_001")
     allure.attach("标题001", "001具体的描述内容")
     assert True
Example #39
0
 def test_python_history(self, auth):
     welcome_page: WelcomePage = auth
     assert isinstance(welcome_page.to_pythonHistory(), PythonHistoryPage)
     allure.attach(body=self.driver.get_screenshot_as_png(),
                   name='/registration/test_registration_existing_user',
                   attachment_type=allure.attachment_type.PNG)
Example #40
0
 def input_username(self, text):
     allure.attach('用户名:' + text, "")
     self.input(self.username_input, text)
Example #41
0
 def test02(self):
     allure.attach("断言开始", "学院是否更新成功")
     print("执行学院更新操作")
     allure.attach("断言结束", "更新成功!")
     assert False
Example #42
0
 def input_password(self, text):
     allure.attach('密码:' + text, "")
     self.input(self.password_input, text)
Example #43
0
 def test_001(self):
     allure.attach("附件名称", "附件内容")
     assert True
Example #44
0
                assert len(haha) == 1
            if httpParameters["checkDBType"] == "non-exist":
                assert haha == []
        if 'caseNum' in httpParameters:
            print("\n ==清理数据库==")
            mongoDataOpr.oprDatasToDB(dbJsonPath, dbName, "delete",
                                      httpParameters["caseNum"])

    @allure.story(interfaceChName + "-测试用例")
    @allure.title("{case}")
    @pytest.mark.dependency(name=interfaceEnName + "_all",
                            depends=[interfaceEnName + "_main"])
    @pytest.mark.parametrize("case,description,httpParameters",
                             list(parameters_all))
    def test_all(self, case, description, httpParameters):
        allure.attach('{0}'.format(testerName), "测试人员")
        allure.attach(json.dumps(httpParameters["query"], ensure_ascii=False),
                      "接口入参", allure.attachment_type.JSON)  #测试用例的入参
        if 'caseNum' in httpParameters:
            print("\n ==清理数据库 & 插入数据==")
            mongoDataOpr.oprDatasToDB(dbJsonPath, dbName, "all",
                                      httpParameters["caseNum"])
        if httpParameters["paramType"] == "string":
            stringParams = jsonAnalysis.getStringParams(
                httpParameters["query"])
            urlPath2 = urlPath + stringParams
            postJ = httpApi.httpRequests(urlIP, urlPath2,
                                         httpParameters["httpType"])
        elif httpParameters["paramType"] == "json":
            postJ = httpApi.httpRequests(urlIP,
                                         urlPath,
Example #45
0
 def test_download_centos(self, auth):
     welcome_page: WelcomePage = auth
     assert isinstance(welcome_page.to_downloadCentos(), DownloadCentosPage)
     allure.attach(body=self.driver.get_screenshot_as_png(),
                   name='/registration/test_registration_existing_user',
                   attachment_type=allure.attachment_type.PNG)
Example #46
0
 def test_what_is_an_api(self, auth):
     welcome_page: WelcomePage = auth
     assert isinstance(welcome_page.to_whatIsAnApi(), ApiPage)
     allure.attach(body=self.driver.get_screenshot_as_png(),
                   name='/registration/test_registration_existing_user',
                   attachment_type=allure.attachment_type.PNG)
Example #47
0
 def __base_write_img(self):
     with open("./image/err.png", "rb") as f:
         allure.attach("失败原因:", f.read(), allure.attach_type.PNG)
Example #48
0
 def page_input_code(self, code):
     allure.attach("验证码:", code)
     self.base_input(Page.login_code, code)
Example #49
0
 def test_002(self):
     allure.attach("标题002", "002具体的描述内容")
     print("-->test_002")
     assert False
Example #50
0
 def test_001(self):
     # 截图
     allure.attach(self.driver.get_screenshot_as_png(), "截图",
                   allure.attachment_type.PNG)
     self.abc()
     print("\n--test_001")
Example #51
0
 def test_lets_talk_about_smtp(self, auth):
     welcome_page: WelcomePage = auth
     assert isinstance(welcome_page.to_letsTalkAboutSmtp(), SmtpPage)
     allure.attach(body=self.driver.get_screenshot_as_png(),
                   name='/registration/test_registration_existing_user',
                   attachment_type=allure.attachment_type.PNG)
 def test_login(self, username, code, expect):
     self.login_proxy.login(username, code)
     user = self.home_proxy.get_username_msg()
     time.sleep(1)
     allure.attach(UtilsDriver.get_mp_driver().get_screenshot_as_png(), "登录截图", allure.attachment_type.PNG)
     assert user in expect
Example #53
0
 def page_input_username(self, username):
     allure.attach("用户名:", username)
     self.base_input(Page.login_username, username)
Example #54
0
 def get_my_collection_text(self):
     """获取'我的收藏'文本 """
     text = self.get_element(PageElements.my_collection_id).text
     # print(text)
     allure.attach("获取的文本:", text)
     return text
Example #55
0
 def page_input_password(self, password):
     allure.attach("密码:", password)
     self.base_input(Page.login_password, password)
Example #56
0
 def test_b(self):
     print("\n2222")
     allure.attach('描述1', '请输入用户名')
     print("\n3333")
     allure.attach('描述', '请输入密码')
     assert 0
 def takeScreenshot(self, text):
     allure.attach(self.driver.get_screenshot_as_png(), name=text, attachment_type=AttachmentType.PNG)
    def test_OpenRoaming_2g_WPA2_EAP_NAT(self, passpoint_profile_info,
                                         push_ap_profile, request,
                                         get_APToMobileDevice_data,
                                         setup_perfectoMobile_iOS):

        result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_config']
        if result:
            allure.attach(
                name=
                "Config push to AP for ssid_wpa2_eap_passpoint_2g successful ",
                body="")
        else:
            allure.attach(
                name="Config push to AP for ssid_wpa2_eap_passpoint_2g failed",
                body="")
            pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
        assert result
        result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_state']
        if result:
            allure.attach(
                name=
                "Config apply to AP for ssid_wpa2_eap_passpoint_2g successful ",
                body="")
        else:
            allure.attach(
                name="Config apply to AP for ssid_wpa2_eap_passpoint_2g failed",
                body="")
            pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
        assert result

        print("SSID to download profile :: ",
              setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
        print("SSID to validate connectivity :: ",
              setup_params_eap["ssid_modes"]["wpa2_eap"][0]["ssid_name"])
        print("Profile download URL :: ",
              passpoint_profile_info["profile_download_url_ios"])
        print("Profile name to remove :: ",
              passpoint_profile_info["profile_name_on_device"])

        report = setup_perfectoMobile_iOS[1]
        driver = setup_perfectoMobile_iOS[0]
        connData = get_APToMobileDevice_data

        downloadProfileSSID = setup_params_eap["ssid_modes"]["open"][0][
            "ssid_name"]
        downloadProfileSSIDPass = ""
        #profileDownloadURL = passpoint_profile_info["profile_download_url_ios"]
        profileDownloadURL = "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig"
        profileName = passpoint_profile_info["profile_name_on_device"]
        profileNameSSID = setup_params_eap["ssid_modes"]["wpa2_eap"][1][
            "ssid_name"]

        #Setting Perfecto ReportClient....
        #SSID to download profile ::  passpoint_profile_download
        #SSID to validate connectivity ::  ssid_wpa2_eap_passpoint_5g
        #Profile download URL ::  https://onboard.almondlabs.net/ios.html
        #Profile name to remove ::  AmeriBand

        #Delete Profile Under Settings
        deleteOpenRoamingInstalledProfile(request, profileName,
                                          setup_perfectoMobile_iOS, connData)

        #Set Wifi/AP Mode
        set_APconnMobileDevice_iOS(request, downloadProfileSSID,
                                   downloadProfileSSIDPass,
                                   setup_perfectoMobile_iOS, connData)

        #Install Profile
        downloadInstallOpenRoamingProfile(request, profileDownloadURL,
                                          setup_perfectoMobile_iOS, connData)

        #ForgetWifi Original
        ForgetWifiConnection(request, setup_perfectoMobile_iOS,
                             downloadProfileSSID, connData)

        try:
            assert verify_APconnMobileDevice_iOS(request, profileNameSSID,
                                                 setup_perfectoMobile_iOS,
                                                 connData)
            #Verify Upload download Speed from device Selection
            verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS,
                                         connData)
        except Exception as e:
            deleteOpenRoamingInstalledProfile(request, profileName,
                                              setup_perfectoMobile_iOS,
                                              connData)
            assert False

        #Delete Profile Under Settings
        deleteOpenRoamingInstalledProfile(request, profileName,
                                          setup_perfectoMobile_iOS, connData)
Example #59
0
 def test001(self):
     # 设置测试描述
     allure.attach("输入用户名", "")
     allure.attach("输入密码", "")
     allure.attach("点击登录", "")
     print("test001被执行")
Example #60
0
 def allure_report(self):
     allure.attach(self.browser.get_screenshot_as_png(),
                   name="testEmbedScreen",
                   attachment_type=AttachmentType.PNG)