def test_render__with_clip_params(self):
     #params = ['/examples/bootstrap-cdn.html'        ,0  ,0 ,500 ,50 ]
     params = ['examples/wardley_map/cup-of-tea.html', 250, 50, 600, 200]
     png_data = self.browser_commands.render(None, None, params)
     Files.delete(self.png_file)
     self._save_png_data(png_data)
     assert Files.exists(self.png_file)
    def test_render(self):
        params = ['examples/wardley_map/cup-of-tea.html']
        png_data = self.browser_commands.render(None, None, params)

        Files.delete(self.png_file)
        self._save_png_data(png_data)
        assert Files.exists(self.png_file)
示例#3
0
def cleanup_chrome_processes_and_tmp_files():  # remote temp files
    for file in Files.find('/tmp/core.headless_shell.*'):
        pid = file.split('.')[-1]
        Process.run(
            'pkill', ['-TERM', '-P', str(pid)]
        )  # this doesn't seem to be working since the  "headless_shell <defunct>" is still there
        Files.delete(file)
示例#4
0
    def delete(self, name):
        virtual_path = "{0}/{1}".format(self.base_folder, self.fix_name(name) + '.md')
        full_path = self.md_file_path(virtual_path)
        if Files.exists(full_path) is False:
            return False
        Files.delete(full_path)

        return Files.exists(full_path) is False
示例#5
0
 def test_zip_files(self):
     target_file = '/tmp/test_zip.zip'
     Files.delete(target_file)
     assert Files.exists(target_file) is False
     Dev.pprint(Files.zip_files('..', '*.py', '/tmp/test_zip.zip'))
     assert Files.exists(target_file) is True
     Files.delete(target_file)
     assert Files.exists(target_file) is False
示例#6
0
 def test_get_set_last_chrome_session(self):
     self.api.file_tmp_last_chrome_session = Files.temp_file()
     data = {
         'chrome_devtools':
         'ws://127.0.0.1:64979/devtools/browser/75fbaab9-33eb-41ee-afd9-4aed65166791'
     }
     self.api.set_last_chrome_session(data)
     assert self.api.get_last_chrome_session() == data
     Files.delete(self.api.file_tmp_last_chrome_session)
示例#7
0
 def test_screenshot_url(self):
     #url = 'https://github.com/GoogleChrome/puppeteer'
     #url = 'https://www.google.co.uk'
     #url = 'http://visjs.org/examples/network/other/manipulation.html'
     #url = 'http://visjs.org/examples/graph3d/01_basics.html'
     url = 'https://getbootstrap.com/docs/4.3/examples/dashboard/'
     tmp_img = '/tmp/test_screenshot_html.png'
     Files.delete(tmp_img)
     self.render_page.screenshot_url(url, tmp_img)
     assert Files.exists(tmp_img)
示例#8
0
 def __exit__(self, type, value, traceback):
     Files.delete(self.file_path)
示例#9
0
 def test_screenshot_folder(self):
     web_root = Files.current_folder()
     clip = {'x': 1, 'y': 1, 'width': 280, 'height': 200}
     Files.delete(self.tmp_img)
     self.render_page.screenshot_folder(web_root, self.tmp_img, clip)
     assert Files.exists(self.tmp_img)
示例#10
0
 def remove_files(self, pattern):
     for file in self.get_files():
         if pattern in file:
             file_to_delete = Files.path_combine(self.tmp_folder, file[1:])
             Files.delete(file_to_delete)
 def __exit__(self, type, value, traceback):
     if Files.exists(self.zip_file) and self.delete_zip_file:
         Files.delete(self.zip_file)