vault/ui/tests/helpers/config-ui/message-selectors.ts
Angel Garbarino 6cc4eae735
Address flaky tests: namespace and config-ui/messages (#31016)
* namespace and ui-config, running out of time ahhh

* fix some tests

* triple back to back runs on namespace and we're solid

* add cleanup test pollution on config-ui/messages and also remove the empty state check as we do that in the component test:

* Fix test error: "Promise rejected during "it should show the list of custom messages": _generalSelectors.GENERAL.listItem is not a function"

* fix more tests

---------

Co-authored-by: Shannon Roberts <shannon.roberts@hashicorp.com>
2025-06-23 09:12:52 -06:00

25 lines
1.2 KiB
TypeScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
export const CUSTOM_MESSAGES = {
// General selectors that are common between custom messages
inlineErrorMessage: `[data-test-inline-error-message]`,
unauthCreateFormInfo: '[data-test-unauth-info]',
navLink: '[data-test-sidebar-nav-link="Custom Messages"]',
radio: (radioName: string) => `[data-test-radio="${radioName}"]`,
field: (fieldName: string) => `[data-test-field="${fieldName}"]`,
input: (input: string) => `[data-test-input="${input}"]`,
fieldValidation: (fieldName: string) => `[data-test-validation-error="${fieldName}"]`,
modal: (name: string) => `[data-test-modal="${name}"]`,
modalTitle: (title: string) => `[data-test-modal-title="${title}"]`,
modalBody: (name: string) => `[data-test-modal-body="${name}"]`,
alert: (name: string) => `data-test-custom-alert=${name}`,
alertTitle: (name: string) => `[data-test-custom-alert-title="${name}"]`,
alertDescription: (name: string) => `[data-test-custom-alert-description="${name}"]`,
alertAction: (name: string) => `[data-test-custom-alert-action="${name}"]`,
badge: (name: string) => `[data-test-badge="${name}"]`,
tab: (name: string) => `[data-test-custom-messages-tab="${name}"]`,
};