forked from BibleQuote/BibleQuote-UI-Tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main_form.py
76 lines (59 loc) · 1.97 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
70
71
72
73
74
75
76
# -*- coding: utf-8 -*-
from pywinauto.application import Application
import pytest
import time
def BQApp():
'''Run an aplication instance'''
return Application().Start(cmd_line=u'D:\\Projects\\BibleQuote\\Output\\BibleQuote.exe')
def MainForm(app):
'''Set focus on the main window'''
tmainform = app.TMainForm
tmainform.Wait('ready')
return tmainform
def change_app_language():
'''Change app language to English
File->Interface language->English'''
menu_item = tmainform.MenuItem(u'#1->#2->#1', app)
menu_item.Click()
''' ========== Run app ========== '''
app = BQApp()
tmainform = MainForm(app)
change_app_language()
''' ========== Test dialog windows ========== '''
def test_print_function():
'''File->Print'''
menu_item = tmainform.MenuItem(u'File->#0')
menu_item.Click()
window = app.PrintDialog
window.Wait('ready')
assert tmainform.IsEnabled() == False
assert window.Texts()[0] == u'Print'
assert window.Printer.Texts()[0] == u'Printer'
window.Cancel.Click()
def test_about_popup_window():
'''Help->About this programm'''
menu_item = tmainform.MenuItem(u'Help->#3')
menu_item.Click()
window = app.About
window.Wait('ready')
assert tmainform.IsEnabled() == False
assert window.Texts()[0] == u'About'
assert '6.0.20120312 (12.03.2012) BETA' in window.Edit.Texts()[0]
window.OK.Click()
''' ========== Test main window ========== '''
def test_search_bible_text():
tmainform.Edit.set_edit_text(u'Mk 1:2')
tbutton2 = tmainform.OK
tbutton2.Click()
def test_change_view():
'''Togle left Panel'''
assert tmainform.TPageControl.IsEnabled() == True
assert tmainform.TPageControl.IsVisible() == True
tmainform[u'3'].Click()
time.sleep(3)
assert tmainform.TPageControl.IsEnabled() == True
assert tmainform.TPageControl.IsVisible() == True
tmainform[u'3'].Click()
''' ========== Close app window ========== '''
def test_stop_app():
app.Kill_()