From 5e471e699a4589595a948aaeebabc36b367e25d4 Mon Sep 17 00:00:00 2001 From: Daniel Karski Date: Fri, 20 Dec 2024 10:07:24 +0100 Subject: [PATCH] [CP-3360] add test-ids for Contacts (#2242) Co-authored-by: Katarzyna Stegienko --- libs/e2e-test-ids/src/e2e-test-ids.ts | 26 +++++++++++++++++++ .../interactive/form/input/checkbox-input.tsx | 6 +++-- .../ui/src/lib/table/table-cell.tsx | 2 ++ .../ui/src/lib/table/table-header-cell.tsx | 3 ++- libs/generic-view/ui/src/lib/table/table.tsx | 11 ++++---- .../generic-view/ui/src/lib/texts/headers.tsx | 8 ++++-- .../ui/src/lib/texts/paragraphs.tsx | 16 ++++++++---- 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/libs/e2e-test-ids/src/e2e-test-ids.ts b/libs/e2e-test-ids/src/e2e-test-ids.ts index fd55e24944..f9948c5b9d 100644 --- a/libs/e2e-test-ids/src/e2e-test-ids.ts +++ b/libs/e2e-test-ids/src/e2e-test-ids.ts @@ -14,6 +14,32 @@ export enum InteractiveTextInputTestIds { ErrorText = "interactive-text-input-error-text", } +export enum TypographyTestIds { + H1 = "ui-typography-h1", + H2 = "ui-typography-h2", + H3 = "ui-typography-h3", + H4 = "ui-typography-h4", + H5 = "ui-typography-h5", + P1 = "ui-typography-p1", + P2 = "ui-typography-p2", + P3 = "ui-typography-p3", + P4 = "ui-typography-p4", + P5 = "ui-typography-p5", +} + +export enum CheckboxTestIds { + Checkbox = "ui-checkbox", +} + +export enum TableTestIds { + Table = "ui-table", + TableRow = "ui-table-row", + TableHeaderRow = "ui-table-header-row", + TablePlaceholderRow = "ui-table-place-holder-row", + TableCell = "ui-table-cell", + TableHeaderCell = "ui-table-header-cell", +} + export enum PredefinedBackupPasswordTestIds { Title = "predefined-backup-password-title", Description = "predefined-backup-password-description", diff --git a/libs/generic-view/ui/src/lib/interactive/form/input/checkbox-input.tsx b/libs/generic-view/ui/src/lib/interactive/form/input/checkbox-input.tsx index 72b1df1f3a..f8e7c03849 100644 --- a/libs/generic-view/ui/src/lib/interactive/form/input/checkbox-input.tsx +++ b/libs/generic-view/ui/src/lib/interactive/form/input/checkbox-input.tsx @@ -4,10 +4,11 @@ */ import React, { useCallback, useEffect, useId, useMemo, useRef } from "react" -import { APIFC, IconType, useViewFormContext } from "generic-view/utils" import styled from "styled-components" -import { Icon } from "../../../icon/icon" +import { CheckboxTestIds } from "e2e-test-ids" +import { APIFC, IconType, useViewFormContext } from "generic-view/utils" import { FormCheckboxInputConfig } from "generic-view/models" +import { Icon } from "../../../icon/icon" interface Config extends FormCheckboxInputConfig { onToggle?: (checked: boolean) => void @@ -110,6 +111,7 @@ export const CheckboxInput: APIFC = ({ > = ({ children, @@ -20,6 +21,7 @@ export const TableCell: APIFC = ({ () => { return ( export const TableHeaderCell: APIFC = (props) => ( - + ) diff --git a/libs/generic-view/ui/src/lib/table/table.tsx b/libs/generic-view/ui/src/lib/table/table.tsx index 61b994c6af..21e37d917a 100644 --- a/libs/generic-view/ui/src/lib/table/table.tsx +++ b/libs/generic-view/ui/src/lib/table/table.tsx @@ -15,6 +15,7 @@ import React, { } from "react" import styled from "styled-components" import { difference, intersection } from "lodash" +import { TableTestIds } from "e2e-test-ids" import { APIFC, useViewFormContext } from "generic-view/utils" import { TableConfig, @@ -139,8 +140,8 @@ export const Table: APIFC & { (id: string) => { const isActive = activeRowId === id return ( - - + +
@@ -188,7 +189,7 @@ export const Table: APIFC & { const isActive = activeRowId === id return ( - + {renderChildren(id)} ) @@ -205,9 +206,9 @@ export const Table: APIFC & { return useMemo( () => ( - + - {renderHeaderChildren()} + {renderHeaderChildren()} {data?.map((id, index) => renderRow(id, index))} diff --git a/libs/generic-view/ui/src/lib/texts/headers.tsx b/libs/generic-view/ui/src/lib/texts/headers.tsx index aeb5b5d254..99a1670ab1 100644 --- a/libs/generic-view/ui/src/lib/texts/headers.tsx +++ b/libs/generic-view/ui/src/lib/texts/headers.tsx @@ -4,10 +4,11 @@ */ import React from "react" -import { APIFC } from "generic-view/utils" +import { isEmpty } from "lodash" import styled, { css } from "styled-components" +import { TypographyTestIds } from "e2e-test-ids" +import { APIFC } from "generic-view/utils" import { HeaderConfig, UnboldValidator } from "generic-view/models" -import { isEmpty } from "lodash" import { CommonTextProps, commonTextStyles } from "./common-text-styles" interface HeaderProps extends CommonTextProps { @@ -37,6 +38,7 @@ export const Header3: APIFC = ({ }) => { return (

= ({ }) => { return (

= ({ }) => { return (

= ({ return ( {isEmpty(children) ? transformedText : children} @@ -80,11 +82,12 @@ export const Paragraph2: APIFC = ({ return ( {isEmpty(children) ? transformedText : children} @@ -120,11 +123,12 @@ export const Paragraph3: APIFC = ({ return ( {isEmpty(children) ? transformedText : children} @@ -160,11 +164,12 @@ export const Paragraph4: APIFC = ({ return ( {isEmpty(children) ? transformedText : children} @@ -200,11 +205,12 @@ export const Paragraph5: APIFC = ({ return ( {isEmpty(children) ? transformedText : children}