5c2a08de6d
* Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
69 lines
2.5 KiB
JavaScript
69 lines
2.5 KiB
JavaScript
import { click, settled, fillIn } from '@ember/test-helpers';
|
|
import { create } from 'ember-cli-page-object';
|
|
import { module, test } from 'qunit';
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
import editPage from 'vault/tests/pages/secrets/backend/kv/edit-secret';
|
|
import listPage from 'vault/tests/pages/secrets/backend/list';
|
|
import apiStub from 'vault/tests/helpers/noop-all-api-requests';
|
|
import authPage from 'vault/tests/pages/auth';
|
|
import consoleClass from 'vault/tests/pages/components/console/ui-panel';
|
|
|
|
const consoleComponent = create(consoleClass);
|
|
|
|
module('Acceptance | kv2 diff view', function (hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(async function () {
|
|
this.server = apiStub({ usePassthrough: true });
|
|
return authPage.login();
|
|
});
|
|
|
|
hooks.afterEach(function () {
|
|
this.server.shutdown();
|
|
});
|
|
|
|
test('it shows correct diff status based on versions', async function (assert) {
|
|
const secretPath = `my-secret`;
|
|
|
|
await consoleComponent.runCommands([
|
|
`write sys/mounts/secret type=kv options=version=2`,
|
|
// delete any kv previously written here so that tests can be re-run
|
|
`delete secret/metadata/${secretPath}`,
|
|
'write -field=client_token auth/token/create policies=kv-v2-degrade',
|
|
]);
|
|
|
|
await listPage.visitRoot({ backend: 'secret' });
|
|
await settled();
|
|
await listPage.create();
|
|
await settled();
|
|
await editPage.createSecret(secretPath, 'version1', 'hello');
|
|
await settled();
|
|
await click('[data-test-popup-menu-trigger="version"]');
|
|
|
|
assert.dom('[data-test-view-diff]').doesNotExist('does not show diff view with only one version');
|
|
// add another version
|
|
await click('[data-test-secret-edit="true"]');
|
|
|
|
let secondKey = document.querySelectorAll('[data-test-secret-key]')[1];
|
|
let secondValue = document.querySelectorAll('.masked-value')[1];
|
|
await fillIn(secondKey, 'version2');
|
|
await fillIn(secondValue, 'world!');
|
|
await click('[data-test-secret-save]');
|
|
|
|
await click('[data-test-popup-menu-trigger="version"]');
|
|
|
|
assert.dom('[data-test-view-diff]').exists('does show diff view with two versions');
|
|
|
|
await click('[data-test-view-diff]');
|
|
|
|
let diffBetweenVersion2and1 = document.querySelector('.jsondiffpatch-added').innerText;
|
|
assert.equal(diffBetweenVersion2and1, 'version2"world!"', 'shows the correct added part');
|
|
|
|
await click('[data-test-popup-menu-trigger="right-version"]');
|
|
|
|
await click('[data-test-rightSide-version="2"]');
|
|
|
|
assert.dom('.diff-status').exists('shows States Match');
|
|
});
|
|
});
|