chore: 🤖 manual merge from develop

This commit is contained in:
Randall Morey committed 2020-10-01 11:56:21 -04:00
commit 4e7d935ce3
99 files changed
+1541 -130

No files matched your search

@@ -1,3 +1,5 @@
// Enable after account workflow implementation
/*
import { module, test } from 'qunit';
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
@@ -15,6 +17,7 @@ module('Acceptance | accounts | change password', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
@@ -114,4 +117,6 @@ module('Acceptance | accounts | change password', function (hooks) {
await visit(urls.changePassword);
assert.notEqual(currentURL(), urls.changePassword);
});
});
*/
@@ -0,0 +1,142 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find, findAll } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
import {
authenticateSession,
// These are left here intentionally for future reference.
//currentSession,
//invalidateSession,
} from 'ember-simple-auth/test-support';
module('Acceptance | users | accounts', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
user: null,
};
const urls = {
orgScope: null,
users: null,
user: null,
accounts: null,
addAccounts: null,
};
let accountsCount;
hooks.beforeEach(function () {
authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
this.server.create('auth-method', {
scope: instances.scopes.org
}, 'withAccountsAndUsers');
instances.user = this.server.schema.users.all().models[0];
accountsCount = instances.user.accountIds.length;
urls.users = `/scopes/${instances.scopes.org.id}/users`;
urls.user = `${urls.users}/${instances.user.id}`;
urls.accounts = `${urls.user}/accounts`;
urls.addAccounts = `${urls.user}/add-accounts`;
});
test('visiting user accounts', async function (assert) {
assert.expect(2);
await visit(urls.accounts);
await a11yAudit();
assert.equal(currentURL(), urls.accounts);
assert.equal(findAll('tbody tr').length, accountsCount);
});
test('can remove a account', async function (assert) {
assert.expect(2);
await visit(urls.accounts);
assert.equal(findAll('tbody tr').length, accountsCount);
await click('tbody tr .rose-dropdown-button-danger');
assert.equal(findAll('tbody tr').length, accountsCount - 1);
});
test('shows error message on account remove', async function (assert) {
assert.expect(2);
this.server.post('/users/:idMethod', () => {
return new Response(
400,
{},
{
status: 400,
code: 'invalid_argument',
message: 'The request was invalid.',
details: {},
}
);
});
await visit(urls.accounts);
assert.equal(findAll('tbody tr').length, accountsCount);
await click('tbody tr .rose-dropdown-button-danger');
assert.ok(find('[role="alert"]'));
});
test('visiting account add accounts', async function(assert) {
assert.expect(1);
await visit(urls.addAccounts);
await a11yAudit();
assert.equal(currentURL(), urls.addAccounts);
});
test('select and save accounts to add', async function (assert) {
assert.expect(3);
instances.user.update({ accountIds: [] });
await visit(urls.accounts);
assert.equal(findAll('tbody tr').length, 0);
await click('.rose-layout-page-actions a')
assert.equal(currentURL(), urls.addAccounts);
await click('tbody label');
await click('form [type="submit"]');
await visit(urls.accounts);
assert.equal(findAll('tbody tr').length, 1);
});
test('select and cancel accounts to add', async function (assert) {
assert.expect(4);
await visit(urls.accounts);
assert.equal(findAll('tbody tr').length, accountsCount);
await click('tbody tr .rose-dropdown-button-danger');
assert.equal(findAll('tbody tr').length, accountsCount - 1);
await click('.rose-layout-page-actions a')
assert.equal(currentURL(), urls.addAccounts);
await click('tbody label');
await click('form [type="button"]');
await visit(urls.accounts);
assert.equal(findAll('tbody tr').length, accountsCount - 1);
});
test('shows error message on account add', async function (assert) {
assert.expect(1);
this.server.post('/users/:idMethod', () => {
return new Response(
400,
{},
{
status: 400,
code: 'invalid_argument',
message: 'The request was invalid.',
details: {},
}
);
});
instances.user.update({ accountIds: [] });
await visit(urls.addAccounts);
await click('tbody label');
await click('form [type="submit"]');
assert.ok(find('[role="alert"]'));
});
});
@@ -7,7 +7,7 @@ module('Integration | Component | copyable', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
await render(hbs`<Copyable @text="Copy me">text</Copyable>`);
await render(hbs`<Copyable @buttonText="Copy me">text</Copyable>`);
assert.ok(find('.copyable'));
assert.equal(find('.copyable-content').textContent.trim(), 'text');
assert.equal(find('.copyable-button').textContent.trim(), 'Copy me');
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
// import { render } from '@ember/test-helpers';
// import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/user/add-accounts', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
assert.expect(0);
});
});
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/users/user/add-accounts', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/users/user/add-accounts');
assert.ok(controller);
});
});
@@ -5,7 +5,8 @@ module('Unit | Route | account/change-password', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:account/change-password');
assert.ok(route);
// let route = this.owner.lookup('route:account/change-password');
// assert.ok(route);
assert.expect(0);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/users/user/accounts', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/users/user/accounts');
assert.ok(route);
});
});
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/users/user/add-accounts', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:scopes/scope/users/user/add-accounts');
assert.ok(route);
});
});