mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-23 23:51:08 +02:00
* consolidate policies tests, remove page object for policies in favor of string selectors * auth list test fix * clean up pki-configuration test and only use error.errors if contents are string * use mirage for version on landing page dashboard test * changes not needed for upgrade but good clean up work. * revert pki workflow changes * remove unused test selector * remove change to keep cleaner file count. * add check on control groups * remove space causing test problems * use uuid for database backend name --------- Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
66 lines
2.3 KiB
JavaScript
66 lines
2.3 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { text, triggerable, clickable, collection, fillable, value, isPresent } from 'ember-cli-page-object';
|
|
import { getter } from 'ember-cli-page-object/macros';
|
|
import { settled } from '@ember/test-helpers';
|
|
|
|
import keys from 'core/utils/key-codes';
|
|
|
|
export default {
|
|
toggle: clickable('[data-test-console-toggle]'),
|
|
consoleInput: fillable('[data-test-component="console/command-input"] input'),
|
|
consoleInputValue: value('[data-test-component="console/command-input"] input'),
|
|
logOutput: text('[data-test-component="console/output-log"]'),
|
|
logOutputItems: collection('[data-test-component="console/output-log"] > div', {
|
|
text: text(),
|
|
}),
|
|
lastLogOutput: getter(function () {
|
|
const count = this.logOutputItems.length;
|
|
if (count === 0) {
|
|
// If no logOutput items are found, we can assume the response is empty
|
|
return '';
|
|
}
|
|
const outputItemText = this.logOutputItems[count - 1].text;
|
|
return outputItemText;
|
|
}),
|
|
logTextItems: collection('[data-test-component="console/log-text"]', {
|
|
text: text(),
|
|
}),
|
|
lastTextOutput: getter(function () {
|
|
const count = this.logTextItems.length;
|
|
if (count === 0) {
|
|
// If no logOutput items are found, we can assume the response is empty
|
|
return '';
|
|
}
|
|
return this.logTextItems.objectAt(count - 1).text;
|
|
}),
|
|
logJSONItems: collection('[data-test-component="console/log-json"]', {
|
|
text: text(),
|
|
}),
|
|
lastJSONOutput: getter(function () {
|
|
const count = this.logJSONItems.length;
|
|
return this.logJSONItems.objectAt(count - 1).text;
|
|
}),
|
|
up: triggerable('keyup', '[data-test-component="console/command-input"] input', {
|
|
eventProperties: { keyCode: keys.UP },
|
|
}),
|
|
down: triggerable('keyup', '[data-test-component="console/command-input"] input', {
|
|
eventProperties: { keyCode: keys.DOWN },
|
|
}),
|
|
enter: triggerable('keyup', '[data-test-component="console/command-input"] input', {
|
|
eventProperties: { keyCode: keys.ENTER },
|
|
}),
|
|
hasInput: isPresent('[data-test-component="console/command-input"] input'),
|
|
runCommands: async function (commands) {
|
|
const toExecute = Array.isArray(commands) ? commands : [commands];
|
|
for (const command of toExecute) {
|
|
await this.consoleInput(command);
|
|
await this.enter();
|
|
await settled();
|
|
}
|
|
},
|
|
};
|