mirror of
https://github.com/documize/community.git
synced 2025-08-07 22:45:24 +02:00
Add SSO test
This commit is contained in:
parent
881da18e8a
commit
e26108b90b
6 changed files with 67 additions and 57 deletions
|
@ -3,13 +3,12 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
|||
|
||||
moduleForAcceptance('Acceptance | Anon access disabled');
|
||||
|
||||
|
||||
test('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function(assert) {
|
||||
test('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
visit('/');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/auth/login');
|
||||
findWithAssert('#authEmail');
|
||||
findWithAssert('#authPassword');
|
||||
|
|
|
@ -3,33 +3,33 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
|||
|
||||
moduleForAcceptance('Acceptance | Anon access enabled');
|
||||
|
||||
test('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function(assert) {
|
||||
test('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: true });
|
||||
server.createList('folder', 2);
|
||||
visit('/');
|
||||
// return pauseTest();
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(find('.login').length, 1, 'Login button is displayed');
|
||||
assert.equal(find('.documents-list .document').length, 2, '2 document displayed');
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Dashboard and public spaces are displayed without being signed in');
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test', 'Dashboard and public spaces are displayed without being signed in');
|
||||
});
|
||||
});
|
||||
|
||||
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function(assert) {
|
||||
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: true });
|
||||
server.createList('folder', 2);
|
||||
visit('/');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(find('.login').length, 1, 'Login button is displayed');
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Dashboard displayed without being signed in');
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test', 'Dashboard displayed without being signed in');
|
||||
});
|
||||
|
||||
userLogin();
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(find('.login').length, 0, 'Login button is not displayed');
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Dashboard is displayed after user is signed in');
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test', 'Dashboard is displayed after user is signed in');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
|||
|
||||
moduleForAcceptance('Acceptance | Authentication');
|
||||
|
||||
test('visiting /auth/login and logging in', function(assert) {
|
||||
test('visiting /auth/login and logging in', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
visit('/auth/login');
|
||||
|
@ -12,19 +12,31 @@ test('visiting /auth/login and logging in', function(assert) {
|
|||
fillIn('#authPassword', 'zinyando123');
|
||||
click('button');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Login successfull');
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test', 'Login successfull');
|
||||
});
|
||||
});
|
||||
|
||||
test('logging out a user', function(assert) {
|
||||
test('logging out a user', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
userLogin();
|
||||
|
||||
visit('/auth/logout');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), '/auth/login', 'Login successfull');
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/auth/login', 'Logging out successfull');
|
||||
});
|
||||
});
|
||||
|
||||
test('sso login', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
userLogin();
|
||||
|
||||
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
|
||||
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test', 'Login successfull');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,14 +3,14 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
|||
|
||||
moduleForAcceptance('Acceptance | Documents space');
|
||||
|
||||
skip('Adding a new folder space', function(assert) {
|
||||
skip('Adding a new folder space', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let personalSpaces = find('.section div:contains(PERSONAL)').length;
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||
assert.equal(personalSpaces, 1, '1 personal space is listed');
|
||||
|
@ -22,19 +22,19 @@ skip('Adding a new folder space', function(assert) {
|
|||
|
||||
click('.actions div:contains(Add)', 'body');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
||||
});
|
||||
});
|
||||
|
||||
skip('Adding a document to a space', function(assert) {
|
||||
skip('Adding a document to a space', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
|
||||
let numberOfDocuments = find('.documents-list li').length;
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
@ -44,7 +44,7 @@ skip('Adding a document to a space', function(assert) {
|
|||
click('#start-document-button');
|
||||
click('.actions div:contains(Add)', 'body');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let numberOfDocuments = find('.documents-list li').length;
|
||||
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
@ -52,7 +52,7 @@ skip('Adding a document to a space', function(assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('visiting space settings page', function(assert) {
|
||||
test('visiting space settings page', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
|
@ -61,14 +61,14 @@ test('visiting space settings page', function(assert) {
|
|||
|
||||
click('#folder-settings-button');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
checkForCommonAsserts();
|
||||
assert.equal(find('#folderName').val().trim(), 'My Project', 'Space name displayed in input box');
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||
});
|
||||
});
|
||||
|
||||
test('changing space name', function(assert) {
|
||||
test('changing space name', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
|
@ -80,7 +80,7 @@ test('changing space name', function(assert) {
|
|||
fillIn('#folderName', 'Test Space');
|
||||
click('.button-blue');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let spaceName = find('.info .title').text().trim();
|
||||
checkForCommonAsserts();
|
||||
assert.equal(spaceName, 'Test Space', 'Space name has been changed');
|
||||
|
@ -88,7 +88,7 @@ test('changing space name', function(assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('sharing a space', function(assert) {
|
||||
test('sharing a space', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
|
@ -101,22 +101,21 @@ test('sharing a space', function(assert) {
|
|||
fillIn('#inviteEmail', 'share-test@gmail.com');
|
||||
click('.button-blue');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
checkForCommonAsserts();
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Test will pass after moving to factories
|
||||
test('changing space permissions', function(assert) {
|
||||
test('changing space permissions', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
|
||||
visit('/s/VzMygEw_3WrtFzto/test');
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let numberOfPublicFolders = find('.sidebar-menu .folders-list .section .list:first a').length;
|
||||
assert.equal(numberOfPublicFolders, 1, '1 folder listed as public');
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test');
|
||||
|
@ -133,14 +132,14 @@ test('changing space permissions', function(assert) {
|
|||
visit('/s/VzMygEw_3WrtFzto/test');
|
||||
// return pauseTest();
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let numberOfPublicFolders = find('.folders-list div:contains(EVERYONE) .list a').length;
|
||||
assert.equal(numberOfPublicFolders, 2, '2 folder listed as public');
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test');
|
||||
});
|
||||
});
|
||||
|
||||
test('deleting a space', function(assert) {
|
||||
test('deleting a space', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
|
@ -151,20 +150,20 @@ test('deleting a space', function(assert) {
|
|||
|
||||
click('.sidebar-menu .options li:contains(Delete)');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
checkForCommonAsserts();
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||
});
|
||||
});
|
||||
|
||||
skip('deleting a document', function(assert) {
|
||||
skip('deleting a document', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let deleteButton = find('#delete-documents-button');
|
||||
let numberOfDocuments = find('.documents-list li');
|
||||
assert.equal(numberOfDocuments.length, 2, '2 documents are displayed');
|
||||
|
@ -173,7 +172,7 @@ skip('deleting a document', function(assert) {
|
|||
|
||||
click('.documents-list li:first .checkbox');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let deleteButton = find('#delete-documents-button');
|
||||
assert.equal(deleteButton.length, 1, 'Delete button displayed after selecting document');
|
||||
});
|
||||
|
@ -183,7 +182,7 @@ skip('deleting a document', function(assert) {
|
|||
waitToAppear('.drop-content');
|
||||
click('.actions div:contains(Delete)', 'body');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let numberOfDocuments = find('.documents-list li');
|
||||
assert.equal(numberOfDocuments.length, 1, '1 documents is displayed');
|
||||
});
|
||||
|
|
|
@ -3,12 +3,12 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
|||
|
||||
moduleForAcceptance('Acceptance | user profile');
|
||||
|
||||
test('visiting /profile', function(assert) {
|
||||
test('visiting /profile', function (assert) {
|
||||
server.createList('folder', 2);
|
||||
authenticateUser();
|
||||
visit('/profile');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/profile');
|
||||
assert.equal(find('#firstname').val(), 'Lennex', 'Firstaname input displays correct value');
|
||||
assert.equal(find('#lastname').val(), 'Zinyando', 'Lastname input displays correct value');
|
||||
|
@ -16,12 +16,12 @@ test('visiting /profile', function(assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('changing user details and email ', function(assert) {
|
||||
test('changing user details and email ', function (assert) {
|
||||
server.createList('folder', 2);
|
||||
authenticateUser();
|
||||
visit('/profile');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/profile');
|
||||
assert.equal(find('.content .name').text().trim(), 'Lennex Zinyando', 'Profile name displayed');
|
||||
assert.equal(find('#firstname').val(), 'Lennex', 'Firstaname input displays correct value');
|
||||
|
@ -34,7 +34,7 @@ test('changing user details and email ', function(assert) {
|
|||
fillIn('#email', 'test.user@domain.com');
|
||||
click('.button-blue');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||
assert.equal(find('.content .name').text().trim(), 'Test User', 'Profile name displayed');
|
||||
});
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { test} from 'qunit';
|
||||
import { test } from 'qunit';
|
||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||
|
||||
moduleForAcceptance('Acceptance | User Settings');
|
||||
|
||||
test('visiting /settings/general', function(assert) {
|
||||
test('visiting /settings/general', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
authenticateUser();
|
||||
visit('/settings/general');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/settings/general');
|
||||
assert.equal(find('#siteTitle').val(), 'EmberSherpa', 'Website title input is filled in correctly');
|
||||
assert.equal(find('textarea').val(), 'This Documize instance contains all our team documentation', 'Message is set correctly');
|
||||
|
@ -16,12 +16,12 @@ test('visiting /settings/general', function(assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('changing the Website title and description', function(assert) {
|
||||
test('changing the Website title and description', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
authenticateUser();
|
||||
visit('/settings/general');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let websiteTitle = find('.content .title').text().trim();
|
||||
let websiteTitleInput = find('#siteTitle').val();
|
||||
assert.equal(websiteTitleInput, websiteTitle, 'Website title is set to EmberSherpa');
|
||||
|
@ -30,30 +30,30 @@ test('changing the Website title and description', function(assert) {
|
|||
fillIn('#siteTitle', 'Documize Tests');
|
||||
click('.button-blue');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let websiteTitle = find('.content .title').text().trim();
|
||||
let websiteTitleInput = find('#siteTitle').val();
|
||||
assert.equal(websiteTitleInput, websiteTitle, 'Website title is set to Documize Tests');
|
||||
});
|
||||
});
|
||||
|
||||
test('visiting /settings/folders', function(assert) {
|
||||
test('visiting /settings/folders', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
authenticateUser();
|
||||
visit('/settings/folders');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
checkForCommonAsserts();
|
||||
assert.equal(currentURL(), '/settings/folders');
|
||||
});
|
||||
});
|
||||
|
||||
test('visiting /settings/users', function(assert) {
|
||||
test('visiting /settings/users', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
authenticateUser();
|
||||
visit('/settings/users');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
checkForCommonAsserts();
|
||||
findWithAssert('.user-list');
|
||||
let numberOfUsers = find('.user-list tr').length;
|
||||
|
@ -62,12 +62,12 @@ test('visiting /settings/users', function(assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('add a new user', function(assert) {
|
||||
test('add a new user', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
authenticateUser();
|
||||
visit('/settings/users');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
checkForCommonAsserts();
|
||||
findWithAssert('.user-list');
|
||||
let numberOfUsers = find('.user-list tr').length;
|
||||
|
@ -83,7 +83,7 @@ test('add a new user', function(assert) {
|
|||
// waitToAppear('.user-notification:contains(Added)');
|
||||
// waitToDisappear('.user-notification:contains(Added)');
|
||||
|
||||
andThen(function() {
|
||||
andThen(function () {
|
||||
let numberOfUsers = find('.user-list tr').length;
|
||||
assert.equal(numberOfUsers, 4, '3 Users listed');
|
||||
assert.equal(currentURL(), '/settings/users');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue