refactor: 💡 remove rose table references (#2589)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15644
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2024-12-02 12:22:01 -08:00
1 parent 96b9a20844
commit 2f8a53e3ea
38 files changed
+127 -594

No files matched your search

-32
View File
@@ -88,38 +88,6 @@
}
}
}
.rose-form-fieldset {
.rose-table {
.rose-form-label {
left: -9999px;
position: absolute;
top: -9999px;
}
}
}
}
.rose-table {
p {
margin-bottom: 0;
}
.rose-table-header-cell {
p {
color: var(--ui-gray-subtler-1);
font-weight: normal;
}
}
.rose-form-checkbox {
margin-bottom: 0;
.rose-form-checkbox-label-text {
color: var(--stark);
text-decoration: underline;
}
}
}
.rose-header {
@@ -53,7 +53,7 @@ module('Acceptance | accounts | read', function (hooks) {
test('can navigate to an account form', async function (assert) {
await visit(urls.accounts);
await click(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK);
await click(commonSelectors.TABLE_RESOURCE_LINK(urls.account));
await a11yAudit();
assert.strictEqual(currentURL(), urls.account);
@@ -64,10 +64,12 @@ module('Acceptance | accounts | read', function (hooks) {
instances.account.authorized_actions.filter((item) => item !== 'read');
await visit(urls.accounts);
assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.account))
.doesNotExist();
});
test('user can navigate to account and incorrect url autocorrects', async function (assert) {
test('user can navigate to account and incorrect url auto-corrects', async function (assert) {
const authMethod = this.server.create('auth-method', {
scope: instances.scopes.org,
});
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE } from 'api/models/credential-library';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-libraries | read', function (hooks) {
setupApplicationTest(hooks);
@@ -33,6 +34,7 @@ module('Acceptance | credential-libraries | read', function (hooks) {
credentialLibraries: null,
newCredentialLibrary: null,
unknownCredentialLibrary: null,
vaultSshCredentialLibrary: null,
};
hooks.beforeEach(function () {
@@ -68,8 +70,10 @@ module('Acceptance | credential-libraries | read', function (hooks) {
test('can navigate to resource', async function (assert) {
await visit(urls.credentialLibraries);
await click('.hds-table .hds-table__tbody .hds-table__tr a');
await click(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary));
await a11yAudit();
assert.strictEqual(currentURL(), urls.credentialLibrary);
});
@@ -79,7 +83,10 @@ module('Acceptance | credential-libraries | read', function (hooks) {
(item) => item !== 'read',
);
await visit(urls.credentialLibraries);
assert.notOk(find('main tbody .rose-table-header-cell a'));
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary))
.doesNotExist();
});
test('cannot navigate to vault ssh cert form when feature is not enabled', async function (assert) {
@@ -88,13 +95,17 @@ module('Acceptance | credential-libraries | read', function (hooks) {
credentialStore: instances.credentialStore,
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
});
await visit(
`${urls.credentialLibraries}/${instances.credentialLibrary.id}`,
);
urls.vaultSshCredentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
await visit(urls.credentialLibraries);
const featuresService = this.owner.lookup('service:features');
assert.false(featuresService.isEnabled('ssh-target'));
assert.dom('.rose-table-body tr:nth-of-type(2) a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultSshCredentialLibrary))
.doesNotExist();
});
test('visiting an unknown credential library displays 404 message', async function (assert) {
@@ -103,7 +114,7 @@ module('Acceptance | credential-libraries | read', function (hooks) {
assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404');
});
test('users can navigate to credential library and incorrect url autocorrects', async function (assert) {
test('users can navigate to credential library and incorrect url auto-corrects', async function (assert) {
const credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
@@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-stores | credentials | read', function (hooks) {
setupApplicationTest(hooks);
@@ -117,7 +118,13 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read',
);
await visit(urls.credentials);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernameKeyPairCredential))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
.doesNotExist();
});
test('cannot navigate to a username & key pair credential form without proper authorization', async function (assert) {
@@ -126,7 +133,13 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read',
);
await visit(urls.credentials);
assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernameKeyPairCredential))
.doesNotExist();
});
test('cannot navigate to a JSON credential form without proper authorization', async function (assert) {
@@ -135,13 +148,25 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read',
);
await visit(urls.credentials);
assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.jsonCredential))
.doesNotExist();
});
test('cannot navigate to a JSON credential form when feature not enabled', async function (assert) {
await visit(urls.credentials);
assert.false(featuresService.isEnabled('json-credentials'));
assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.jsonCredential))
.doesNotExist();
});
test('visiting an unknown credential displays 404 message', async function (assert) {
@@ -159,7 +184,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
);
});
test('users can navigate to credential and incorrect url autocorrects', async function (assert) {
test('users can navigate to credential and incorrect url auto-corrects', async function (assert) {
const credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-stores | read', function (hooks) {
setupApplicationTest(hooks);
@@ -101,8 +102,12 @@ module('Acceptance | credential-stores | read', function (hooks) {
await click(`[href="${urls.credentialStores}"]`);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert.dom(`[href="${urls.vaultCredentialStore}"]`).exists();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultCredentialStore))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticCredentialStore))
.doesNotExist();
});
test('cannot navigate to a vault credential store form without proper authorization', async function (assert) {
@@ -115,8 +120,12 @@ module('Acceptance | credential-stores | read', function (hooks) {
await click(`[href="${urls.credentialStores}"]`);
assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
assert.dom(`[href="${urls.staticCredentialStore}"]`).exists();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticCredentialStore))
.isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultCredentialStore))
.doesNotExist();
});
test('visiting an unknown credential store displays 404 message', async function (assert) {
@@ -138,7 +147,7 @@ module('Acceptance | credential-stores | read', function (hooks) {
.exists();
});
test('users can navigate to credential store and incorrect url autocorrects', async function (assert) {
test('users can navigate to credential store and incorrect url auto-corrects', async function (assert) {
const projectScope = this.server.create('scope', {
type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' },
@@ -7,6 +7,7 @@ import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -14,6 +15,7 @@ import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | groups | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
const instances = {
scopes: {
@@ -54,12 +56,12 @@ module('Acceptance | groups | read', function (hooks) {
test('cannot navigate to a group form without proper authorization', async function (assert) {
instances.group.authorized_actions =
instances.group.authorized_actions.filter((item) => item !== 'read');
await visit(urls.group);
await visit(urls.groups);
assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.group)).doesNotExist();
});
test('users can navigate to group and incorrect url autocorrects', async function (assert) {
test('users can navigate to group and incorrect url auto-corrects', async function (assert) {
const orgScope = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
setupApplicationTest(hooks);
@@ -84,7 +85,9 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
await click(`[href="${urls.hostSets}"]`);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.hostSet))
.doesNotExist();
});
test('visiting an unknown host set displays 404 message', async function (assert) {
@@ -106,7 +109,7 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
.exists();
});
test('users can navigate to host set and incorrect url autocorrects', async function (assert) {
test('users can navigate to host set and incorrect url auto-corrects', async function (assert) {
const hostCatalog = this.server.create('host-catalog', {
scope: instances.scopes.project,
type: 'static',
@@ -85,7 +85,7 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
await click(commonSelectors.HREF(urls.hosts));
assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.host)).doesNotExist();
});
test('visiting an unknown host displays 404 message', async function (assert) {
@@ -15,6 +15,7 @@ import {
TYPE_HOST_CATALOG_PLUGIN_AWS,
TYPE_HOST_CATALOG_PLUGIN_AZURE,
} from 'api/models/host-catalog';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | list', function (hooks) {
setupApplicationTest(hooks);
@@ -35,6 +36,8 @@ module('Acceptance | host-catalogs | list', function (hooks) {
orgScope: null,
projectScope: null,
hostCatalogs: null,
awsHostCatalog: null,
azureHostCatalog: null,
staticHostCatalog: null,
};
@@ -138,7 +141,10 @@ module('Acceptance | host-catalogs | list', function (hooks) {
await click(`[href="${urls.hostCatalogs}"]`);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert.dom('.hds-application-state__body-text').isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticHostCatalog))
.doesNotExist();
});
test('user can navigate to index with only list action', async function (assert) {
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | read', function (hooks) {
setupApplicationTest(hooks);
@@ -78,7 +79,9 @@ module('Acceptance | host-catalogs | read', function (hooks) {
await click(`[href="${urls.hostCatalogs}"]`);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.hostCatalog))
.doesNotExist();
});
test('visiting an unknown host catalog displays 404 message', async function (assert) {
@@ -71,7 +71,9 @@ module('Acceptance | storage-buckets | read', function (hooks) {
await click(commonSelectors.HREF(urls.storageBuckets));
assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.storageBucket))
.doesNotExist();
});
test('visiting an unknown storage bucket displays 404 message', async function (assert) {
@@ -83,7 +85,7 @@ module('Acceptance | storage-buckets | read', function (hooks) {
.hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
test('users can navigate to storage bucket and incorrect url autocorrects', async function (assert) {
test('users can navigate to storage bucket and incorrect url auto-corrects', async function (assert) {
const incorrectUrl = `/scopes/${instances.scopes.org.id}/storage-buckets/${instances.storageBucket.id}`;
await visit(incorrectUrl);
@@ -10,6 +10,7 @@ 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 } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | host-sources', function (hooks) {
setupApplicationTest(hooks);
@@ -80,9 +81,10 @@ module('Acceptance | targets | host-sources', function (hooks) {
urls.targetHostSources = `${urls.target}/host-sources`;
urls.targetAddHostSources = `${urls.target}/add-host-sources`;
urls.hostSet = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostCatalog.hostSetIds[0]}`;
// Generate resource counter
getTargetHostSetCount = () =>
this.server.schema.targets.first().hostSets.models.length;
urls.unknownHostSet =
// Generate resource counter
getTargetHostSetCount = () =>
this.server.schema.targets.first().hostSets.models.length;
authenticateSession({ username: 'admin' });
});
@@ -114,7 +116,13 @@ module('Acceptance | targets | host-sources', function (hooks) {
await click(`[href="${urls.targetHostSources}"]`);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert
.dom(
commonSelectors.TABLE_RESOURCE_LINK(
instances.hostCatalogPlugin.hostSets[0],
),
)
.doesNotExist();
});
test('can remove a host set', async function (assert) {
+10 -5
View File
@@ -11,6 +11,7 @@ import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | read', function (hooks) {
setupApplicationTest(hooks);
@@ -120,8 +121,10 @@ module('Acceptance | targets | read', function (hooks) {
await click(`[href="${urls.targets}"]`);
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert.dom(`[href="${urls.tcpTarget}"]`).exists();
assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget)).isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget))
.doesNotExist();
});
test('cannot navigate to a tcp target form without proper authorization', async function (assert) {
@@ -132,8 +135,10 @@ module('Acceptance | targets | read', function (hooks) {
await click(`[href="${urls.targets}"]`);
assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
assert.dom(`[href="${urls.sshTarget}"]`).exists();
assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget)).isVisible();
assert
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget))
.doesNotExist();
});
test('visiting an unknown target displays 404 message', async function (assert) {
@@ -155,7 +160,7 @@ module('Acceptance | targets | read', function (hooks) {
.exists();
});
test('users can navigate to target and incorrect url autocorrects', async function (assert) {
test('users can navigate to target and incorrect url auto-corrects', async function (assert) {
const incorrectUrl = `/scopes/${instances.scopes.org.id}/targets/${instances.sshTarget.id}`;
await visit(incorrectUrl);
@@ -218,7 +218,10 @@ module('Acceptance | targets | workers', function (hooks) {
await click(CANCEL_BUTTON_SELECTOR);
assert.strictEqual(currentURL(), urls.targetWorkers);
assert.notEqual(instances.target.inress_worker_filter, ingressWorkerFilter);
assert.notEqual(
instances.target.ingress_worker_filter,
ingressWorkerFilter,
);
assert
.dom(CODE_BLOCK_SELECTOR('ingress'))
.hasText(instances.target.ingress_worker_filter);
+3 -1
View File
@@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | users | list', function (hooks) {
setupApplicationTest(hooks);
@@ -110,7 +111,8 @@ module('Acceptance | users | list', function (hooks) {
await click(`[href="${urls.users}"]`);
assert.dom(`.rose-table [href="${urls.user1}"]`).doesNotExist();
assert.dom('.hds-application-state__body-text').isVisible();
assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.user1)).doesNotExist();
});
test('user can navigate to users tab with only list action', async function (assert) {
+3 -2
View File
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | users | read', function (hooks) {
setupApplicationTest(hooks);
@@ -71,7 +72,7 @@ module('Acceptance | users | read', function (hooks) {
await click(`[href="${urls.users}"]`);
assert.dom(`.rose-table [href="${urls.user}"]`).doesNotExist();
assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.user)).doesNotExist();
});
test('users can link to docs page for users', async function (assert) {
@@ -86,7 +87,7 @@ module('Acceptance | users | read', function (hooks) {
.exists();
});
test('users can navigate to user and incorrect url autocorrects', async function (assert) {
test('users can navigate to user and incorrect url auto-corrects', async function (assert) {
const incorrectUrl = `/scopes/global/users/${instances.user.id}`;
await visit(incorrectUrl);
+1 -1
View File
@@ -14,7 +14,7 @@ export const FIELD_NAME_ERROR = '[data-test-error-message-name]';
export const FIELD_DESCRIPTION = '[name=description]';
export const FIELD_DESCRIPTION_VALUE = 'description';
export const TABLE_FIRST_ROW_RESOURCE_LINK = 'tbody tr:first-child a';
export const TABLE_RESOURCE_LINK = (url) => `tbody [href="${url}"]`;
export const RESOURCE_NOT_FOUND_SUBTITLE = '.rose-message-subtitle';
export const RESOURCE_NOT_FOUND_VALUE = 'Error 404';