def test_save_po_object_class(self):
        if is_windows():
            self.skipTest(
                'Unsupported in Windows because temp directory is hardcoded to \'/tmp\' in pickled object.'
            )
        else:
            for path in (self.po_class_object.file_path,
                         self.po_class_object.img_path):
                safe_remove_path(path)

            self.po_class_object.save()

            check_if_path_exists(self.po_class_object.file_path)
            self.assertGreater(os.path.getsize(self.po_class_object.file_path),
                               0)
            check_if_path_exists(self.po_class_object.img_path)
            self.assertGreater(os.path.getsize(self.po_class_object.img_path),
                               0)
    def get_po_class_for_url(self, url, class_name, folder_path, area=None):
        po_folder = os.path.join(folder_path, RootFolder.PO_FOLDER)
        img_folder = os.path.join(folder_path, RootFolder.PO_FOLDER,
                                  PageObjectClass.IMAGE_FOLDER)
        check_if_path_exists(folder_path)

        self.__log(u'Generating PageObjectClass for url %s with area %s' %
                   (url, str(area)))
        fields = self.get_all_po_fields(url, area)
        img_as_png = self.browser.get_screenshot_as_png()

        filename = get_py_file_name_from_class_name(class_name)
        file_path = os.path.join(po_folder, filename)
        img_path = os.path.join(img_folder,
                                os.path.splitext(filename)[0] + '.png')

        return PageObjectClass(class_name, url, fields, area, file_path,
                               img_path, img_as_png)
Exemplo n.º 3
0
    def get_po_class_for_url(self, url, class_name, folder_path, area=None):
        po_folder = os.path.join(folder_path,
                                 RootFolder.PO_FOLDER)
        img_folder = os.path.join(folder_path,
                                  RootFolder.PO_FOLDER,
                                  PageObjectClass.IMAGE_FOLDER)
        check_if_path_exists(folder_path)

        self.__log(u'Generating PageObjectClass for url %s with area %s' % (url, str(area)))
        fields = self.get_all_po_fields(url, area)
        img_as_png = self.browser.get_screenshot_as_png()

        filename = get_py_file_name_from_class_name(class_name)
        file_path = os.path.join(po_folder, filename)
        img_path = os.path.join(img_folder,
                                os.path.splitext(filename)[0] + '.png')

        return PageObjectClass(class_name, url, fields,
                               area, file_path, img_path,
                               img_as_png)
Exemplo n.º 4
0
    def test_save_po_object_class(self):
        if is_windows():
            self.skipTest(
                'Unsupported in Windows because temp directory is hardcoded to \'/tmp\' in pickled object.'
            )
        else:
            for path in (self.po_class_object.file_path,
                         self.po_class_object.img_path):
                safe_remove_path(path)

            self.po_class_object.save()

            check_if_path_exists(self.po_class_object.file_path)
            self.assertGreater(
                os.path.getsize(self.po_class_object.file_path), 0
            )
            check_if_path_exists(self.po_class_object.img_path)
            self.assertGreater(
                os.path.getsize(self.po_class_object.img_path), 0
            )