Repository: hashicorp/vault
File: ui/tests/acceptance/config-ui/login-settings-test.js (JavaScript)

Code before:
/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { click, visit, currentRouteName } from '@ember/test-helpers';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
import { runCmd } from 'vault/tests/helpers/commands';

module('Acceptance | Enterprise | config-ui/login-settings', function (hooks) {
  setupApplicationTest(hooks);
  setupMirage(hooks);

  hooks.beforeEach(async function () {
    const version = this.owner.lookup('service:version');
    version.type = 'enterprise';
    await login();
  });

  test('fetched login rule list renders', async function (assert) {
    await runCmd([
      'write sys/config/ui/login/default-auth/testRule backupAuthTypes=[] defaultAuthType=okta disableInheritance=false namespace=ns1',
      'write sys/config/ui/login/default-auth/testRule2 backupAuthTypes=[] defaultAuthType=ldap disableInheritance=false namespace=ns2',
    ]);

    // Visit the login settings list index page
    await visit('vault/config-ui/login-settings');

    // verify fetched rules are rendered in list
    assert.dom('.linked-block-item').exists({ count: 2 });
  });

  test('delete rule from list view', async function (assert) {
    // Visit the login settings list index page
    await visit('vault/config-ui/login-settings');

    await click(GENERAL.menuTrigger);
    await click(GENERAL.menuItem('delete-rule'));

    assert.dom(GENERAL.confirmationModal).exists();
    await click(GENERAL.confirmButton);

Review comment (suggestion):
this can be removed since the "Enterprise" in the title means this test will be filtered out on CE runs (which also means before merging we'll need to double check enterprise tests pass locally)

Code after:
/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { click, visit, currentRouteName } from '@ember/test-helpers';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
import { runCmd } from 'vault/tests/helpers/commands';

module('Acceptance | Enterprise | config-ui/login-settings', function (hooks) {
  setupApplicationTest(hooks);
  setupMirage(hooks);

  hooks.beforeEach(async function () {
    await login();

    // create login rules
    await runCmd([
      'write sys/config/ui/login/default-auth/testRule backup_auth_types=[] default_auth_type=okta disable_inheritance=false namespace=ns1',
      'write sys/config/ui/login/default-auth/testRule2 backup_auth_types=[] default_auth_type=ldap disable_inheritance=true namespace=ns2',
    ]);
  });

  hooks.afterEach(async function () {
    // cleanup login rules
    await runCmd([
      'delete sys/config/ui/login/default-auth/testRule',
      'delete sys/config/ui/login/default-auth/testRule2',
    ]);
  });

  test('fetched login rule list renders', async function (assert) {
    // Visit the login settings list index page
    await visit('vault/config-ui/login-settings');

    // verify fetched rules are rendered in list
    assert.dom('.linked-block-item').exists({ count: 2 });
  });

  test('delete rule from list view', async function (assert) {
    // Visit the login settings list index page