~alexlauni/webapps-applications/webapps-application-common

« back to all changes in this revision

Viewing changes to tests/YandexMail.js

  • Committer: Alex Launi
  • Date: 2013-02-13 15:55:38 UTC
  • Revision ID: alex.launi@canonical.com-20130213155538-n6x4wvgm6cpr981b
begin reduction to just common elements

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function Test(browser) {
2
 
    this._init(browser);
3
 
}
4
 
 
5
 
Test.prototype = {
6
 
    _init: function (browser) {
7
 
        this._state = 0;
8
 
        this._login = browser.getLogin();
9
 
        this._password = browser.getPassword();
10
 
        this._url = browser.getUrl();
11
 
        this._browser = browser;
12
 
        browser.open(this._url);
13
 
    },
14
 
 
15
 
    onLoad: function () {
16
 
        if (!this._login) {
17
 
            this._browser.skipTest();
18
 
        }
19
 
        if (this._state === 0) {
20
 
            this._state++;
21
 
            this._browser.injectScript(makeAuthorizer('b-mail-domik-username11', 'b-mail-domik-password11', this._login, this._password));
22
 
        } else {
23
 
            setTimeout(this._browser.finish.bind(this._browser), 15000);
24
 
        }
25
 
    },
26
 
 
27
 
    validateCallLog: function (log, out) {
28
 
        assertEquals('Unity.init', log[0].func, 'Unity.init');
29
 
        var i;
30
 
        var found = false;
31
 
        for (i = 0; i < out.length; i++) {
32
 
            if (out[i] === 'PASS SELF TEST') {
33
 
                found = true;
34
 
            }
35
 
        }
36
 
        assertTrue('PASS SELF TEST', found);
37
 
    },
38
 
 
39
 
    scriptName: 'YandexMail/YandexMail.user.js'
40
 
};