diff --git a/apps/mudita-center-e2e/src/helpers/index.ts b/apps/mudita-center-e2e/src/helpers/index.ts index 844f85e401..62a4e2bea6 100644 --- a/apps/mudita-center-e2e/src/helpers/index.ts +++ b/apps/mudita-center-e2e/src/helpers/index.ts @@ -4,3 +4,4 @@ */ export * from "./sleep.helper" +export * from "./testid.helper" diff --git a/apps/mudita-center-e2e/src/helpers/testid.helper.ts b/apps/mudita-center-e2e/src/helpers/testid.helper.ts new file mode 100644 index 0000000000..be1037dee1 --- /dev/null +++ b/apps/mudita-center-e2e/src/helpers/testid.helper.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Mudita sp. z o.o. All rights reserved. + * For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md + */ + +const PRIMARY_BUTTON_TEST_ID = "primary-button" + +export const getPrimaryButtonTestId = (componentId: string) => { + return `${PRIMARY_BUTTON_TEST_ID}-${componentId}` +} diff --git a/libs/core/contact-support/components/contact-support-modal.component.test.tsx b/libs/core/contact-support/components/contact-support-modal.component.test.tsx index 2312575fb4..1657bcf933 100644 --- a/libs/core/contact-support/components/contact-support-modal.component.test.tsx +++ b/libs/core/contact-support/components/contact-support-modal.component.test.tsx @@ -12,6 +12,19 @@ import { ContactSupportModalTestIds } from "Core/contact-support/components/cont import { noop } from "Core/__deprecated__/renderer/utils/noop" import { FileListTestIds } from "Core/__deprecated__/renderer/components/core/file-list/file-list-test-ids.enum" +jest.mock("e2e-test-ids", () => { + return { + NewContactSupportModalTestIds: { + Title: "contact-support-modal-title", + Subtitle: "contact-support-modal-subtitle", + EmailLabel: "email-label", + MessageLabel: "message-label", + AttachedFilesLabel: "attached-files-label", + AttachedFilesSubtext: "attached-files-subtext", + }, + } +}) + type Props = ComponentProps const defaultProps: Props = { open: true, diff --git a/libs/core/contact-support/components/contact-support-modal.component.tsx b/libs/core/contact-support/components/contact-support-modal.component.tsx index 96e25a9ee7..f60a60b667 100644 --- a/libs/core/contact-support/components/contact-support-modal.component.tsx +++ b/libs/core/contact-support/components/contact-support-modal.component.tsx @@ -36,6 +36,7 @@ import { HelpActions } from "Core/__deprecated__/common/enums/help-actions.enum" import { ModalTestIds } from "Core/__deprecated__/renderer/components/core/modal/modal-test-ids.enum" import { Close } from "Core/__deprecated__/renderer/components/core/modal/modal.styled.elements" import { SpinnerLoader } from "../../../generic-view/ui/src/lib/shared/spinner-loader" +import { NewContactSupportModalTestIds } from "e2e-test-ids" const messages = defineMessages({ actionButton: { @@ -95,8 +96,12 @@ interface FormInputLabelProps { export const FormInputLabelComponent: FunctionComponent< FormInputLabelProps -> = ({ className, label, optional }) => ( - +> = ({ className, label, optional, ...rest }) => ( + {optional && ( = ({ -

+

-

+

- + = ({ label={intl.formatMessage(messages.emailPlaceholder)} {...register(FieldKeys.Email, emailValidator)} /> - + = ({ data-testid={ContactSupportModalTestIds.DescriptionInput} {...register(FieldKeys.Description)} /> - + { ModalTestIds: { Modal: "modal-content", }, + NewContactSupportModalTestIds: { + Title: "contact-support-modal-title", + Subtitle: "contact-support-modal-subtitle", + EmailLabel: "email-label", + MessageLabel: "message-label", + AttachedFilesLabel: "attached-files-label", + AttachedFilesSubtext: "attached-files-subtext", + }, } }) diff --git a/libs/e2e-test-ids/src/e2e-test-ids.ts b/libs/e2e-test-ids/src/e2e-test-ids.ts index bb43215e3d..cef7c4410f 100644 --- a/libs/e2e-test-ids/src/e2e-test-ids.ts +++ b/libs/e2e-test-ids/src/e2e-test-ids.ts @@ -29,6 +29,10 @@ export enum ContactSupportModalTestIds { CloseButton = "contact-support-modal-success-close-button", } +export enum ButtonTestIds { + PrimaryButton = "primary-button", +} + export enum BackupModalTestIds { Title = "backup-features-modal-title", Description = "backup-features-modal-description", @@ -41,3 +45,12 @@ export enum BackupModalTestIds { export enum ModalTestIds { Modal = "modal-content", } + +export enum NewContactSupportModalTestIds { + Title = "contact-support-modal-title", + Subtitle = "contact-support-modal-subtitle", + EmailLabel = "email-label", + MessageLabel = "message-label", + AttachedFilesLabel = "attached-files-label", + AttachedFilesSubtext = "attached-files-subtext", +} diff --git a/libs/generic-view/ui/src/lib/buttons/button-primary.tsx b/libs/generic-view/ui/src/lib/buttons/button-primary.tsx index 029aac78e3..a92fd6d91b 100644 --- a/libs/generic-view/ui/src/lib/buttons/button-primary.tsx +++ b/libs/generic-view/ui/src/lib/buttons/button-primary.tsx @@ -9,6 +9,7 @@ import { APIFC } from "generic-view/utils" import { ButtonBase } from "./button-base/button-base" import { Icon } from "../icon/icon" import { ButtonPrimaryConfig } from "generic-view/models" +import { ButtonTestIds } from "e2e-test-ids" export const ButtonPrimary: APIFC = ({ data, @@ -17,7 +18,12 @@ export const ButtonPrimary: APIFC = ({ ...props }) => { return ( -