~canonical-platform-qa/ubuntu-system-tests/command-line-dist-upgrade

« back to all changes in this revision

Viewing changes to ubuntu_system_tests/tests/test_email.py

  • Committer: Tarmac
  • Author(s): Omer Akram, Omer Akram
  • Date: 2016-04-27 18:46:59 UTC
  • mfrom: (358.3.14 test_add_imap_account)
  • Revision ID: tarmac-20160427184659-586ke5p904qbxakz
new test: add imap account.

Approved by Richard Huddie, platform-qa-bot, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from testtools.matchers import Equals
20
20
 
21
21
from ubuntu_system_tests.helpers import dekko
 
22
from ubuntu_system_tests.helpers.data import load_test_metadata
22
23
from ubuntu_system_tests.helpers.dekko import fixture_setup as dekko_fixture
23
24
from ubuntu_system_tests.tests import base
24
25
 
 
26
email_data = load_test_metadata().email
 
27
 
25
28
 
26
29
class EmailSetupTestCase(base.BaseUbuntuSystemTestCase):
27
30
 
34
37
            self.dekko.no_accounts_page.visible, Eventually(Equals(True)))
35
38
        self.config = get_test_configuration()
36
39
 
37
 
    def _add_generic_email_account(self, provider_name, address, password):
 
40
    def _add_new_email_account(self, email_provider):
38
41
        accounts_list = self.dekko.no_accounts_page.add_new_account()
39
 
        login_page = accounts_list.add_generic_account(name=provider_name)
 
42
        return accounts_list.add_email_account(name=email_provider)
 
43
 
 
44
    def _add_basic_authentication_email_account(
 
45
            self, provider_name, address, password):
 
46
        login_page = self._add_new_email_account(email_provider=provider_name)
40
47
        identity_page = login_page.login(email=address, password=password)
41
48
        self.assertIsNotNone(identity_page, 'email or password invalid')
42
49
        details_page = identity_page.go_to_details_page()
49
56
        3. Enter credentials and complete the wizard
50
57
        4. Ensure login is successful
51
58
        """
52
 
        self._add_generic_email_account(
 
59
        self._add_basic_authentication_email_account(
53
60
            'yahoo', self.config.get('email_yahoo'),
54
61
            self.config.get('password_yahoo'))
55
62
 
60
67
        3. Enter credentials and complete the wizard
61
68
        4. Ensure login is successful
62
69
        """
63
 
        self._add_generic_email_account(
 
70
        self._add_basic_authentication_email_account(
64
71
            'outlook', self.config.get('email_outlook'),
65
72
            self.config.get('password_outlook'))
 
73
 
 
74
    def test_add_imap_account(self):
 
75
        """
 
76
        1. Launch dekko and add a new account
 
77
        2. Select IMAP account
 
78
        3. Enter credentials and complete the wizard
 
79
        4. Ensure login is successful
 
80
        """
 
81
        login_page = self._add_new_email_account(email_provider='imap')
 
82
        server_details_page = login_page.login_imap(
 
83
            username=self.config.get('username_imap'),
 
84
            password=self.config.get('password_imap'))
 
85
        account_details_page = server_details_page.enter_imap_server_details(
 
86
            host=email_data.imap_server_details.hostname,
 
87
            port=email_data.imap_server_details.port,
 
88
            encryption=email_data.imap_server_details.encryption)
 
89
        self.assertIsNotNone(
 
90
            account_details_page, message='username or password invalid')
 
91
        account_details_page.finish_wizard()