mirror of
https://github.com/documize/community.git
synced 2025-07-23 07:09:43 +02:00
Add more tests and cleanup old ones
This commit is contained in:
parent
68271646eb
commit
c3c7a8450c
7 changed files with 75 additions and 62 deletions
|
@ -9,6 +9,33 @@
|
|||
//
|
||||
// https://documize.com
|
||||
|
||||
import { Factory } from 'ember-cli-mirage';
|
||||
import { Factory, faker } from 'ember-cli-mirage';
|
||||
|
||||
export default Factory.extend({});
|
||||
export default Factory.extend({
|
||||
"id": faker.list.cycle("VzMwX0w_3WrtFztd", "VzMvJEw_3WqiafcI", "VzMzBUw_3WrtFztv"),
|
||||
"created": "2016-05-11T13:15:11Z",
|
||||
"revised": "2016-05-11T13:22:16Z",
|
||||
"orgId": "VzMuyEw_3WqiafcD",
|
||||
"folderId": "VzMuyEw_3WqiafcG",
|
||||
"userId": "VzMuyEw_3WqiafcE",
|
||||
"job": faker.list.cycle("", "0bf9b076-cb74-4e8e-75be-8ee2d24a8171", "3004c449-b053-49a6-4abc-72688136184d"),
|
||||
"location": faker.list.cycle("template-0", "/var/folders/README.md", "/var/folders/d6/3004c449-b053-49a6-4abc-72688136184d/README.md"),
|
||||
"name": faker.list.cycle("Empty Document", "README", "README"),
|
||||
"excerpt": faker.list.cycle("My test document", "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.", "To Document/ Instructions. GO. go- bindata- assetsfs. SSL."),
|
||||
"tags": "",
|
||||
"template": false
|
||||
});
|
||||
// return {
|
||||
// "id": "VzMzBUw_3WrtFztv",
|
||||
// "created": "2016-05-11T13:26:29Z",
|
||||
// "revised": "2016-05-11T13:26:29Z",
|
||||
// "orgId": "VzMuyEw_3WqiafcD",
|
||||
// "folderId": "VzMygEw_3WrtFzto",
|
||||
// "userId": "VzMuyEw_3WqiafcE",
|
||||
// "job": "3004c449-b053-49a6-4abc-72688136184d",
|
||||
// "location": "/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/3004c449-b053-49a6-4abc-72688136184d/README.md",
|
||||
// "name": "README",
|
||||
// "excerpt": "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
|
||||
// "tags": "",
|
||||
// "template": false
|
||||
// };
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Anon access disabled');
|
|||
|
||||
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 () {
|
||||
|
@ -25,4 +24,4 @@ test('visiting / when not authenticated and with { allowAnonymousAccess: false }
|
|||
findWithAssert('#authPassword');
|
||||
findWithAssert('button');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Anon access enabled');
|
|||
|
||||
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('/');
|
||||
|
||||
andThen(function () {
|
||||
|
@ -28,8 +27,6 @@ test('visiting / when not authenticated and with { allowAnonymousAccess: true }
|
|||
|
||||
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: true });
|
||||
server.createList('folder', 2);
|
||||
server.createList('user', 2);
|
||||
visit('/');
|
||||
|
||||
andThen(function () {
|
||||
|
@ -39,8 +36,6 @@ test('visiting / when authenticated and with { allowAnonymousAccess: true } take
|
|||
|
||||
userLogin();
|
||||
|
||||
// return pauseTest();
|
||||
|
||||
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');
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Authentication');
|
|||
|
||||
test('visiting /auth/login and logging in', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
visit('/auth/login');
|
||||
|
||||
fillIn('#authEmail', 'brizdigital@gmail.com');
|
||||
|
@ -30,7 +29,6 @@ test('visiting /auth/login and logging in', function (assert) {
|
|||
|
||||
test('logging out a user', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
userLogin();
|
||||
|
||||
visit('/auth/logout');
|
||||
|
@ -42,7 +40,6 @@ test('logging out a user', function (assert) {
|
|||
|
||||
test('successful sso login authenticates redirects to dashboard', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
|
||||
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
|
||||
|
||||
|
@ -53,11 +50,10 @@ test('successful sso login authenticates redirects to dashboard', function (asse
|
|||
|
||||
test('sso login with bad token should redirect to login', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
|
||||
visit('/auth/sso/randomToken1234567890');
|
||||
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/auth/login', 'SSO login unsuccessful');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,39 +9,38 @@
|
|||
//
|
||||
// https://documize.com
|
||||
|
||||
import { test, skip } from 'qunit';
|
||||
import { test } from 'qunit';
|
||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||
|
||||
moduleForAcceptance('Acceptance | Documents space');
|
||||
|
||||
skip('Adding a new folder space', function (assert) {
|
||||
test('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 () {
|
||||
let personalSpaces = find('.section div:contains(PERSONAL)').length;
|
||||
let personalSpaces = find('.folders-list div:contains(PERSONAL) .list a').length;
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||
assert.equal(personalSpaces, 1, '1 personal space is listed');
|
||||
});
|
||||
|
||||
click('#add-folder-button');
|
||||
|
||||
fillIn('#new-folder-name', 'body', 'Test Folder');
|
||||
fillIn('#new-folder-name', 'Test Folder');
|
||||
|
||||
click('.actions div:contains(Add)', 'body');
|
||||
click('.actions div:contains(Add)');
|
||||
|
||||
andThen(function () {
|
||||
let folderCount = find('.folders-list div:contains(PERSONAL) .list a').length;
|
||||
assert.equal(folderCount, 2, 'New folder has been added');
|
||||
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
skip('Adding a document to a space', function (assert) {
|
||||
test('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');
|
||||
|
||||
|
@ -52,21 +51,22 @@ skip('Adding a document to a space', function (assert) {
|
|||
assert.equal(numberOfDocuments, 2, '2 documents listed');
|
||||
});
|
||||
|
||||
click('#start-document-button');
|
||||
click('.actions div:contains(Add)', 'body');
|
||||
click('.actions div:contains(Start) .flat-green');
|
||||
|
||||
andThen(function () {
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project/d/V4y7jkw_3QvCDSeS/new-document', 'New document displayed');
|
||||
});
|
||||
|
||||
click('a div:contains(My Project) .space-name');
|
||||
|
||||
andThen(function () {
|
||||
let numberOfDocuments = find('.documents-list li').length;
|
||||
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||
});
|
||||
});
|
||||
|
||||
test('visiting space settings page', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
server.createList('folder-permission', 2);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
|
@ -81,8 +81,6 @@ test('visiting space settings page', function (assert) {
|
|||
|
||||
test('changing space name', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
|
@ -101,8 +99,6 @@ test('changing space name', function (assert) {
|
|||
|
||||
test('sharing a space', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
|
@ -118,12 +114,8 @@ test('sharing a space', function (assert) {
|
|||
});
|
||||
});
|
||||
|
||||
// Test will pass after moving to factories
|
||||
test('changing space permissions', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
server.createList('folder-permission', 2);
|
||||
authenticateUser();
|
||||
|
||||
visit('/s/VzMygEw_3WrtFzto/test');
|
||||
|
@ -152,8 +144,6 @@ test('changing space permissions', function (assert) {
|
|||
|
||||
test('deleting a space', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('folder', 2);
|
||||
server.createList('permission', 4);
|
||||
authenticateUser();
|
||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||
|
||||
|
@ -167,10 +157,8 @@ test('deleting a space', function (assert) {
|
|||
});
|
||||
});
|
||||
|
||||
skip('deleting a document', function (assert) {
|
||||
test('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');
|
||||
|
||||
|
@ -188,10 +176,7 @@ skip('deleting a document', function (assert) {
|
|||
assert.equal(deleteButton.length, 1, 'Delete button displayed after selecting document');
|
||||
});
|
||||
|
||||
click('#delete-documents-button');
|
||||
|
||||
waitToAppear('.drop-content');
|
||||
click('.actions div:contains(Delete)', 'body');
|
||||
click('.actions div:contains(Delete) .flat-red');
|
||||
|
||||
andThen(function () {
|
||||
let numberOfDocuments = find('.documents-list li');
|
||||
|
@ -199,6 +184,28 @@ skip('deleting a document', function (assert) {
|
|||
});
|
||||
});
|
||||
|
||||
test('clicking a document title displays the document', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
authenticateUser();
|
||||
visit('/s/VzMygEw_3WrtFzto/test');
|
||||
|
||||
click('a .title:contains(README)');
|
||||
|
||||
andThen(function () {
|
||||
findWithAssert('#add-section-button');
|
||||
findWithAssert('#delete-document-button');
|
||||
findWithAssert('#print-document-button');
|
||||
findWithAssert('#save-template-button');
|
||||
findWithAssert('#attachment-button');
|
||||
findWithAssert('#set-meta-button');
|
||||
findWithAssert('.name.space-name');
|
||||
findWithAssert('.document-sidebar');
|
||||
let title = find('.zone-header .title').text().trim();
|
||||
assert.equal(title, 'README', 'document displayed correctly');
|
||||
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test/d/VzMvJEw_3WqiafcI/readme');
|
||||
});
|
||||
});
|
||||
|
||||
function checkForCommonAsserts() {
|
||||
findWithAssert('.sidebar-menu');
|
||||
findWithAssert('.options li:contains(General)');
|
||||
|
|
|
@ -15,8 +15,6 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
|||
moduleForAcceptance('Acceptance | user profile');
|
||||
|
||||
test('visiting /profile', function (assert) {
|
||||
server.createList('folder', 2);
|
||||
server.createList('user', 2);
|
||||
authenticateUser();
|
||||
visit('/profile');
|
||||
|
||||
|
@ -29,8 +27,6 @@ test('visiting /profile', function (assert) {
|
|||
});
|
||||
|
||||
test('changing user details and email ', function (assert) {
|
||||
server.createList('folder', 2);
|
||||
server.createList('user', 2);
|
||||
authenticateUser();
|
||||
visit('/profile');
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | User Settings');
|
|||
|
||||
test('visiting /settings/general', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('organization', 1);
|
||||
authenticateUser();
|
||||
visit('/settings/general');
|
||||
|
||||
|
@ -30,7 +29,6 @@ test('visiting /settings/general', function (assert) {
|
|||
|
||||
test('changing the Website title and description', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('organization', 1);
|
||||
authenticateUser();
|
||||
visit('/settings/general');
|
||||
|
||||
|
@ -63,7 +61,6 @@ test('visiting /settings/folders', function (assert) {
|
|||
|
||||
test('visiting /settings/users', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('user', 2);
|
||||
authenticateUser();
|
||||
visit('/settings/users');
|
||||
|
||||
|
@ -78,7 +75,6 @@ test('visiting /settings/users', function (assert) {
|
|||
|
||||
test('add a new user', function (assert) {
|
||||
server.create('meta', { allowAnonymousAccess: false });
|
||||
server.createList('user', 2);
|
||||
authenticateUser();
|
||||
visit('/settings/users');
|
||||
|
||||
|
@ -95,9 +91,6 @@ test('add a new user', function (assert) {
|
|||
fillIn('#newUserEmail', 'test.user@domain.com');
|
||||
click('.button-blue');
|
||||
|
||||
// waitToAppear('.user-notification:contains(Added)');
|
||||
// waitToDisappear('.user-notification:contains(Added)');
|
||||
|
||||
andThen(function () {
|
||||
let numberOfUsers = find('.user-list tr').length;
|
||||
assert.equal(numberOfUsers, 4, '3 Users listed');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue