Merge branch '2017.11' into 2017.11-develop
[tine20] / tests / sikuli / login.sikuli / login.py
1 from __future__ import with_statement
2 import unittest
3
4 from sikuli.Sikuli import *
5
6 class Chromium(object):
7
8     def __init__(self, url):
9         self.url = url
10  
11     def __enter__(self):
12         Screen(0)
13         app = App.open('chromium-browser')
14         wait(2)
15         type("%s\n" % self.url)    
16         wait(2)
17         
18     def __exit__(self, type_, value, traceback):
19         type(Key.F4, KEY_ALT)
20
21         
22 class TestBasicScenario(unittest.TestCase):
23  
24     def test_01_login(self):
25         click("username.png")
26         type("unittest")
27         click("password.png")
28         type("password")
29         click("1379932483974.png")
30         wait(3)
31         assert exists("1389349522098.png")
32         
33
34     def test_02_logout(self):
35         click("logout.png")
36         click("1389349732360.png")
37         wait(3)       
38         assert exists("loginlogo.png")
39         
40
41
42 # Sikuli settings (no logs)
43 Settings.ActionLogs = False
44 Settings.InfoLogs = False
45 Settings.DebugLogs = False
46  
47 with Chromium('localhost&tine20'):
48     suite = unittest.TestLoader().loadTestsFromTestCase(TestBasicScenario)
49     unittest.TextTestRunner(verbosity=2).run(suite)
50