From 4a3588e965343ecaf3edcc0c2dbd09e197291b81 Mon Sep 17 00:00:00 2001 From: Elliot DeNolf Date: Thu, 14 Jul 2022 16:16:16 -0700 Subject: [PATCH] test: collections and new test ids and classes --- .../components/elements/Button/index.tsx | 6 +- src/admin/components/elements/Button/types.ts | 2 + .../elements/DeleteDocument/index.tsx | 4 + .../elements/DeleteDocument/types.ts | 1 + .../elements/DuplicateDocument/index.tsx | 1 + src/admin/components/elements/Table/index.tsx | 5 +- .../elements/WhereBuilder/Condition/index.tsx | 2 + src/admin/components/forms/Submit/index.tsx | 3 +- .../views/collections/Edit/Default.tsx | 12 ++- test/e2e/collections/config.ts | 9 +++ test/e2e/collections/index.spec.ts | 74 +++++++++---------- test/e2e/helpers.ts | 2 +- test/helpers/configHelpers.ts | 1 - 13 files changed, 74 insertions(+), 48 deletions(-) diff --git a/src/admin/components/elements/Button/index.tsx b/src/admin/components/elements/Button/index.tsx index 2552aa3421..4ddfc5faa7 100644 --- a/src/admin/components/elements/Button/index.tsx +++ b/src/admin/components/elements/Button/index.tsx @@ -25,7 +25,9 @@ const ButtonContents = ({ children, icon, tooltip }) => { const BuiltInIcon = icons[icon]; return ( - + {tooltip && ( {tooltip} @@ -49,6 +51,7 @@ const ButtonContents = ({ children, icon, tooltip }) => { const Button: React.FC = (props) => { const { className, + id, type = 'button', el, to, @@ -86,6 +89,7 @@ const Button: React.FC = (props) => { } const buttonProps = { + id, type, className: classes, disabled, diff --git a/src/admin/components/elements/Button/types.ts b/src/admin/components/elements/Button/types.ts index 3512c5c848..2cdadc7e7b 100644 --- a/src/admin/components/elements/Button/types.ts +++ b/src/admin/components/elements/Button/types.ts @@ -2,6 +2,7 @@ import React, { MouseEvent } from 'react'; export type Props = { className?: string, + id?: string, type?: 'submit' | 'button', el?: 'link' | 'anchor' | undefined, to?: string, @@ -12,6 +13,7 @@ export type Props = { icon?: React.ReactNode | ['chevron' | 'x' | 'plus' | 'edit'], iconStyle?: 'with-border' | 'without-border' | 'none', buttonStyle?: 'primary' | 'secondary' | 'transparent' | 'error' | 'none' | 'icon-label', + buttonId?: string, round?: boolean, size?: 'small' | 'medium', iconPosition?: 'left' | 'right', diff --git a/src/admin/components/elements/DeleteDocument/index.tsx b/src/admin/components/elements/DeleteDocument/index.tsx index 1f32cca297..f9873eb9c5 100644 --- a/src/admin/components/elements/DeleteDocument/index.tsx +++ b/src/admin/components/elements/DeleteDocument/index.tsx @@ -18,6 +18,7 @@ const DeleteDocument: React.FC = (props) => { const { title: titleFromProps, id, + buttonId, collection: { admin: { useAsTitle, @@ -78,6 +79,7 @@ const DeleteDocument: React.FC = (props) => { diff --git a/src/admin/components/elements/DeleteDocument/types.ts b/src/admin/components/elements/DeleteDocument/types.ts index 5c353a5d2e..40266d3c66 100644 --- a/src/admin/components/elements/DeleteDocument/types.ts +++ b/src/admin/components/elements/DeleteDocument/types.ts @@ -3,5 +3,6 @@ import { SanitizedCollectionConfig } from '../../../../collections/config/types' export type Props = { collection?: SanitizedCollectionConfig, id?: string, + buttonId?: string, title?: string, } diff --git a/src/admin/components/elements/DuplicateDocument/index.tsx b/src/admin/components/elements/DuplicateDocument/index.tsx index be3755d476..5c59984e2a 100644 --- a/src/admin/components/elements/DuplicateDocument/index.tsx +++ b/src/admin/components/elements/DuplicateDocument/index.tsx @@ -27,6 +27,7 @@ const Duplicate: React.FC = ({ slug }) => { return (