forked from cobrateam/splinter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshot.py
More file actions
25 lines (18 loc) · 856 Bytes
/
screenshot.py
File metadata and controls
25 lines (18 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
# Copyright 2014 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import tempfile
class ScreenshotTest(object):
def test_take_screenshot(self):
"should take a screenshot of the current page"
filename = self.browser.screenshot()
self.assertTrue(tempfile.gettempdir() in filename)
def test_take_screenshot_with_prefix(self):
"should add the prefix to the screenshot file name"
filename = self.browser.screenshot(name='foobar')
self.assertTrue('foobar' in filename)
def test_take_screenshot_with_suffix(self):
"should add the suffix to the screenshot file name"
filename = self.browser.screenshot(suffix='jpeg')
self.assertEqual('jpeg', filename[-4:])