Skip to content

Commit

Permalink
Merge branch 'main' into moduli-e2e-admin-0.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
moduli authored Jan 27, 2025
2 parents 0e89186 + fed32aa commit de2f314
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 208 deletions.
45 changes: 31 additions & 14 deletions ui/admin/app/components/form/host-catalog/gcp/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@
as |F|
>
<F.Label>{{t 'resources.host-catalog.form.project_id.label'}}</F.Label>
<F.HelperText>{{t
'resources.host-catalog.form.project_id.help'
}}</F.HelperText>
<F.HelperText>{{t 'resources.host-catalog.form.project_id.help'}}
<Hds::Link::Inline @href={{doc-url 'host-catalog.gcp'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.project_id}}
<F.Error as |E|>
{{#each @model.errors.project_id as |error|}}
Expand All @@ -140,7 +142,11 @@
as |F|
>
<F.Label>{{t 'resources.host-catalog.form.zone.label'}}</F.Label>
<F.HelperText>{{t 'resources.host-catalog.form.zone.help'}}</F.HelperText>
<F.HelperText>{{t 'resources.host-catalog.form.zone.help'}}
<Hds::Link::Inline @href={{doc-url 'host-catalog.gcp'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.zone}}
<F.Error as |E|>
{{#each @model.errors.zone as |error|}}
Expand All @@ -160,9 +166,12 @@
as |F|
>
<F.Label>{{t 'resources.host-catalog.form.client_email.label'}}</F.Label>
<F.HelperText>{{t
'resources.host-catalog.form.client_email.help'
}}</F.HelperText>
<F.HelperText>
{{t 'resources.host-catalog.form.client_email.help'}}
<Hds::Link::Inline @href={{doc-url 'host-catalog.gcp'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.client_email}}
<F.Error as |E|>
{{#each @model.errors.client_email as |error|}}
Expand All @@ -186,7 +195,11 @@
}}</F.Label>
<F.HelperText>{{t
'resources.host-catalog.form.target_service_account_id.help'
}}</F.HelperText>
}}
<Hds::Link::Inline @href={{doc-url 'host-catalog.gcp'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.target_service_account_id}}
<F.Error as |E|>
{{#each @model.errors.target_service_account_id as |error|}}
Expand All @@ -207,9 +220,11 @@
as |F|
>
<F.Label>{{t 'resources.host-catalog.form.private_key_id.label'}}</F.Label>
<F.HelperText>{{t
'resources.host-catalog.form.private_key_id.help'
}}</F.HelperText>
<F.HelperText>{{t 'resources.host-catalog.form.private_key_id.help'}}
<Hds::Link::Inline @href={{doc-url 'host-catalog.gcp'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.private_key_id}}
<F.Error as |E|>
{{#each @model.errors.private_key_id as |error|}}
Expand All @@ -228,9 +243,11 @@
as |F|
>
<F.Label>{{t 'resources.host-catalog.form.private_key.label'}}</F.Label>
<F.HelperText>{{t
'resources.host-catalog.form.private_key.help'
}}</F.HelperText>
<F.HelperText>{{t 'resources.host-catalog.form.private_key.help'}}
<Hds::Link::Inline @href={{doc-url 'host-catalog.gcp'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.private_key}}
<F.Error as |E|>
{{#each @model.errors.private_key as |error|}}
Expand Down
1 change: 1 addition & 0 deletions ui/admin/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ module.exports = function (environment) {
'host-catalog': '/docs/concepts/domain-model/host-catalogs',
'host-catalog.new': '/docs/common-workflows/manage-targets',
'host-catalog.azure': '/docs/concepts/host-discovery/azure',
'host-catalog.gcp': '/docs/concepts/host-discovery/gcp',
'host-catalog.aws': '/docs/concepts/host-discovery/aws',
'host-catalog.aws.region':
'https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html',
Expand Down
73 changes: 40 additions & 33 deletions ui/admin/tests/acceptance/auth-methods/read-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ import {
TYPE_AUTH_METHOD_OIDC,
TYPE_AUTH_METHOD_PASSWORD,
} from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';

module('Acceptance | auth-methods | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);

const AUTH_LINK_SELECTOR = (id) =>
`tbody [data-test-auth-methods-table-row="${id}"] a`;
const AUTH_TYPE_SELECTOR = (id) =>
`tbody [data-test-auth-methods-table-row="${id}"] .hds-table__td:nth-child(2)`;
const AUTH_ACTIONS_SELECTOR = (id) =>
`tbody [data-test-auth-methods-table-row="${id}"] .hds-table__td:last-child .hds-dropdown`;

const instances = {
scopes: {
global: null,
Expand Down Expand Up @@ -75,7 +70,7 @@ module('Acceptance | auth-methods | read', function (hooks) {
test('visiting auth methods in org scope', async function (assert) {
await visit(urls.orgScope);

await click(`[href="${urls.orgAuthMethods}"]`);
await click(commonSelectors.HREF(urls.orgAuthMethods));
await a11yAudit();

assert.strictEqual(currentURL(), urls.orgAuthMethods);
Expand All @@ -84,7 +79,7 @@ module('Acceptance | auth-methods | read', function (hooks) {
test('visiting auth methods in global scope', async function (assert) {
await visit(urls.globalScope);

await click(`[href="${urls.globalAuthMethods}"]`);
await click(commonSelectors.HREF(urls.globalAuthMethods));
await a11yAudit();

assert.strictEqual(currentURL(), urls.globalAuthMethods);
Expand All @@ -93,16 +88,18 @@ module('Acceptance | auth-methods | read', function (hooks) {
test('can navigate to an auth method form in org scope', async function (assert) {
await visit(urls.orgScope);

await click(`[href="${urls.orgAuthMethods}"]`);
await click(commonSelectors.HREF(urls.orgAuthMethods));

assert
.dom(AUTH_TYPE_SELECTOR(instances.passwordAuthMethodOrg.id))
.dom(selectors.TABLE_ROW_TYPE(instances.passwordAuthMethodOrg.id))
.hasText('Password');
assert
.dom(AUTH_ACTIONS_SELECTOR(instances.passwordAuthMethodOrg.id))
.exists();
.dom(selectors.TABLE_ACTION_DROPDOWN(instances.passwordAuthMethodOrg.id))
.isVisible();

await click(AUTH_LINK_SELECTOR(instances.passwordAuthMethodOrg.id));
await click(
selectors.TABLE_ROW_NAME_LINK(instances.passwordAuthMethodOrg.id),
);
await a11yAudit();

assert.strictEqual(currentURL(), urls.passwordAuthMethodOrg);
Expand All @@ -111,16 +108,18 @@ module('Acceptance | auth-methods | read', function (hooks) {
test('can navigate to an auth method form in global scope', async function (assert) {
await visit(urls.globalScope);

await click(`[href="${urls.globalAuthMethods}"]`);
await click(commonSelectors.HREF(urls.globalAuthMethods));

assert
.dom(AUTH_TYPE_SELECTOR(instances.oidcAuthMethodGlobal.id))
.dom(selectors.TABLE_ROW_TYPE(instances.oidcAuthMethodGlobal.id))
.hasText('OIDC');
assert
.dom(AUTH_ACTIONS_SELECTOR(instances.oidcAuthMethodGlobal.id))
.exists();
.dom(selectors.TABLE_ACTION_DROPDOWN(instances.oidcAuthMethodGlobal.id))
.isVisible();

await click(AUTH_LINK_SELECTOR(instances.oidcAuthMethodGlobal.id));
await click(
selectors.TABLE_ROW_NAME_LINK(instances.oidcAuthMethodGlobal.id),
);
await a11yAudit();

assert.strictEqual(currentURL(), urls.oidcAuthMethodGlobal);
Expand All @@ -133,11 +132,11 @@ module('Acceptance | auth-methods | read', function (hooks) {
);
await visit(urls.orgScope);

await click(`[href="${urls.orgAuthMethods}"]`);
await click(commonSelectors.HREF(urls.orgAuthMethods));

assert
.dom(AUTH_LINK_SELECTOR(instances.passwordAuthMethodOrg.id))
.doesNotExist();
.dom(selectors.TABLE_ROW_NAME_LINK(instances.passwordAuthMethodOrg.id))
.isNotVisible();
});

test('cannot navigate to an auth method form without proper authorization in global scope', async function (assert) {
Expand All @@ -147,11 +146,11 @@ module('Acceptance | auth-methods | read', function (hooks) {
);
await visit(urls.globalScope);

await click(`[href="${urls.globalAuthMethods}"]`);
await click(commonSelectors.HREF(urls.globalAuthMethods));

assert
.dom(AUTH_LINK_SELECTOR(instances.oidcAuthMethodGlobal.id))
.doesNotExist();
.dom(selectors.TABLE_ROW_NAME_LINK(instances.oidcAuthMethodGlobal.id))
.isNotVisible();
});

test('cannot navigate to an ldap auth method form in global scope', async function (assert) {
Expand All @@ -161,13 +160,17 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
await visit(urls.globalScope);

await click(`[href="${urls.globalAuthMethods}"]`);
await click(commonSelectors.HREF(urls.globalAuthMethods));

assert.dom(AUTH_LINK_SELECTOR(instances.ldapAuthMethod.id)).doesNotExist();
assert.dom(AUTH_TYPE_SELECTOR(instances.ldapAuthMethod.id)).hasText('LDAP');
assert
.dom(AUTH_ACTIONS_SELECTOR(instances.ldapAuthMethod.id))
.dom(selectors.TABLE_ROW_NAME_LINK(instances.ldapAuthMethod.id))
.doesNotExist();
assert
.dom(selectors.TABLE_ROW_TYPE(instances.ldapAuthMethod.id))
.hasText('LDAP');
assert
.dom(selectors.TABLE_ACTION_DROPDOWN(instances.ldapAuthMethod.id))
.isNotVisible();
});

test('cannot navigate to an ldap auth method form in org scope', async function (assert) {
Expand All @@ -177,13 +180,17 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
await visit(urls.orgScope);

await click(`[href="${urls.orgAuthMethods}"]`);
await click(commonSelectors.HREF(urls.orgAuthMethods));

assert.dom(AUTH_LINK_SELECTOR(instances.ldapAuthMethod.id)).doesNotExist();
assert.dom(AUTH_TYPE_SELECTOR(instances.ldapAuthMethod.id)).hasText('LDAP');
assert
.dom(AUTH_ACTIONS_SELECTOR(instances.ldapAuthMethod.id))
.dom(selectors.TABLE_ROW_NAME_LINK(instances.ldapAuthMethod.id))
.doesNotExist();
assert
.dom(selectors.TABLE_ROW_TYPE(instances.ldapAuthMethod.id))
.hasText('LDAP');
assert
.dom(selectors.TABLE_ACTION_DROPDOWN(instances.ldapAuthMethod.id))
.isNotVisible();
});

test('users can navigate to auth method and incorrect url autocorrects', async function (assert) {
Expand Down
18 changes: 18 additions & 0 deletions ui/admin/tests/acceptance/auth-methods/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ export const FIELD_CLIENT_SECRET_VALUE = 'Client secret value';
export const FIELD_SIGNING_ALGORITHMS = '[name=signing_algorithms] select';
export const FIELD_SIGNING_ALGORITHMS_VALUE = 'RS384';
export const FIELD_SIGNING_ALGORITHMS_ADD_BTN = '[data-test-add-option-button]';
export const FIELD_SIGNING_ALGORITHMS_DELETE_BTN =
'[name=signing_algorithms] tbody td:last-child button[aria-label=Remove]';
export const FIELD_ALLOWED_AUDIENCES = '[name=allowed_audiences] input';
export const FIELD_ALLOWED_AUDIENCES_VALUE = 'Allowed audiences';
export const FIELD_ALLOWED_AUDIENCES_ADD_BTN =
'[name=allowed_audiences] button';
export const FIELD_ALLOWED_AUDIENCES_DELETE_BTN =
'[name=allowed_audiences] tbody td:last-child button[aria-label=Remove]';
export const FIELD_CLAIMS_SCOPES = '[name=claims_scopes] input';
export const FIELD_CLAIMS_SCOPES_VALUE = 'Claim scopes';
export const FIELD_CLAIMS_SCOPES_ADD_BTN = '[name=claims_scopes] button';
export const FIELD_CLAIMS_SCOPES_DELETE_BTN =
'[name=claims_scopes] tbody td:last-child button[aria-label=Remove]';
export const FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM =
'[name=account_claim_maps] tbody td:nth-of-type(1) input';
export const FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM_VALUE = 'from_claim';
Expand All @@ -27,9 +33,13 @@ export const FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM =
export const FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM_VALUE = 'email';
export const FIELD_ACCOUNT_CLAIM_MAPS_ADD_BTN =
'[name=account_claim_maps] button';
export const FIELD_ACCOUNT_CLAIM_MAPS_DELETE_BTN =
'[name=account_claim_maps] tbody td:last-child button[aria-label=Remove]';
export const FIELD_IDP_CERTS = '[name=idp_ca_certs] textarea';
export const FIELD_IDP_CERTS_VALUE = 'IDP certificates';
export const FIELD_IDP_CERTS_ADD_BTN = '[name=idp_ca_certs] button';
export const FIELD_IDP_CERTS_DELETE_BTN =
'[name=idp_ca_certs] tbody td:last-child button[aria-label=Remove]';
export const FIELD_MAX_AGE = '[name=max_age]';
export const FIELD_MAX_AGE_VALUE = '5';
export const FIELD_API_URL_PREFIX = '[name=api_url_prefix]';
Expand All @@ -43,6 +53,8 @@ export const FIELD_URLS_VALUE = 'url1,url2';
export const FIELD_CERTIFICATES = '[name=certificates] textarea';
export const FIELD_CERTIFICATES_VALUE = 'certificate';
export const FIELD_CERTIFICATES_ADD_BTN = '[name=certificates] button';
export const FIELD_CERTIFICATES_DELETE_BTN =
'[name="certificates"] button[aria-label=Remove]';
export const FIELD_CLIENT_CERTIFICATE = '[name=client_certificate]';
export const FIELD_CLIENT_CERTIFICATE_VALUE = 'Client certificate value';
export const FIELD_CLIENT_CERTIFICATE_KEY = '[name=client_certificate_key]';
Expand Down Expand Up @@ -72,6 +84,8 @@ export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO =
export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO_VALUE = 'email';
export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_ADD_BTN =
'[name=account_attribute_maps] button';
export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_DELETE_BTN =
'[name=account_attribute_maps] button[aria-label=Remove]';
export const FIELD_GROUP_DN = '[name=group_dn]';
export const FIELD_GROUP_DN_VALUE = 'Group dn value';
export const FIELD_GROUP_ATTR = '[name=group_attr]';
Expand All @@ -97,3 +111,7 @@ export const TABLE_ACTION_DROPDOWN = (authMethodId) =>
`tbody [data-test-auth-methods-table-row="${authMethodId}"] .hds-table__td:last-child .hds-dropdown button`;
export const TABLE_ACTION_DROPDOWN_MAKE_PRIMARY = (authMethodId) =>
`tbody tr[data-test-auth-methods-table-row="${authMethodId}"] td:last-child ul li:first-child button`;
export const TABLE_ROW_TYPE = (authMethodId) =>
`tbody [data-test-auth-methods-table-row="${authMethodId}"] .hds-table__td:nth-child(2)`;
export const TABLE_ROW_NAME_LINK = (authMethodId) =>
`tbody [data-test-auth-methods-table-row="${authMethodId}"] .hds-table__td:first-child a`;
Loading

0 comments on commit de2f314

Please sign in to comment.