aboutsummaryrefslogtreecommitdiffstats
path: root/test/uitests.sikuli/test_choose_files.py
blob: 8140a60e291566cb9e3f08e3d67f6adeed8a7824 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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()