-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_main_form.py
69 lines (58 loc) · 2.18 KB
/
test_main_form.py
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
# -*- coding: utf-8 -*-
from pywinauto.application import Application
import pytest
import time
class TestBibleQuoteApp:
def setup_class(self):
'''Run an aplication instance'''
app = Application()
self.app = app.start('D:\\Projects\\BibleQuote\\Output\\BibleQuote.exe')
self.dlg = self.app.TMainForm
menu_item = self.dlg.MenuItem(u'#1->#2->#1')
menu_item.click()
def teardown_class(self):
'''Close the application after tests'''
self.app.kill_()
''' ========== Test dialog windows ========== '''
def test_print_function(self):
'''File->Print'''
menu_item = self.dlg.MenuItem(u'File->#0', self.app)
menu_item.click()
window = self.app.PrintDialog
window.wait('visible')
assert self.dlg.IsEnabled() == False
assert window.Texts()[0] == u'Print'
assert window.Printer.Texts()[0] == u'Printer'
window.Cancel.click()
def test_about_popup_window(self):
'''Help->About this programm'''
menu_item = self.dlg.MenuItem(u'Help->#3', self.app)
menu_item.click()
window = self.app.About
window.wait('visible')
assert self.dlg.IsEnabled() == False
assert window.Texts()[0] == u'About'
assert '6.0.20120312 (12.03.2012) BETA' in window.Edit.Texts()[0]
window.OK.click()
def test_settings(self):
'''File->Options'''
menu_item = self.dlg.MenuItem(u'File->#5', self.app)
menu_item.click()
window = self.app.Parameters
window.wait('visible')
time.sleep(3)
window.OK.click()
''' ========== Test main window ========== '''
def test_search_bible_text(self):
self.dlg.Edit.set_edit_text(u'Mk 1:2')
tbutton2 = self.dlg.OK
tbutton2.click()
def test_change_view(self):
'''Togle left Panel'''
assert self.dlg.TPageControl.IsEnabled() == True
assert self.dlg.TPageControl.IsVisible() == True
self.dlg.TToolBar2.click()
time.sleep(3)
assert self.dlg.TPageControl.IsEnabled() == True
assert self.dlg.TPageControl.IsVisible() == True
self.dlg.TToolBar2.click()