1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-30 18:49:43 +02:00

[WIP] Upgrading EmberJS codemods

This commit is contained in:
Harvey Kandola 2018-12-08 15:39:31 +00:00
parent 4b68529090
commit 5cfbf07e55
8 changed files with 376 additions and 425 deletions

View file

@ -1,3 +1,4 @@
import { click, fillIn, currentURL, visit } from '@ember/test-helpers';
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
@ -9,50 +10,44 @@
//
// https://documize.com
import { test } from 'qunit';
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
moduleForAcceptance('Acceptance | Authentication');
module('Acceptance | Authentication', function(hooks) {
setupApplicationTest(hooks);
test('visiting /auth/login and logging in', function (assert) {
server.create('meta', { allowAnonymousAccess: false });
visit('/auth/login');
test('visiting /auth/login and logging in', async function(assert) {
server.create('meta', { allowAnonymousAccess: false });
await visit('/auth/login');
fillIn('#authEmail', 'brizdigital@gmail.com');
fillIn('#authPassword', 'zinyando123');
click('button');
await fillIn('#authEmail', 'brizdigital@gmail.com');
await fillIn('#authPassword', 'zinyando123');
await click('button');
andThen(function () {
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Login successful');
});
});
test('logging out a user', function (assert) {
server.create('meta', { allowAnonymousAccess: false });
userLogin();
click('.dropdown-menu a:contains(Logout)');
andThen(function () {
assert.equal(currentURL(), '/auth/login', 'Logging out successful');
});
});
test('successful sso login authenticates redirects to dashboard', function (assert) {
server.create('meta', { allowAnonymousAccess: false });
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
andThen(function () {
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'SSO login successful');
});
});
test('sso login with bad token should redirect to login', function (assert) {
server.create('meta', { allowAnonymousAccess: false });
visit('/auth/sso/randomToken1234567890');
andThen(function () {
assert.equal(currentURL(), '/auth/login', 'SSO login unsuccessful');
});
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Login successful');
});
test('logging out a user', async function(assert) {
server.create('meta', { allowAnonymousAccess: false });
userLogin();
await click('.dropdown-menu a:contains(Logout)');
assert.equal(currentURL(), '/auth/login', 'Logging out successful');
});
test('successful sso login authenticates redirects to dashboard', async function(assert) {
server.create('meta', { allowAnonymousAccess: false });
await visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'SSO login successful');
});
test('sso login with bad token should redirect to login', async function(assert) {
server.create('meta', { allowAnonymousAccess: false });
await visit('/auth/sso/randomToken1234567890');
assert.equal(currentURL(), '/auth/login', 'SSO login unsuccessful');
});
});