def setUp(self): """ setup app for tests """ self.mvc = MVCGui() self.mvc.mvc_focus() print "starting test: ", self.shortDescription() self.output_dir = tempfile.mkdtemp() self.mvc.choose_save_location(self.output_dir)
def setUp(self): """ setup app for tests """ mvc = MVCGui() mvc.mvc_focus() print "starting test: ", self.shortDescription() datadir, testfiles = data.test_data() mvc.browse_for_files(datadir, testfiles)
def test_browse_for_a_file(self): """Scenario: Browse for a single file. When I browse for a file Then the file is added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=False) mvc.browse_for_files(datadir, testfiles) item = testfiles[0] assert mvc.verify_file_in_list(item)
def test_clear_finished_conversions(self): """Feature: Clear a finished conversions. Given I have converted a file When I clear finished conversions Then the file is removed """ mvc = MVCGui() _, testfiles = data.test_data(many=True) mvc.start_conversions() assert mvc.clear_finished_conversions(testfiles)
def test_choose_several_files(self): """Scenario: Browse for several files. When I browse for several files Then the files are added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=True) mvc.browse_for_files(datadir, testfiles) for t in testfiles: assert mvc.verify_file_in_list(t)
def test_drag_a_file_to_drop_zone(self): """Scenario: Drag a single file to drop zone. When I drag a file to the drop zone Then the file is added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=False) mvc.drag_and_drop_files(datadir, testfiles) item = testfiles[0] assert mvc.verify_file_in_list(item)
def test_drag_and_drop_multiple_files(self): """Scenario: Drag multiple files. When I drag several files to the drop zone Then the files are added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=True) mvc.drag_and_drop_files(datadir, testfiles) for t in testfiles: assert mvc.verify_file_in_list(t)
def setUp(self): """ Each tests assumes that I there are files that have been converted. """ self.mvc = MVCGui() self.mvc.mvc_focus() print "starting test: ", self.shortDescription() datadir, testfiles = data.test_data() self.mvc.browse_for_files(datadir, testfiles) self.output_dir = tempfile.mkdtemp() self.mvc.choose_save_location(self.output_dir)
def setUp(self): """ Each tests assumes that I there are files in the list ready to be converted to some format. """ self.mvc = MVCGui() self.mvc.mvc_focus() print "starting test: ", self.shortDescription() datadir, testfiles = data.test_data(many=True) self.mvc.browse_for_files(datadir, testfiles) self.output_dir = tempfile.mkdtemp() self.mvc.choose_save_location(self.output_dir)
def test_android_size_output_default(): """Scenario: the output format and size are defaults when device selected. """ device_list = devices.devices('Android') datadir, testfiles = data.test_data(many=True, new=True) mvc = MVCGui() mvc.mvc_focus() mvc.browse_for_files(datadir, testfiles) for x in device_list: yield device_defaults, x, mvc
def test_send_file_to_itunes(self): """Scenario: Send to iTunes. Given I have "Send to iTunes" checked When I convert the an apple format Then the file is added to my iTunes library """ item = "mp4-0.mp4" mvc = MVCGui() mvc.choose_device_conversion("iPad") mvc.choose_itunes() mvc.start_conversions() mvc.verify_completed(item, 30) assert mvc.verify_itunes(item)
def test_drag_more_files_to_drop_zone(self): """Scenario: Drag additional files to the existing list. Given I have files in the list When I drag a new file to the drop zone Then the new file is added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=True) mvc.browse_for_files(datadir, testfiles) moredatadir, moretestfiles = data.test_data(many=False, new=True) item = testfiles[0] mvc.drag_and_drop_files(moredatadir, item) assert mvc.verify_file_in_list(item)
def test_browse_for_more_files_and_add_them(self): """Scenario: Choose additional files and add to the existing list. Given I have files in the list of files When I browse for several new files Then the new files are added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=True) mvc.browse_for_files(datadir, testfiles) moredatadir, moretestfiles = data.test_data(many=False, new=True) item = testfiles[0] mvc.browse_for_files(moredatadir, item) assert mvc.verify_file_in_list(item)
def choose_custom_size(self): """Scenario: Choose custom size. When I enter a custom size option Then the conversion uses that setting.""" mvc = MVCGui() _, testfiles = data.test_data() item = testfiles[0] w = '360' h = '180' mvc.choose_custom_size(self, 'on', width=w, height=h) mvc.mvc.choose_device_conversion('WebM') mvc.start_conversions() assert mvc.verify_size(item, width=w, height=h)
def choose_device_then_change_size(self): """Scenario: Choose a device, then choose a custom size. When I choose a device And I change size Then the selected size is used in the conversion """ mvc = MVCGui() _, testfiles = data.test_data() item = testfiles[0] w = '240' h = '180' mvc.choose_device_conversion('Galaxy Tab') mvc.choose_custom_size(self, 'on', width=w, height=h) mvc.start_conversions() assert mvc.verify_size(item, width=w, height=h)
def test_clear_finished_item_with_in_progress(self): """Scenario: Clear finished conversions while others are in progress. Given I have converted a file And I have some conversions in progress When I clear finished conversions Then the completed files are removed And the in-progress conversions remain """ _, testfiles = data.test_data(many=True) item = 'slow_conversion.mkv' item_dir = data.testfile_attr(item, 'testdir') mvc = MVCGui() mvc.browse_for_files(item_dir, item) mvc.start_conversions() mvc.clear_finished_conversions(testfiles) assert mvc.verify_converting(item)
def test_clear_finished_after_conversion_errors(self): """Scenario: Clear finished conversions after conversion errors. Given I convert several files and 1 that will fail When I clear finished conversions Then the completed files are removed And the failed conversions are removed """ _, testfiles = data.test_data(many=True) item = 'fake_video.mp4' item_dir = data.testfile_attr(item, 'testdir') mvc = MVCGui() mvc.browse_for_files(item_dir, item) mvc.start_conversions() mvc.verify_conversions_finished() mvc.clear_and_start_over() assert mvc.verify_file_not_in_list(testfiles[0]) assert mvc.verify_file_not_in_list(item)
def convert_to_format(device_output): print device_output expected_failures = ['fake_video.mp4'] mvc = MVCGui() mvc.mvc_focus() datadir, testfiles = data.test_data(many=True, new=True) mvc.browse_for_files(datadir, testfiles) output_dir = tempfile.mkdtemp() mvc.choose_save_location(output_dir) mvc.choose_device_conversion("device_output") mvc.start_conversions() for item in testfiles: if item in expected_failures: mvc.verify_failed(item, 120) else: mvc.verify_completed(item, 120) mvc.clear_finished_files(item) mvc.clear_and_start_over()
def test_browse_more_files_while_converting(self): """Scenario: Choose additional files and add to list with conversions in progress. Given I have files in the list And I start conversion When I browse for several new files Then the new files are added to the list """ mvc = MVCGui() datadir, testfiles = data.test_data(many=True) mvc.browse_for_files(datadir, testfiles) mvc.choose_device_conversion("iPad") mvc.start_conversion() moredatadir, moretestfiles = data.test_data(many=False, new=True) item = testfiles[0] mvc.browse_for_files(moredatadir, item) assert mvc.verify_file_in_list(item) assert mvc.verify_completed(item, 60)
def test_drag_more_file_while_converting(self): """Scenario: Drag additional files to the existing list with conversions in progress. Given I have files in the list And I start conversion When I drag a new file to the drop zone Then the new file is added to the list and is converted """ mvc = MVCGui() datadir, testfiles = data.test_data(many=True) mvc.browse_for_files(datadir, testfiles) mvc.choose_device_conversion("iPad") mvc.start_conversion() moredatadir, moretestfiles = data.test_data(many=False, new=True) item = testfiles[0] mvc.drag_and_drop_files(moredatadir, item) assert mvc.verify_file_in_list(item) assert mvc.verify_completed(item, 60)