Angel Garbarino a953a3cade
Secret Sync Permissions cleanup (#26069)
* add secrets sync feature to version service

* fix syntax for feature in version service

* UI [Sidebranch]: correctly call activation flags endpoints (#26068)

* Show empty state on client count sync page if feature isn't activated (#26024)

* page/sync: show empty state if sync is not activated

* tests: add sync page integration tests

* tests: add secrets sync acceptance tests

* cleanup: remove redundant empty state selector

* chore: rename to isSecretsSyncActivated

* Only make POST request to activation-flags in root namespace (#26081)

* Clean up around opt-in banner on non-secrets-sync views (#26039)

* only show and make request to activated-features  if enterprise with secrets sync feature

* waiting for final badge title but hiding banner and network request based on if user has secrets-sync feature.

* final copy for badge

* handle dismiss erorr message, custom messaging in errors, different badge names and upsell if not on license.

* add secrets sync feature to version service

* nope, add to main sidebranch not in this PR

* use version service directly to check for secrets sync feature

* update badges to use version service directly

* do not unnecessarily pass hasSecretsSyncFeature, access from version directly

* last spot to update using the feature getter

* cleanup landing cta logic

* UI [Sidebranch]: correctly call activation flags endpoints (#26068)

* small cleanups after merge

* remove unused type imports

* update tests

* update nav link test

* add test waiter for race condition on test

* add waiter to fetch activation-flags

* remove customer waiters and go for waitFors in test

* worth a try? mirage issues?

* closer?

* fix issue with inconsistent asserts

* adding back in in case this is the issue

* revert cluster.hbs change

* skip test

* delete test

---------

Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com>
Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>

* Hide sync for managed vault (#26084)

* [secrets sync] hide sync content from client overview (#26078)

* clients/overview: hide secrets sync content if not in license

* clients: remove sync tab if not in license

* routes: fetch isSecretsSyncActivated at clients/counts route level

* wip - hide secrets sync from overview page

* tests: fix usage-stats test

* more wip hiding from overview page

* hide secrets sync on attribution component/modal

* hide secrets sync content on running total component

* fix RunningTotal class name

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* controllers: fix type

* tests: usage tests

* tests: running totals tests

* add s to secrets-sync

* tests: running-total test cleanup

---------

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com>

* cleanup unused version service

* return extra line

* wip - sync tests

* wip -- clients overview acceptance tests

* test coverage for sync in license, activated

* tests: add more robust sync-related overview tests

* hide sync client charts if feature not in license

---------

Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com>
Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
Co-authored-by: Noelle Daley <noelledaley@users.noreply.github.com>
Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
2024-03-22 14:07:09 -05:00

67 lines
2.6 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
import hbs from 'htmlbars-inline-precompile';
import { render } from '@ember/test-helpers';
import { PAGE } from 'vault/tests/helpers/sync/sync-selectors';
import sinon from 'sinon';
const { cta } = PAGE;
module('Integration | Component | sync | Secrets::LandingCta', function (hooks) {
setupRenderingTest(hooks);
setupEngine(hooks, 'sync');
setupMirage(hooks);
hooks.beforeEach(function () {
this.transitionStub = sinon.stub(this.owner.lookup('service:router'), 'transitionTo');
});
test('it should render promotional copy for community or enterprise version without feature', async function (assert) {
await render(hbs`<Secrets::LandingCta @isActivated={{false}} @hasSecretsSync={{false}} /> `, {
owner: this.engine,
});
assert
.dom(cta.summary)
.hasText(
'This premium enterprise feature allows you to sync secrets to platforms and tools across your stack to get secrets when and where you need them. Learn more about Secrets Sync'
);
assert.dom(cta.link).hasText('Learn more about Secrets Sync');
assert.dom(cta.button).doesNotExist('does not render create destination button');
});
test('it should render CTA copy but not action when feature exists on enterprise license and is not activated', async function (assert) {
await render(hbs`<Secrets::LandingCta @isActivated={{false}} @hasSecretsSync={{true}} /> `, {
owner: this.engine,
});
assert
.dom(cta.summary)
.hasText(
'Sync secrets to platforms and tools across your stack to get secrets when and where you need them. Secrets Sync tutorial'
);
assert.dom(cta.link).hasText('Secrets Sync tutorial');
assert.dom(cta.button).doesNotExist('does not render create destination button');
});
test('it should render CTA copy and action when feature exists on enterprise license and is activated', async function (assert) {
await render(hbs`<Secrets::LandingCta @isActivated={{true}} @hasSecretsSync={{true}} /> `, {
owner: this.engine,
});
assert
.dom(cta.summary)
.hasText(
'Sync secrets to platforms and tools across your stack to get secrets when and where you need them. Secrets Sync tutorial'
);
assert.dom(cta.link).hasText('Secrets Sync tutorial');
assert.dom(cta.button).exists('it renders create destination button');
});
});