vault/ui/tests/integration/components/raft-join-test.js
Angel Garbarino a51c5ed362
Clean up button test selectors (#30694)
* clean up selectors file and then update testButton to buttonByAttr

* a lot but not really in the scheme of things

* fix component test failures

* fix acceptance test failures

* fix namespace selector

* clean up remaining tests

* another test

* last test

* small changes, but I have test failures

* a mess in custom messages, really hard to test because of test pollution.

* make data-test-submit vs data-test-save

* change other-methods to sign in with other methods

* clean up of failing test

* buttonByAttr to button

* clean up test pollution on config messages

* sweep of clean ups

* another round of small cleanups

* fix some message things, remaining oidc issue?

* use a runCmd to better delete things

* fix to amend for recent auth test changes

* remove skip
2025-06-10 16:25:34 -04:00

44 lines
1.4 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { click, render } from '@ember/test-helpers';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
module('Integration | Component | raft-join', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<RaftJoin />`);
assert.dom('[data-test-join-choice]').exists();
});
test('it shows the join form when clicking next', async function (assert) {
await render(hbs`<RaftJoin />`);
await click('[data-test-next]');
assert.dom('[data-test-join-header]').exists();
});
test('it returns to the first screen when clicking back', async function (assert) {
await render(hbs`<RaftJoin />`);
await click('[data-test-next]');
assert.dom('[data-test-join-header]').exists();
await click(GENERAL.cancelButton);
assert.dom('[data-test-join-choice]').exists();
});
test('it calls onDismiss when a user chooses to init', async function (assert) {
const spy = sinon.spy();
this.set('onDismiss', spy);
await render(hbs`<RaftJoin @onDismiss={{this.onDismiss}} />`);
await click('[data-test-join-init]');
await click('[data-test-next]');
assert.ok(spy.calledOnce, 'it calls the passed onDismiss');
});
});