123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- import sys
- import os
- import tempfile
- import shutil
- import unittest
- from lvcgui import MVCGui
- import datafiles
- import devices
- data = datafiles.TestData()
- class Test_Choose_Files(unittest.TestCase):
- """Add files to the conversion list either via browse or drag-n-drop.
- """
- def setUp(self):
- """
- setup app for tests
- """
- self.lvc = MVCGui()
- self.lvc.lvc_focus()
- print("starting test: ", self.shortDescription())
- self.output_dir = tempfile.mkdtemp()
- self.lvc.choose_save_location(self.output_dir)
- 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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=False)
- lvc.browse_for_files(datadir, testfiles)
- item = testfiles[0]
- assert lvc.verify_file_in_list(item)
- 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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=True)
- lvc.browse_for_files(datadir, testfiles)
- for t in testfiles:
- assert lvc.verify_file_in_list(t)
- def skip_test_choose_a_directory_files(self):
- """Scenario: Choose a directory of files.
- When I browse to a directory of files
- Then the files are added to the list
- """
- 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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=False)
- lvc.drag_and_drop_files(datadir, testfiles)
- item = testfiles[0]
- assert lvc.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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=True)
- lvc.drag_and_drop_files(datadir, testfiles)
- for t in testfiles:
- assert lvc.verify_file_in_list(t)
- 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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=True)
- lvc.browse_for_files(datadir, testfiles)
- moredatadir, moretestfiles = data.test_data(many=False, new=True)
- item = testfiles[0]
- lvc.drag_and_drop_files(moredatadir, item)
- assert lvc.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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=True)
- lvc.browse_for_files(datadir, testfiles)
- moredatadir, moretestfiles = data.test_data(many=False, new=True)
- item = testfiles[0]
- lvc.browse_for_files(moredatadir, item)
- assert lvc.verify_file_in_list(item)
- 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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=True)
- lvc.browse_for_files(datadir, testfiles)
- lvc.choose_device_conversion("iPad")
- lvc.start_conversion()
- moredatadir, moretestfiles = data.test_data(many=False, new=True)
- item = testfiles[0]
- lvc.drag_and_drop_files(moredatadir, item)
- assert lvc.verify_file_in_list(item)
- assert lvc.verify_completed(item, 60)
- 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
- """
- lvc = MVCGui()
- datadir, testfiles = data.test_data(many=True)
- lvc.browse_for_files(datadir, testfiles)
- lvc.choose_device_conversion("iPad")
- lvc.start_conversion()
- moredatadir, moretestfiles = data.test_data(many=False, new=True)
- item = testfiles[0]
- lvc.browse_for_files(moredatadir, item)
- assert lvc.verify_file_in_list(item)
- assert lvc.verify_completed(item, 60)
- def tearDown(self):
- shutil.rmtree(self.output_dir)
- self.lvc_quit()
|