示例#1
0
 def test_complex_page_with_widget_do_not_check_panel(self):
     page = testingwebpages.MyComplexPage(self.driver)
     visible_widget = testingwebpages.MyComplexWidget(
         self.driver, Locator.by_xpath("//widget"))
     visible_widget.do_not_check_panel = testingwebpages.MyComplexPanel(
         self.driver, Locator.by_xpath("//panel")).mark_do_not_check()
     page.visible_widget = visible_widget
     elements = page.get_element_attr()
     meta_data = self.calculate_meta(elements)
     assert len(
         elements
     ) == 8, "Expecting there to be 8 elements in this test complex page"
     assert meta_data['types'][
         'element'] == 6, "Expecting there to be 6 Element types"
     assert meta_data['types'][
         'widget'] == 1, "Expecting there to be 1 Widget types"
     assert meta_data['types'][
         'panel'] == 1, "Expecting there to be 1 Panel types"
     assert meta_data['visible'] == 3, "Expecting there to be 3 visible"
     assert meta_data['invisible'] == 2, "Expecting there to be 2 invisible"
     assert meta_data[
         'do-not-check'] == 3, "Expecting there to be 3 do-not-check"
 def test_complex_widget_with_widget_hidden_panel(self):
     widget = testingwebpages.MyComplexWidget(self.driver,
                                              Locator.by_xpath("//widget"))
     visible_widget = testingwebpages.MyComplexWidget(
         self.driver, Locator.by_xpath("//widget"))
     visible_widget.invisible_panel = testingwebpages.MyComplexPanel(
         self.driver, Locator.by_xpath("//panel")).mark_invisible()
     widget.visible_widget = visible_widget
     elements = widget.get_element_attr()
     meta_data = self.calculate_meta(elements)
     assert len(
         elements
     ) == 9, "Expecting there to be 9 elements in this test complex widget"
     assert meta_data['types'][
         'element'] == 6, "Expecting there to be 6 Element types"
     assert meta_data['types'][
         'widget'] == 2, "Expecting there to be 2 Widget types"
     assert meta_data['types'][
         'panel'] == 1, "Expecting there to be 1 Panel types"
     assert meta_data['visible'] == 4, "Expecting there to be 4 visible"
     assert meta_data['invisible'] == 3, "Expecting there to be 3 invisible"
     assert meta_data[
         'do-not-check'] == 2, "Expecting there to be 2 do-not-check"