mirror of
https://github.com/documize/community.git
synced 2025-08-09 23:45:28 +02:00
Initial auth tests and tests for allowAnonymousAccess
This commit is contained in:
parent
a46beecdf5
commit
5a4dc1534f
2 changed files with 49 additions and 15 deletions
26
app/tests/acceptance/authentication-test.js
Normal file
26
app/tests/acceptance/authentication-test.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import { test } from 'qunit';
|
||||||
|
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
|
|
||||||
|
moduleForAcceptance('Acceptance | authentication');
|
||||||
|
|
||||||
|
test('visiting /auth/login and logging in', function(assert) {
|
||||||
|
visit('/auth/login');
|
||||||
|
|
||||||
|
fillIn('#authEmail', 'brizdigital@gmail.com');
|
||||||
|
fillIn('#authPassword', 'zinyando123');
|
||||||
|
click('button');
|
||||||
|
|
||||||
|
andThen(function() {
|
||||||
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('logging out a user', function(assert) {
|
||||||
|
userLogin();
|
||||||
|
|
||||||
|
visit('/auth/logout'); // logs a user out
|
||||||
|
|
||||||
|
andThen(function() {
|
||||||
|
assert.equal(currentURL(), '/');
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,21 +1,29 @@
|
||||||
import { test } 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 stubSession from '../helpers/stub-session';
|
||||||
|
|
||||||
moduleForAcceptance('Acceptance | /');
|
moduleForAcceptance('Acceptance | /');
|
||||||
|
|
||||||
// TODO: when accessing / with /api/public/meta -> { allowAnonymousAccess: false } then take user to login
|
skip('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function(assert) {
|
||||||
// TODO: when accessing / with /api/public/meta -> { allowAnonymousAccess: true } then take user to folers.index
|
visit('/');
|
||||||
// TODO: when accessing / with /api/public/meta -> { allowAnonymousAccess: true } and user is authenticated -> show authenticated user information
|
|
||||||
|
|
||||||
test('visiting /', function(assert) {
|
andThen(function() {
|
||||||
visit('/');
|
assert.equal(currentURL(), '/auth/login');
|
||||||
|
});
|
||||||
return pauseTest();
|
});
|
||||||
|
|
||||||
// setup mirage for /api/public/meta -> { allowAnonymousAccess: false}
|
skip('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function(assert) {
|
||||||
|
visit('/');
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
assert.equal(currentURL(), '/auth/login');
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
skip('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function(assert) {
|
||||||
|
userLogin();
|
||||||
|
|
||||||
|
andThen(function() {
|
||||||
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue