Add a test for the login flow when there is a teamserver

- just to check it keeps working.
This commit is contained in:
Richard van der Hoff 2017-06-15 02:17:24 +01:00
parent 5ff59b0c23
commit 98e694646c
2 changed files with 68 additions and 4 deletions

View file

@ -135,14 +135,17 @@ describe('loading:', function () {
const MatrixChat = sdk.getComponent('structures.MatrixChat');
const fragParts = parseQsFromFragment(windowLocation);
const config = Object.assign({
default_hs_url: DEFAULT_HS_URL,
default_is_url: DEFAULT_IS_URL,
}, opts.config || {});
var params = parseQs(windowLocation);
matrixChat = ReactDOM.render(
<MatrixChat
onNewScreen={onNewScreen}
config={{
default_hs_url: DEFAULT_HS_URL,
default_is_url: DEFAULT_IS_URL,
}}
config={config}
realQueryParams={params}
startingFragmentQueryParams={fragParts.params}
enableGuest={true}
@ -343,6 +346,40 @@ describe('loading:', function () {
}).done(done, done);
});
it("registers correctly with a Riot Team Server", function() {
sdk.setFetch(httpBackend.fetchFn); // XXX: ought to restore this!
httpBackend.when('GET', '/pushrules').respond(200, {});
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });
loadApp({
config: {
teamServerConfig: {
teamServerURL: 'http://my_team_server',
},
},
});
return q.delay(1).then(() => {
// we expect a loading spinner while we log into the RTS
assertAtLoadingSpinner(matrixChat);
httpBackend.when('GET', 'my_team_server/login').respond(200, {
team_token: 'nom',
});
return httpBackend.flush();
}).then(() => {
return awaitSyncingSpinner(matrixChat)
}).then(() => {
// we got a sync spinner - let the sync complete
return expectAndAwaitSync();
}).then(() => {
// once the sync completes, we should have a home page
ReactTestUtils.findRenderedComponentWithType(
matrixChat, sdk.getComponent('structures.HomePage'));
});
});
describe('/#/login link:', function() {
beforeEach(function() {
loadApp({