chore: separate Lexical tests into dedicated suite (#12047)

Lexical tests comprise almost half of the collections in the fields
suite, and are starting to become complex to manage.

They are sometimes related to other auxiliary collections, so
refactoring one test sometimes breaks another, seemingly unrelated one.

In addition, the fields suite is very large, taking a long time to
compile. This will make it faster.

Some ideas for future refactorings:
- 3 main collections: defaultFeatures, fully featured, and legacy.
Legacy is the current one that has multiple editors and could later be
migrated to the first two.
- Avoid collections with more than 1 editor.
- Create reseed buttons to restore the editor to certain states, to
avoid a proliferation of collections and documents.
- Reduce the complexity of the three auxiliary collections (text, array,
upload), which are rarely or never used and have many fields designed
for tests in the fields suite.
This commit is contained in:
Germán Jabloñski
2025-04-10 20:47:26 -03:00
committed by GitHub
parent 272914c818
commit a66f90ebb6
68 changed files with 2668 additions and 1210 deletions

View File

@@ -61,22 +61,6 @@ export type SupportedTimezones =
| 'Pacific/Auckland'
| 'Pacific/Fiji'
| 'America/Monterrey';
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "BlockColumns".
*/
export type BlockColumns =
| {
text?: string | null;
subArray?:
| {
requiredText: string;
id?: string | null;
}[]
| null;
id?: string | null;
}[]
| null;
export interface Config {
auth: {
@@ -88,13 +72,7 @@ export interface Config {
localizedTextReference2: LocalizedTextReference2;
};
collections: {
'lexical-fields': LexicalField;
'lexical-migrate-fields': LexicalMigrateField;
'lexical-localized-fields': LexicalLocalizedField;
lexicalObjectReferenceBug: LexicalObjectReferenceBug;
users: User;
LexicalInBlock: LexicalInBlock;
'lexical-access-control': LexicalAccessControl;
'select-versions-fields': SelectVersionsField;
'array-fields': ArrayField;
'block-fields': BlockField;
@@ -115,8 +93,6 @@ export interface Config {
'number-fields': NumberField;
'point-fields': PointField;
'relationship-fields': RelationshipField;
'lexical-relationship-fields': LexicalRelationshipField;
'rich-text-fields': RichTextField;
'select-fields': SelectField;
'tabs-fields-2': TabsFields2;
'tabs-fields': TabsField;
@@ -135,13 +111,7 @@ export interface Config {
};
collectionsJoins: {};
collectionsSelect: {
'lexical-fields': LexicalFieldsSelect<false> | LexicalFieldsSelect<true>;
'lexical-migrate-fields': LexicalMigrateFieldsSelect<false> | LexicalMigrateFieldsSelect<true>;
'lexical-localized-fields': LexicalLocalizedFieldsSelect<false> | LexicalLocalizedFieldsSelect<true>;
lexicalObjectReferenceBug: LexicalObjectReferenceBugSelect<false> | LexicalObjectReferenceBugSelect<true>;
users: UsersSelect<false> | UsersSelect<true>;
LexicalInBlock: LexicalInBlockSelect<false> | LexicalInBlockSelect<true>;
'lexical-access-control': LexicalAccessControlSelect<false> | LexicalAccessControlSelect<true>;
'select-versions-fields': SelectVersionsFieldsSelect<false> | SelectVersionsFieldsSelect<true>;
'array-fields': ArrayFieldsSelect<false> | ArrayFieldsSelect<true>;
'block-fields': BlockFieldsSelect<false> | BlockFieldsSelect<true>;
@@ -162,8 +132,6 @@ export interface Config {
'number-fields': NumberFieldsSelect<false> | NumberFieldsSelect<true>;
'point-fields': PointFieldsSelect<false> | PointFieldsSelect<true>;
'relationship-fields': RelationshipFieldsSelect<false> | RelationshipFieldsSelect<true>;
'lexical-relationship-fields': LexicalRelationshipFieldsSelect<false> | LexicalRelationshipFieldsSelect<true>;
'rich-text-fields': RichTextFieldsSelect<false> | RichTextFieldsSelect<true>;
'select-fields': SelectFieldsSelect<false> | SelectFieldsSelect<true>;
'tabs-fields-2': TabsFields2Select<false> | TabsFields2Select<true>;
'tabs-fields': TabsFieldsSelect<false> | TabsFieldsSelect<true>;
@@ -183,12 +151,8 @@ export interface Config {
db: {
defaultIDType: string;
};
globals: {
tabsWithRichText: TabsWithRichText;
};
globalsSelect: {
tabsWithRichText: TabsWithRichTextSelect<false> | TabsWithRichTextSelect<true>;
};
globals: {};
globalsSelect: {};
locale: 'en' | 'es';
user: User & {
collection: 'users';
@@ -246,242 +210,6 @@ export interface LocalizedTextReference2 {
blockName?: string | null;
blockType: 'localizedTextReference2';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-fields".
*/
export interface LexicalField {
id: string;
title: string;
lexicalRootEditor?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalSimple?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalWithBlocks: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
};
lexicalWithBlocks_markdown?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-migrate-fields".
*/
export interface LexicalMigrateField {
id: string;
title: string;
lexicalWithLexicalPluginData?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalWithSlateData?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalSimple?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalSimple_html?: string | null;
groupWithLexicalField?: {
lexicalInGroupField?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalInGroupField_html?: string | null;
};
arrayWithLexicalField?:
| {
lexicalInArrayField?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalInArrayField_html?: string | null;
id?: string | null;
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-localized-fields".
*/
export interface LexicalLocalizedField {
id: string;
title: string;
/**
* Non-localized field with localized block subfields
*/
lexicalBlocksSubLocalized?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
/**
* Localized field with localized block subfields
*/
lexicalBlocksLocalized?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexicalObjectReferenceBug".
*/
export interface LexicalObjectReferenceBug {
id: string;
lexicalDefault?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
lexicalEditor?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users".
@@ -500,77 +228,6 @@ export interface User {
lockUntil?: string | null;
password?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "LexicalInBlock".
*/
export interface LexicalInBlock {
id: string;
content?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
blocks?:
| {
lexical?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
id?: string | null;
blockName?: string | null;
blockType: 'lexicalInBlock2';
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-access-control".
*/
export interface LexicalAccessControl {
id: string;
title?: string | null;
richText?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "select-versions-fields".
@@ -1658,126 +1315,6 @@ export interface RelationshipField {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-relationship-fields".
*/
export interface LexicalRelationshipField {
id: string;
richText?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
richText2?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "rich-text-fields".
*/
export interface RichTextField {
id: string;
title: string;
lexicalCustomFields: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
};
lexicalCustomFields_html?: string | null;
/**
* This rich text field uses the lexical editor.
*/
lexical?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
/**
* This select field is rendered here to ensure its options dropdown renders above the rich text toolbar.
*/
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[] | null;
richText: {
[k: string]: unknown;
}[];
richTextCustomFields?:
| {
[k: string]: unknown;
}[]
| null;
richTextReadOnly?:
| {
[k: string]: unknown;
}[]
| null;
blocks?:
| (
| {
text?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'textBlock';
}
| {
text?:
| {
[k: string]: unknown;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'richTextBlockSlate';
}
)[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "select-fields".
@@ -2067,34 +1604,10 @@ export interface UiField {
export interface PayloadLockedDocument {
id: string;
document?:
| ({
relationTo: 'lexical-fields';
value: string | LexicalField;
} | null)
| ({
relationTo: 'lexical-migrate-fields';
value: string | LexicalMigrateField;
} | null)
| ({
relationTo: 'lexical-localized-fields';
value: string | LexicalLocalizedField;
} | null)
| ({
relationTo: 'lexicalObjectReferenceBug';
value: string | LexicalObjectReferenceBug;
} | null)
| ({
relationTo: 'users';
value: string | User;
} | null)
| ({
relationTo: 'LexicalInBlock';
value: string | LexicalInBlock;
} | null)
| ({
relationTo: 'lexical-access-control';
value: string | LexicalAccessControl;
} | null)
| ({
relationTo: 'select-versions-fields';
value: string | SelectVersionsField;
@@ -2175,14 +1688,6 @@ export interface PayloadLockedDocument {
relationTo: 'relationship-fields';
value: string | RelationshipField;
} | null)
| ({
relationTo: 'lexical-relationship-fields';
value: string | LexicalRelationshipField;
} | null)
| ({
relationTo: 'rich-text-fields';
value: string | RichTextField;
} | null)
| ({
relationTo: 'select-fields';
value: string | SelectField;
@@ -2273,66 +1778,6 @@ export interface PayloadMigration {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-fields_select".
*/
export interface LexicalFieldsSelect<T extends boolean = true> {
title?: T;
lexicalRootEditor?: T;
lexicalSimple?: T;
lexicalWithBlocks?: T;
lexicalWithBlocks_markdown?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-migrate-fields_select".
*/
export interface LexicalMigrateFieldsSelect<T extends boolean = true> {
title?: T;
lexicalWithLexicalPluginData?: T;
lexicalWithSlateData?: T;
lexicalSimple?: T;
lexicalSimple_html?: T;
groupWithLexicalField?:
| T
| {
lexicalInGroupField?: T;
lexicalInGroupField_html?: T;
};
arrayWithLexicalField?:
| T
| {
lexicalInArrayField?: T;
lexicalInArrayField_html?: T;
id?: T;
};
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-localized-fields_select".
*/
export interface LexicalLocalizedFieldsSelect<T extends boolean = true> {
title?: T;
lexicalBlocksSubLocalized?: T;
lexicalBlocksLocalized?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexicalObjectReferenceBug_select".
*/
export interface LexicalObjectReferenceBugSelect<T extends boolean = true> {
lexicalDefault?: T;
lexicalEditor?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users_select".
@@ -2349,36 +1794,6 @@ export interface UsersSelect<T extends boolean = true> {
loginAttempts?: T;
lockUntil?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "LexicalInBlock_select".
*/
export interface LexicalInBlockSelect<T extends boolean = true> {
content?: T;
blocks?:
| T
| {
lexicalInBlock2?:
| T
| {
lexical?: T;
id?: T;
blockName?: T;
};
};
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-access-control_select".
*/
export interface LexicalAccessControlSelect<T extends boolean = true> {
title?: T;
richText?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "select-versions-fields_select".
@@ -3374,50 +2789,6 @@ export interface RelationshipFieldsSelect<T extends boolean = true> {
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-relationship-fields_select".
*/
export interface LexicalRelationshipFieldsSelect<T extends boolean = true> {
richText?: T;
richText2?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "rich-text-fields_select".
*/
export interface RichTextFieldsSelect<T extends boolean = true> {
title?: T;
lexicalCustomFields?: T;
lexicalCustomFields_html?: T;
lexical?: T;
selectHasMany?: T;
richText?: T;
richTextCustomFields?: T;
richTextReadOnly?: T;
blocks?:
| T
| {
textBlock?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
richTextBlockSlate?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
};
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "select-fields_select".
@@ -3766,93 +3137,6 @@ export interface PayloadMigrationsSelect<T extends boolean = true> {
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "tabsWithRichText".
*/
export interface TabsWithRichText {
id: string;
tab1?: {
rt1?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
};
tab2?: {
rt2?: {
root: {
type: string;
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
};
updatedAt?: string | null;
createdAt?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "tabsWithRichText_select".
*/
export interface TabsWithRichTextSelect<T extends boolean = true> {
tab1?:
| T
| {
rt1?: T;
};
tab2?:
| T
| {
rt2?: T;
};
updatedAt?: T;
createdAt?: T;
globalType?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "LexicalBlocksRadioButtonsBlock".
*/
export interface LexicalBlocksRadioButtonsBlock {
radioButtons?: ('option1' | 'option2' | 'option3') | null;
id?: string | null;
blockName?: string | null;
blockType: 'radioButtons';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "AvatarGroupBlock".
*/
export interface AvatarGroupBlock {
avatars?:
| {
image?: (string | null) | Upload;
id?: string | null;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'AvatarGroup';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "auth".