~dhillon-v10/qa-regression-testing/mago-packages-checking

« back to all changes in this revision

Viewing changes to evolution/evolution_indicator.py

  • Committer: Vikram Dhillon
  • Date: 2010-01-12 02:42:18 UTC
  • Revision ID: dhillonv10@gmail.com-20100112024218-7ntl2wrpbxqjb3kx
Initial commit: getting in the data from mago

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from mago.test_suite.evolution import EvolutionTestSuite
 
2
from mago.application.evolution import Evolution, AccountInfo
 
3
from mago.check import ScreenshotCompare, FAIL
 
4
from mago.application.deskex import IndicatorApplet 
 
5
 
 
6
from ConfigParser import ConfigParser
 
7
import ldtp, ooldtp, ldtputils
 
8
from time import sleep, time
 
9
from shutil import copytree, move
 
10
from os.path import expanduser
 
11
 
 
12
class EvolutionUseApp(Evolution):
 
13
    def open(self, profile_template='', credentials='',
 
14
             me_account=''):
 
15
        self.me_account = AccountInfo(me_account, credentials)
 
16
 
 
17
        self.backup_config()
 
18
        self.generate_profile(profile_template, self.me_account.template_args)
 
19
 
 
20
        Evolution.open(self, False, credentials)
 
21
 
 
22
class EvolutionIndicatorTest(EvolutionTestSuite):
 
23
    APPLICATION_FACTORY = EvolutionUseApp
 
24
    def cleanup(self):
 
25
        return
 
26
 
 
27
    def testIndicatorShowsUp(self):
 
28
        indicator = IndicatorApplet()
 
29
        if not indicator.is_server_shown("Evolution Mail"):
 
30
            raise AssertionError("The indicator didn't show up", ldtputils.imagecapture())
 
31
 
 
32
    def testIndicateMyself(self, subject, body, password=''):
 
33
 
 
34
        indicator = IndicatorApplet()
 
35
        no_message = indicator.capture_applet_icon()
 
36
        email = self.application.me_account.template_args['emailaddress']
 
37
        password = self.application.me_account.template_args['password']
 
38
 
 
39
        self.application.compose_new_message(email, subject, body)
 
40
        self.application.send_email(subject)
 
41
 
 
42
        # Force sending the email
 
43
        ldtp.wait(5)
 
44
 
 
45
        # Get new messages
 
46
        self.application.send_and_receive(password, True, True)
 
47
 
 
48
        # Check that the applet icon changed
 
49
        with_message = indicator.capture_applet_icon()
 
50
 
 
51
        checker = ScreenshotCompare(no_message, with_message)
 
52
        
 
53
        if checker.perform_test() != FAIL:
 
54
            raise AssertionError('icon did not change.', ldtputils.imagecapture())
 
55
 
 
56
 
 
57
 
 
58
 
 
59