33 * SPDX-License-Identifier: BUSL-1.1
44 */
55
6- import { currentRouteName , visit } from '@ember/test-helpers' ;
6+ import { click , currentRouteName , settled , visit } from '@ember/test-helpers' ;
7+ import { selectChoose } from 'ember-power-select/test-support' ;
78import { module , test } from 'qunit' ;
89import { setupApplicationTest } from 'ember-qunit' ;
910import { v4 as uuidv4 } from 'uuid' ;
@@ -19,6 +20,7 @@ import { PAGE } from 'vault/tests/helpers/kv/kv-selectors';
1920import { create } from 'ember-cli-page-object' ;
2021
2122import apiStub from 'vault/tests/helpers/noop-all-api-requests' ;
23+ import { deleteEngineCmd , runCmd } from 'vault/tests/helpers/commands' ;
2224
2325const cli = create ( consolePanel ) ;
2426
@@ -65,7 +67,15 @@ module('Acceptance | secrets/generic/create', function (hooks) {
6567 // upgrade to version 2 generic mount
6668 `write sys/mounts/${ path } /tune options=version=2` ,
6769 ] ) ;
68- await visit ( `/vault/secrets/${ path } /kv/list` ) ;
70+ await visit ( '/vault/secrets' ) ;
71+ await selectChoose ( '[data-test-component="search-select"]#filter-by-engine-name' , path ) ;
72+ await settled ( ) ;
73+ await click ( `[data-test-secrets-backend-link="${ path } "]` ) ;
74+ assert . strictEqual (
75+ currentRouteName ( ) ,
76+ 'vault.cluster.secrets.backend.kv.list' ,
77+ 'navigates to the KV engine list page'
78+ ) ;
6979
7080 assert
7181 . dom ( PAGE . list . item ( 'foo' ) )
@@ -78,5 +88,15 @@ module('Acceptance | secrets/generic/create', function (hooks) {
7888 assert . dom ( PAGE . list . item ( secret . path ) ) . exists ( 'lists both records' ) ;
7989 } ) ;
8090 assert . dom ( PAGE . list . item ( ) ) . exists ( { count : 2 } , 'lists only the two secrets' ) ;
91+
92+ await visit ( `/vault/secrets/${ path } /list` ) ;
93+ assert . strictEqual (
94+ currentRouteName ( ) ,
95+ 'vault.cluster.secrets.backend.kv.list' ,
96+ 'redirects to the KV engine list page from generic list'
97+ ) ;
98+
99+ // Clean up
100+ await runCmd ( deleteEngineCmd ( path ) ) ;
81101 } ) ;
82102} ) ;
0 commit comments