fix: 🐛 OIDC authentications not properly showing username (#2930)

* fix: 🐛 properly show username for oidc auth method in user menu

* test: 💍 fix admin ui tests

* test: 💍 fix desktop ui tests

* refactor: 💡 admin to not store username in authenticated object

* refactor: 💡 use getter in app controller

* test: 💍 POC for how we could update our tests to use auth account

* refactor: 💡 remove unused service

* test: 💍 fix all tests in ui/admin

* test: 💍 revert one change

* refactor: 💡 update ui/desktop w/ feedback + fix tests

* refactor: 💡 add in error handling

* refactor: 💡 cleanup unused service

* test: 💍 fix e2e test selector

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17231
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2025-10-30 12:49:30 -07:00
1 parent 838bc37243
commit 72f7c8a92d
195 files changed
+720 -1112

No files matched your search

@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | workers | worker | create-tags', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let confirmService;
@@ -33,7 +30,7 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
@@ -42,8 +39,6 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
urls.tags = `${urls.worker}/tags`;
urls.createTags = `${urls.worker}/create-tags`;
confirmService = this.owner.lookup('service:confirm');
await authenticateSession({ username: 'admin' });
});
test('visiting worker create tags', async function (assert) {
@@ -6,16 +6,13 @@
import { module, test } from 'qunit';
import { visit, fillIn, click, findAll, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | workers | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let globalScope;
let workersURL;
@@ -24,14 +21,12 @@ module('Acceptance | workers | create', function (hooks) {
let featuresService;
hooks.beforeEach(async function () {
globalScope = this.server.create('scope', { id: 'global' });
globalScope = this.server.schema.scopes.find('global');
workersURL = `/scopes/global/workers`;
newWorkerURL = `${workersURL}/new`;
getWorkersCount = () => this.server.schema.workers.all().length;
featuresService = this.owner.lookup('service:features');
await authenticateSession({});
});
test('can create new workers', async function (assert) {
@@ -6,18 +6,15 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | workers | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let getWorkerCount, confirmService;
@@ -35,7 +32,7 @@ module('Acceptance | workers | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
@@ -46,8 +43,6 @@ module('Acceptance | workers | delete', function (hooks) {
getWorkerCount = () => this.server.schema.workers.all().models.length;
confirmService = this.owner.lookup('service:confirm');
await authenticateSession({});
});
test('can delete a worker', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | workers | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let featuresService;
@@ -34,7 +31,7 @@ module('Acceptance | workers | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
@@ -45,7 +42,6 @@ module('Acceptance | workers | list', function (hooks) {
urls.workers = `/scopes/global/workers`;
urls.worker = `${urls.workers}/${instances.worker.id}`;
urls.workerTags = `${urls.worker}/tags`;
await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | workers | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -35,7 +32,7 @@ module('Acceptance | workers | read', function (hooks) {
hooks.beforeEach(async function () {
//Generate the resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -50,7 +47,6 @@ module('Acceptance | workers | read', function (hooks) {
featuresService = this.owner.lookup('service:features');
featuresService.enable('byow');
await authenticateSession({ username: 'admin' });
});
test('visiting worker', async function (assert) {
@@ -13,8 +13,6 @@ import {
find,
} from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { HCP_MANAGED_KEY } from 'api/models/worker';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
@@ -22,7 +20,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | workers | worker | tags', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
@@ -38,7 +35,7 @@ module('Acceptance | workers | worker | tags', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
@@ -46,7 +43,6 @@ module('Acceptance | workers | worker | tags', function (hooks) {
urls.worker = `${urls.workers}/${instances.worker.id}`;
urls.tags = `${urls.worker}/tags`;
urls.createTags = `${urls.worker}/create-tags`;
await authenticateSession({ username: 'admin' });
});
test('visiting worker tags', async function (assert) {
@@ -6,14 +6,11 @@
import { module, test } from 'qunit';
import { visit, click, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | workers | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
@@ -29,15 +26,14 @@ module('Acceptance | workers | update', function (hooks) {
hooks.beforeEach(async function () {
//Generate the resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
// Generate route URLs for resources
urls.globalScope = '/scopes/global';
urls.workers = `${urls.globalScope}/workers`;
(urls.worker = `${urls.workers}/${instances.worker.id}`),
await authenticateSession({});
urls.worker = `${urls.workers}/${instances.worker.id}`;
});
test('can save changes to an existing worker', async function (assert) {