mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
Use factories in tests
This commit is contained in:
parent
05bd894d45
commit
368bb6850e
6 changed files with 47 additions and 16 deletions
|
@ -6,6 +6,7 @@ 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.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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.create('meta', { allowAnonymousAccess: true });
|
||||||
|
server.createList('folder', 2);
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
|
@ -16,6 +17,7 @@ test('visiting / when not authenticated and with { allowAnonymousAccess: true }
|
||||||
|
|
||||||
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.create('meta', { allowAnonymousAccess: true });
|
||||||
|
server.createList('folder', 2);
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { test, skip } from 'qunit';
|
import { test } from 'qunit';
|
||||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
|
|
||||||
moduleForAcceptance('Acceptance | Authentication');
|
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.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
visit('/auth/login');
|
visit('/auth/login');
|
||||||
|
|
||||||
fillIn('#authEmail', 'brizdigital@gmail.com');
|
fillIn('#authEmail', 'brizdigital@gmail.com');
|
||||||
|
@ -12,17 +13,18 @@ test('visiting /auth/login and logging in', function(assert) {
|
||||||
click('button');
|
click('button');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Login successfull');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
skip('logging out a user', function(assert) {
|
test('logging out a user', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
userLogin();
|
userLogin();
|
||||||
|
|
||||||
visit('/auth/logout'); // logs a user out
|
visit('/auth/logout');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
assert.equal(currentURL(), '/');
|
assert.equal(currentURL(), '/auth/login', 'Login successfull');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import { test, skip } from 'qunit';
|
import { test, skip } from 'qunit';
|
||||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
moduleForAcceptance('Acceptance | documents space');
|
moduleForAcceptance('Acceptance | Documents space');
|
||||||
|
|
||||||
test('Adding a new folder space', function(assert) {
|
test('Adding a new folder space', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -15,17 +18,21 @@ test('Adding a new folder space', function(assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#add-folder-button');
|
click('#add-folder-button');
|
||||||
waitToAppear('#new-folder-name');
|
|
||||||
fillIn(".input-control input", 'Test Folder');
|
fillIn('#new-folder-name', 'body', 'Test Folder');
|
||||||
click('.actions div:contains(add)');
|
|
||||||
|
click('.actions div:contains(Add)', 'body');
|
||||||
|
// return pauseTest();
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
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.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -37,16 +44,20 @@ skip('Adding a document to a space', function(assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#start-document-button');
|
click('#start-document-button');
|
||||||
waitToAppear('.drop-content');
|
click('.actions div:contains(Add)', 'body');
|
||||||
click('.drop-content');
|
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
assert.equal(currentURL(), 's/V0Vy5Uw_3QeDAMW9/test-folder');
|
let numberOfDocuments = find('.documents-list li').length;
|
||||||
|
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
||||||
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
// return pauseTest();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('visiting space settings page', function(assert) {
|
test('visiting space settings page', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -61,6 +72,8 @@ test('visiting space settings page', function(assert) {
|
||||||
|
|
||||||
test('changing space name', function(assert) {
|
test('changing space name', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||||
|
|
||||||
|
@ -77,6 +90,8 @@ test('changing space name', function(assert) {
|
||||||
|
|
||||||
test('sharing a space', function(assert) {
|
test('sharing a space', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||||
|
|
||||||
|
@ -94,6 +109,8 @@ test('sharing a space', function(assert) {
|
||||||
// Test will pass after moving to factories
|
// 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.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
let numberOfPublicFolders = find('.folders-list div:first .list a').length;
|
let numberOfPublicFolders = find('.folders-list div:first .list a').length;
|
||||||
|
@ -119,6 +136,8 @@ test('changing space permissions', function(assert) {
|
||||||
|
|
||||||
test('deleting a space', function(assert) {
|
test('deleting a space', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||||
|
|
||||||
|
@ -132,6 +151,8 @@ test('deleting a space', function(assert) {
|
||||||
|
|
||||||
test('deleting a document', function(assert) {
|
test('deleting a document', function(assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -152,11 +173,11 @@ test('deleting a document', function(assert) {
|
||||||
click('#delete-documents-button');
|
click('#delete-documents-button');
|
||||||
|
|
||||||
waitToAppear('.drop-content');
|
waitToAppear('.drop-content');
|
||||||
click('.flat-red');
|
click('.actions div:contains(Delete)', 'body');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
let deleteButton = find('#delete-documents-button');
|
let numberOfDocuments = find('.documents-list li');
|
||||||
assert.equal(deleteButton.length, 1, 'Delete button displayed');
|
assert.equal(numberOfDocuments.length, 1, '1 documents is displayed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
moduleForAcceptance('Acceptance | user profile');
|
moduleForAcceptance('Acceptance | user profile');
|
||||||
|
|
||||||
test('visiting /profile', function(assert) {
|
test('visiting /profile', function(assert) {
|
||||||
|
server.createList('folder', 2);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/profile');
|
visit('/profile');
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ 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);
|
||||||
userLogin();
|
userLogin();
|
||||||
visit('/profile');
|
visit('/profile');
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,9 @@ test('add a new user', function(assert) {
|
||||||
fillIn('#newUserEmail', 'test.user@domain.com');
|
fillIn('#newUserEmail', 'test.user@domain.com');
|
||||||
click('.button-blue');
|
click('.button-blue');
|
||||||
|
|
||||||
|
// waitToAppear('.user-notification:contains(Added)');
|
||||||
|
// waitToDisappear('.user-notification:contains(Added)');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
let numberOfUsers = find('.user-list tr').length;
|
let numberOfUsers = find('.user-list tr').length;
|
||||||
assert.equal(numberOfUsers, 4, '3 Users listed');
|
assert.equal(numberOfUsers, 4, '3 Users listed');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue