mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-23 23:51:08 +02:00
* move some auth controller logic to route page component * remove unused vars * fix action handling so this context is retained * rename authpage to auth-form-page * rename auth-route-page to auth-splash-page * link jira VAULT-28251 * wowww typo * add padding to mfa form alert message * update component name in tests * alphabetize args * use auth helpers for login method * remove async, await * rename components * update jsdoc * add comment
21 lines
670 B
TypeScript
21 lines
670 B
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { click, fillIn, visit } from '@ember/test-helpers';
|
|
import VAULT_KEYS from 'vault/tests/helpers/vault-keys';
|
|
import { AUTH_FORM } from 'vault/tests/helpers/auth/auth-form-selectors';
|
|
|
|
const { rootToken } = VAULT_KEYS;
|
|
|
|
export const login = async (token = rootToken) => {
|
|
// make sure we're always logged out and logged back in
|
|
await visit('/vault/logout');
|
|
// clear session storage to ensure we have a clean state
|
|
window.localStorage.clear();
|
|
await visit('/vault/auth?with=token');
|
|
await fillIn(AUTH_FORM.input('token'), token);
|
|
return await click(AUTH_FORM.login);
|
|
};
|