Mailspring/spec_integration/clean-app-boot-spec.es6
Ben Gotow c6354feb41 feat(pro): New Nylas identity provider, onboarding and auth
commit 50d0cfb87c
Author: Ben Gotow <bengotow@gmail.com>
Date:   Fri May 27 14:01:49 2016 -0700

    IdentityStore conveniene methods for subscription state

commit 80c3c7b956
Author: Ben Gotow <bengotow@gmail.com>
Date:   Fri May 27 12:03:53 2016 -0700

    Periodically refresh identity, show expired notice in top bar

commit 5dc39efe98
Merge: 4c4f463 906ea74
Author: Juan Tejada <juans.tejada@gmail.com>
Date:   Thu May 26 15:17:46 2016 -0700

    Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro

commit 4c4f463f4b
Author: Juan Tejada <juans.tejada@gmail.com>
Date:   Thu May 26 15:16:48 2016 -0700

    Hijack links inside email that go to billing site and add SSO to them

commit 906ea74807
Author: Ben Gotow <bengotow@gmail.com>
Date:   Thu May 26 12:02:29 2016 -0700

    Add custom welcome page for upgrading users

commit 2ba9aedfe9
Author: Juan Tejada <juans.tejada@gmail.com>
Date:   Wed May 25 17:27:12 2016 -0700

    Add styling to Subscription tab in prefs

commit 384433a338
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 16:21:18 2016 -0700

    Add better style reset, more IdentityStore changes

commit c4f9dfb4e4
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 15:29:41 2016 -0700

    Add subscription tab

commit bd4c25405a
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 14:18:40 2016 -0700

    Point to billing-staging for now

commit 578e808bfc
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 13:30:13 2016 -0700

    Rename account helpers > onboarding helpers

commit dfea0a9861
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 13:26:46 2016 -0700

    A few minor fixes

commit 7110217fd4
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 12:58:21 2016 -0700

    feat(onboarding): Nylas Pro onboarding overhaul

    Summary:
    Rip out all invite-related code

    Enable Templates and Translate by default

    Scrub packages page, unused code in onboarding pkg

    Remove resizing

    New onboarding screens

    IMAP provider list, validation

    Call success with response object as well

    Renaming and tweaks

    Test Plan: No tests yet

    Reviewers: evan, juan, jackie

    Differential Revision: https://phab.nylas.com/D2985

commit dc9ea45ca9
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 12:52:39 2016 -0700

    Renaming and tweaks

commit 5ca4cd31ce
Author: Ben Gotow <bengotow@gmail.com>
Date:   Wed May 25 11:03:57 2016 -0700

    Call success with response object as well

commit 45f14f9b00
Author: Ben Gotow <bengotow@gmail.com>
Date:   Tue May 24 18:26:38 2016 -0700

    IMAP provider list, validation

commit c6ca124e6e
Author: Ben Gotow <bengotow@gmail.com>
Date:   Sat May 21 11:14:44 2016 -0700

    New onboarding screens

commit dad918d926
Author: Ben Gotow <bengotow@gmail.com>
Date:   Thu May 19 16:37:31 2016 -0700

    Remove resizing

commit ecb1a569e2
Author: Ben Gotow <bengotow@gmail.com>
Date:   Thu May 19 16:36:04 2016 -0700

    Scrub packages page, unused code in onboarding pkg

commit 3e0a44156c
Author: Ben Gotow <bengotow@gmail.com>
Date:   Thu May 19 16:33:12 2016 -0700

    Enable Templates and Translate by default

commit 0d218bc86f
Author: Ben Gotow <bengotow@gmail.com>
Date:   Thu May 19 16:30:47 2016 -0700

    Rip out all invite-related code
2016-05-27 14:21:19 -07:00

107 lines
3.6 KiB
JavaScript

import fs from 'fs';
import path from 'path';
import N1Launcher from './helpers/n1-launcher';
import {currentConfig, FAKE_DATA_PATH} from './helpers/config-helper';
import {assertBasicWindow, assertNoErrorsInLogs} from './helpers/shared-assertions';
import {clickRepeat, wait} from './helpers/client-actions';
describe('Clean app boot', ()=> {
beforeAll((done)=>{
// Boot in dev mode with no arguments
this.app = new N1Launcher(['--dev'], N1Launcher.CLEAR_CONFIG);
this.app.onboardingWindowReady().finally(done);
});
afterAll((done)=> {
if (this.app && this.app.isRunning()) {
this.app.stop().finally(done);
} else {
done();
}
});
it("has the autoupdater pointing to the correct url when there's no config loaded", () => {
this.app.client.execute(()=>{
const app = require('electron').remote.getGlobal('application');
return {
platform: process.platform,
arch: process.arch,
feedUrl: app.autoUpdateManager.feedURL,
};
}).then(({value})=>{
const base = 'https://edgehill.nylas.com/update-check';
const config = currentConfig();
// NOTE: Since there's no loaded config yet (we haven't logged in),
// a random id will be sent with no emails
const url = `${base}?platform=${value.platform}&arch=${value.arch}&version=${config.version}`;
expect(value.feedUrl.indexOf(url)).toBe(0);
});
});
assertBasicWindow.call(this);
it('has width', (done)=> {
this.app.client.getWindowWidth()
.then((result)=> expect(result).toBeGreaterThan(0) )
.finally(done);
});
it('has height', (done)=> {
this.app.client.getWindowHeight()
.then((result)=> expect(result).toBeGreaterThan(0) )
.finally(done);
});
it('can sign up using Gmail', ()=> {
// TODO
});
it('can sign up using Exchange', (done)=> {
const client = this.app.client;
const fakeAccountJson = fs.readFileSync(
path.join(FAKE_DATA_PATH, 'account_exchange.json'),
'utf8'
);
client.execute((jsonStr)=> {
// Monkeypatch NylasAPI and EdgehillAPI
const json = JSON.parse(jsonStr);
$n._nylasApiMakeRequest = $n.NylasAPI.makeRequest;
$n._edgehillRequest = $n.EdgehillAPI.makeRequest;
$n.NylasAPI.makeRequest = ()=> {
return Promise.resolve(json);
};
$n.EdgehillAPI.makeRequest = ({success})=> {
success(json);
};
}, fakeAccountJson)
.then(()=> clickRepeat(client, '.btn-continue', {times: 3, interval: 500}))
.then(()=> client.click('.provider.exchange'))
.then(()=> wait(500))
.then(()=> client.click('input[data-field="name"]'))
.then(()=> client.keys('name'))
.then(()=> client.click('input[data-field="email"]'))
.then(()=> client.keys('email@nylas.com'))
.then(()=> client.click('input[data-field="password"]'))
.then(()=> client.keys('password'))
.then(()=> client.click('.btn-add-account'))
.then(()=> wait(500))
.then(()=> {
// Expect the onboarding window to have no errors at this point
return assertNoErrorsInLogs(client);
})
.then(()=> client.click('button.btn-large'))
.then(()=> wait(500))
.then(()=> client.click('.btn-get-started'))
.then(()=> wait(500))
.then(()=> N1Launcher.waitUntilMatchingWindowLoaded(client, N1Launcher.mainWindowLoadedMatcher))
.then(()=> {
// Expect the main window logs to contain no errors
// This will run on the main window because waitUntilMatchingWindowLoaded
// focuses the window after its loaded
return assertNoErrorsInLogs(client);
})
.finally(done);
});
});