diff --git a/nodemon.json b/nodemon.json index f7e53e057..2f7903bdb 100644 --- a/nodemon.json +++ b/nodemon.json @@ -4,7 +4,8 @@ "node_modules", "node_modules/**/node_modules", "src/admin", - "src/**/*.spec.ts" + "src/**/*.spec.ts", + "test/**/payload-types.ts" ], "watch": [ "src/**/*.ts", diff --git a/package.json b/package.json index 50c0e8a02..cf0febba9 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "demo:generate:graphqlschema": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts node dist/bin/generateGraphQLSchema", "demo:serve": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts NODE_ENV=production nodemon", "dev": "nodemon", + "dev:generatetypes": "node ./test/dev/generateTypes.js", "test": "yarn test:int && yarn test:components", "test:int": "cross-env NODE_ENV=test DISABLE_LOGGING=true jest --forceExit --detectOpenHandles", "test:e2e": "cross-env NODE_ENV=test DISABLE_LOGGING=true playwright test", diff --git a/playwright.config.ts b/playwright.config.ts index ec3ca50a8..75010eb3f 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -5,5 +5,6 @@ const config: PlaywrightTestConfig = { // Look for test files in the "tests" directory, relative to this configuration file testDir: 'test/e2e', workers: 999, + timeout: 600000, }; export default config; diff --git a/src/admin/components/elements/Button/index.tsx b/src/admin/components/elements/Button/index.tsx index 2552aa342..4ddfc5faa 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 3512c5c84..2cdadc7e7 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/Card/index.tsx b/src/admin/components/elements/Card/index.tsx index ae30db123..697ecbaed 100644 --- a/src/admin/components/elements/Card/index.tsx +++ b/src/admin/components/elements/Card/index.tsx @@ -7,15 +7,19 @@ import './index.scss'; const baseClass = 'card'; const Card: React.FC = (props) => { - const { title, actions, onClick } = props; + const { id, title, actions, onClick } = props; const classes = [ baseClass, + id, onClick && `${baseClass}--has-onclick`, ].filter(Boolean).join(' '); return ( -
+
{title}
diff --git a/src/admin/components/elements/Card/types.ts b/src/admin/components/elements/Card/types.ts index 016254b24..505a9fbe7 100644 --- a/src/admin/components/elements/Card/types.ts +++ b/src/admin/components/elements/Card/types.ts @@ -1,4 +1,5 @@ export type Props = { + id?: string, title: string, actions?: React.ReactNode, onClick?: () => void, diff --git a/src/admin/components/elements/DeleteDocument/index.tsx b/src/admin/components/elements/DeleteDocument/index.tsx index 1f32cca29..f9873eb9c 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 5c353a5d2..40266d3c6 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 be3755d47..5c59984e2 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 (