check mail using imap probe

This commit is contained in:
Girish Ramakrishnan 2016-06-23 21:47:49 -05:00
parent 0412ca1f43
commit 150b65ae64

View File

@ -10,6 +10,7 @@ var AppStore = require('../appstore.js'),
Cloudron = require('../cloudron.js'),
common = require('../common.js'),
dnsSync = require('dns-sync'),
ImapProbe = require('../imap-probe.js'),
mailer = require('../mailer.js'),
sleep = require('sleep').sleep;
@ -25,7 +26,7 @@ describe('Cloudron backup testing', function () {
var owner = common.getOwner();
var admin = common.getAdmin();
var cloudron, appId, box, backupInfo;
var cloudron, appId, box, backupInfo, imap;
it('can login to the store', function () {
var accessToken = appStore.getAccessToken(owner);
@ -44,6 +45,16 @@ describe('Cloudron backup testing', function () {
});
box = appStore.waitForCloudron(box.id);
cloudron = new Cloudron(box);
imap = new ImapProbe({
user: common.getOwner().username,
password: common.getOwner().password,
host: cloudron.adminFqdn(),
port: 993, // imap port
tls: true,
tlsOptions: { rejectUnauthorized: false },
readOnly: true
});
});
it('can activate the box', function () {
@ -63,6 +74,14 @@ describe('Cloudron backup testing', function () {
cloudron.saveSieveScript(owner, done);
});
it('can receive mail', function (done) {
imap.probe({
subject: new RegExp('^Hi from e2e test$'),
to: new RegExp(owner.username + '@' + box.domain),
body: /The release depends on you/
}, done);
});
var location = 'test' + (Math.random() * 10000).toFixed();
it('can install app', function () {
var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION);
@ -102,6 +121,18 @@ describe('Cloudron backup testing', function () {
cloudron.setCredentials(owner.password, token);
});
it('retains old mail', function (done) {
imap.probe({
subject: new RegExp('^Hi from e2e test$'),
to: new RegExp(owner.username + '@' + box.domain),
body: /The release depends on you/
}, done);
});
it('can check sieve script', function (done) {
cloudron.checkSieveScript(owner, done);
});
it('wait for app', function () {
cloudron.waitForApp(appId);
});
@ -114,14 +145,6 @@ describe('Cloudron backup testing', function () {
cloudron.uninstallApp(appId);
});
it('can check mail', function (done) {
cloudron.checkMail(owner, done);
});
it('can check sieve script', function (done) {
cloudron.checkSieveScript(owner, done);
});
it('can delete the cloudron', function () {
appStore.deleteCloudron(box);
});