def test_pending_screenshots_gives_only_those_screenshots_which_are_not_collected(self): ScreenshotsStore.capture() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(['foo'], pending_screenshots) pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual([], pending_screenshots) ScreenshotsStore.capture() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(['foo'], pending_screenshots)
def test_pending_screenshots_gives_only_those_screenshots_which_are_not_collected(self): ScreenshotsStore.capture() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(1, len(pending_screenshots)) screenshot_file = pending_screenshots[0] pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(0, len(pending_screenshots)) ScreenshotsStore.capture() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(1, len(pending_screenshots)) self.assertNotEqual(screenshot_file, pending_screenshots[0])
def test_capture_shoould_vefify_screenshot_file_for_file_based_custom_screenshot(self): first_screenshot = os.path.join( os.getenv("gauge_screenshots_dir"), "screenshot{0}.png".format(uuid1())) second_screenshot = os.path.join( os.getenv("gauge_screenshots_dir"), "screenshot{0}.png".format(uuid1())) def returns_abs_path(): return first_screenshot def returns_base_ath(): return os.path.basename(second_screenshot) registry.set_screenshot_provider(returns_abs_path, True) ScreenshotsStore.capture() self.assertEqual([os.path.basename(first_screenshot)], ScreenshotsStore.pending_screenshots()) registry.set_screenshot_provider(returns_base_ath, True) ScreenshotsStore.capture() self.assertEqual([os.path.basename(second_screenshot)], ScreenshotsStore.pending_screenshots())
def capture_screenshot(): ScreenshotsStore.capture()
def test_clear(self): ScreenshotsStore.capture() ScreenshotsStore.clear() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual([], pending_screenshots)
def test_pending_screenshots(self): ScreenshotsStore.capture() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(['foo'], pending_screenshots)
def test_pending_screenshots(self): ScreenshotsStore.capture() pending_screenshots = ScreenshotsStore.pending_screenshots() self.assertEqual(1, len(pending_screenshots)) self.assertTrue(os.path.exists(os.path.join( os.getenv("gauge_screenshots_dir"), pending_screenshots[0])))