Exemplo n.º 1
0
    def test_group_reports(self):
        from Pages.LoginPage import LoginPage
        login_user = LoginPage(self.driver)
        # Navigate to Login Page

        LoginPage.log_in_with_user(login_user,
                                   username='******',
                                   password='******')
        # Login with valid credentials

        from Pages.BasePage import BasePage
        go = BasePage(self.driver)
        go.go_to_reports()
        # Navigate to Reports Page

        from Pages.ReportsPage import ReportsPage
        rep = ReportsPage(self.driver)
        rep._validate_page()
        # Verifing the right page: Reports Page

        rep.click_reports_month()
        # Chose reports month
        rep.click_reports_year()
        # Chose reports year
        rep.click_reports_button()
        # Click submit button

        self.assertTrue("March" in self.driver.page_source)
Exemplo n.º 2
0
    def test_worklogs(self):
        # Verifing the worklogs dropdown menu

        from Pages.LoginPage import LoginPage
        login_user = LoginPage(self.driver)
        # Navigate to Login Page

        LoginPage.log_in_with_user(login_user,
                                   username='******',
                                   password='******')
        # Login with valid credentials

        from Pages.BasePage import BasePage
        go = BasePage(self.driver)
        go.go_to_reports()
        # Navigate to Reports Page

        from Pages.ReportsPage import ReportsPage
        rep = ReportsPage(self.driver)
        rep._validate_page()
        # Verify the right page: Reports Page

        rep.click_worklogs()
        # Click the worklog dropdown menu
        rep.click_worklogs_drop()
        # Choose one worklog type from the dropdown menu

        # Verify the right result: a table is presented
        self.assertTrue("tr" in self.driver.page_source)
Exemplo n.º 3
0
    def test_dish_group_is_visible(self, restaurant):
        self.restaurant = RestaurantsPage(self.driver, restaurant['url'])

        assert BasePage.is_visible(RestaurantsPage.DISH_GROUP)
        assert BasePage.is_visible(RestaurantsPage.RESTAURANT_IN_GROUP)
        assert BasePage.is_visible(RestaurantsPage.ALCOHOL)
        assert BasePage.is_visible(RestaurantsPage.DISH)
Exemplo n.º 4
0
    def test_reports_calendar(self):
        # Verifing the reports calendar

        from Pages.LoginPage import LoginPage
        login_user = LoginPage(self.driver)
        # Navigate to Login Page

        LoginPage.log_in_with_user(login_user,
                                   username='******',
                                   password='******')
        # Login with valid credentials

        from Pages.BasePage import BasePage
        go = BasePage(self.driver)
        go.go_to_reports()
        # Navigate to Reports Page

        from Pages.ReportsPage import ReportsPage
        rep = ReportsPage(self.driver)
        rep._validate_page()
        # Verifing the right page: Reports Page

        # Chose the worklog
        rep.click_worklogs()
        # Pick one worklog from the dropdown menu
        rep.click_worklogs_drop()
        # Click the calendar to open it
        rep.click_calendar()
        # Change the month by clicking next month
        rep.click_calendar_next()

        # Verify the right result
        self.assertTrue("April" in self.driver.page_source)
Exemplo n.º 5
0
    def test_group_reports_by_name(self):
        # Verify the grouping by name option from the NameField in the reports table

        from Pages.LoginPage import LoginPage
        login_user = LoginPage(self.driver)
        LoginPage.log_in_with_user(login_user,
                                   username='******',
                                   password='******')
        # Navigate to Login Page

        from Pages.BasePage import BasePage
        go = BasePage(self.driver)
        go.go_to_reports()
        # Navigate to Reports Page

        from Pages.ReportsPage import ReportsPage
        rep = ReportsPage(self.driver)
        rep._validate_page()
        # Validate Reports Page

        #Click to arrange ascending
        rep.click_type()
        #Click to arrange descending
        rep.click_type()
        #Click to arrange ascending
        rep.click_type()
        # Click to arrage ascending
        rep.click_type()
        # Assert the right type of arranging
        self.assertTrue("headerSortUp" in self.driver.page_source)
Exemplo n.º 6
0
 def test001_Go_IndexPage(self):
     username = BasePage.read_config()['loginName']
     password = BasePage.read_config()['loginPassword']
     index_Page = IndexPage(self.driver, self.url)
     index_Page.goIndexPage()
     index_Page.click_risk_button()
     index_Page.input_username_password(username, password)
     index_Page.click_login_button()
     sleep(1)
     index_Page.click_close_prompt_box()
     # 断言应该配合固件升级前读取的信息
     self.assertEqual(index_Page.get_title(), "Xontel")
Exemplo n.º 7
0
 def setUpClass(cls):
     print("自动化测试进行中...")
     cls.driver = webdriver.Chrome()
     cls.driver.maximize_window()
     cls.driver.implicitly_wait(10)
     cls.url = BasePage.read_config()['url']
     # 执行前清空之前测试的配置信息
     with open('./common/ConfigInfo_UpdateBefore.yaml', mode='w') as f:
         f.write("")
Exemplo n.º 8
0
 def test102_SSTP(self):
     sstp = SSTPPage(self.driver, self.url)
     sstp.click_sstp_button()
     sleep(1)
     update_after_client_ip = sstp.get_client_ip()
     if update_after_client_ip != "null":
         update_before_client_ip = BasePage.update_before_config(
         )['VPNClient_SSTP_ClientIP']
         self.assertEqual(update_before_client_ip, update_after_client_ip)
Exemplo n.º 9
0
 def setUpClass(cls):
     url = "https://www.amazon.in/"
     cls.base = BasePage(url)
     cls.home = HomePage(cls.base.driver)
     cls.home.click_on_categorymenu()
     logging.basicConfig(filename="TitleVerification.log",
                         format='%(asctime)s :%(levelname)s: %(message)s',
                         filemode='w')
     logger = logging.getLogger()
     logger.setLevel(logging.DEBUG)
Exemplo n.º 10
0
 def test101_OpenVpn(self):
     openvpn = OpenVPNPage(self.driver, self.url)
     openvpn.click_vpn_client_button()
     sleep(1)
     openvpn.click_openvpn_button()
     sleep(1)
     update_after_client_ip = openvpn.get_client_ip()
     if update_after_client_ip != "null":
         update_before_client_ip = BasePage.update_before_config(
         )['VPNClient_OpenVNP_ClientIP']
         self.assertEqual(update_before_client_ip, update_after_client_ip)
         print("升级后OpenVpn 已读取")
Exemplo n.º 11
0
    def test_reports_type(self):
        # Verify groupig reports by type from the type dropdown menu
        from Pages.LoginPage import LoginPage
        login_user = LoginPage(self.driver)
        LoginPage.log_in_with_user(login_user,
                                   username='******',
                                   password='******')
        # Navigate to Login Page

        from Pages.BasePage import BasePage
        go = BasePage(self.driver)
        go.go_to_reports()
        # Nav to Reports Page

        from Pages.ReportsPage import ReportsPage
        rep = ReportsPage(self.driver)
        rep._validate_page()
        # Validate the right page
        rep.click_type()
        # Click to chose reports type
        rep.choose_reports_type()
        #Chose type
        self.assertTrue("report_type_select" in self.driver.page_source)
Exemplo n.º 12
0
 def click_departments_link(self):
     depart_link = BasePage(self.driver)
     depart_link.go_to_depart()
Exemplo n.º 13
0
    def test_dish_alcohol_is_clickable(self, restaurant):
        self.restaurant = RestaurantsPage(self.driver, restaurant['url'])

        assert BasePage.is_clickable(RestaurantsPage.ALCOHOL)
        assert BasePage.is_clickable(RestaurantsPage.DISH)
        assert BasePage.is_clickable(RestaurantsPage.RESTAURANT_IN_GROUP)
Exemplo n.º 14
0
 def test100_NetworkParameters(self):
     network_parameters = NetworkParametersPage(self.driver, self.url)
     # 不升级先不点这个
     # network_parameters.click_network_button()
     sleep(1)
     network_parameters.click_network_parameters_button()
     update_before_workmode = BasePage.update_before_config(
     )['NetWorkParameters_WorkMode']
     update_after_workmode = network_parameters.get_network_work_mode()
     print("更新前网卡模式:" + update_before_workmode)
     self.assertEqual(update_before_workmode, update_after_workmode, "网卡模式")
     if update_before_workmode == "Single":
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_IPAddress'],
             network_parameters.get_single_ipaddress())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_Mask'],
             network_parameters.get_single_mask())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_GateWay'],
             network_parameters.get_single_gateway())
     if update_before_workmode == "Double":
         self.assertEqual(
             BasePage.update_before_config()
             ['NetWorkParameters_IPAddress1'],
             network_parameters.get_double_ipaddress1())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_Mask1'],
             network_parameters.get_double_mask1())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_GateWay1'],
             network_parameters.get_double_gateway1())
         self.assertEqual(
             BasePage.update_before_config()
             ['NetWorkParameters_IPAddress2'],
             network_parameters.get_double_ipaddress2())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_Mask2'],
             network_parameters.get_double_mask2())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_GateWay2'],
             network_parameters.get_double_gateway2())
     if update_before_workmode == "Bridge":
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_IPAddress'],
             network_parameters.get_bridge_ipaddress())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_Mask'],
             network_parameters.get_bridge_mask())
         self.assertEqual(
             BasePage.update_before_config()['NetWorkParameters_GateWay'],
             network_parameters.get_bridge_gateway())
     print("升级后NetworkParameters 已读取")
Exemplo n.º 15
0
 def test_guest_can_go_to_login_page(self, browser):
     page = BasePage(browser, BasePagelocators.LOGIN_LINK)
     page.open()
     page.go_to_login_page()
Exemplo n.º 16
0
    def test_logo_visible(self, restaurant):
        self.restaurant = RestaurantsPage(self.driver, restaurant['url'])

        assert BasePage.is_visible(RestaurantsPage.LOGO)
Exemplo n.º 17
0
class FirmwareUpdatePage(BasePage):
    # 【元素集】
    # Maintenance 按钮
    maintenance_button = (By.XPATH,
                          "//*[@href='index.php?menu=maintenance']/span")
    # Firmware Update 按钮
    firmware_update_button = (
        By.XPATH, "//*[@href='index.php?menu=backup_firmware']/span")
    # 固件文件
    firmware_file = (By.XPATH, "//*[@type='file']")
    # 选择升级按钮
    update_button = (By.XPATH, "//*[@id='sub']")
    # 确认升级按钮
    sure_update_button = (By.XPATH, "//*[@class='layui-layer-btn0']")
    # 更新提示信息
    update_message = (By.XPATH, "//*[@id='mgss']")
    # 关闭升级失败按钮
    update_fail_button = (By.XPATH, "//*[@id='modal-4']/div/div/div[1]/button")
    # 更新阶段信息
    update_phase_message = (
        By.XPATH, "//*[@id='modal-4']/div/div/div[2]/div/div[1]/span[1]")
    # 更新百分比信息
    update_percent_message = (By.XPATH, "//*[@id='cent']")
    # 确认立即重启按钮
    reboot_button = (By.XPATH, "//*[@onclick='react(2)']")
    # 固件路径
    firmware_path = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), "./Firmware_File")),
        BasePage.read_config()['firmwareName'])

    def click_maintenance_button(self):
        self.click(self.maintenance_button)

    def click_firmware_update_button(self):
        self.click(self.firmware_update_button)

    # 固件升级
    def firmware_update(self):
        self.input_text(self.firmware_file, self.firmware_path)
        self.click(self.update_button)
        sleep(1)
        self.click(self.sure_update_button)
        sleep(1)

    # 判断是否更新成功(失败就截图,并终止后面操作)
    def is_update_success(self):
        if self.get_element_text(
                self.update_message) == "Files Upload format error":
            # 升级失败
            sleep(1)
            self.click(self.update_fail_button)
        else:
            # 升级中
            while True:
                sleep(3)
                update_phase = self.get_element_text(self.update_phase_message)
                update_percentage = self.get_element_text(
                    self.update_percent_message)
                print(f"第{update_phase}阶段已经更新{update_percentage}%...")
                if update_phase == "2" and update_percentage == "95":
                    print("更新成功,请等待系统重启")
                    sleep(8)
                    self.is_click(self.reboot_button)
                    return "success"
                if self.get_element_text(
                        self.update_message) == "Files Upload format error":
                    # 升级失败
                    sleep(1)
                    self.click(self.update_fail_button)
                    return "failed"

    # 升级完成后判断系统是否已经重启
    def is_reboot_success(self):
        if self.is_update_success() == "success":
            pass