Skip to content

Commit 97a1f4a

Browse files
authored
test: consolidates custom id e2e tests (#10061)
Although we have a dedicated e2e test suite for custom IDs, tests for custom unnamed tab and row IDs were still located within the admin test suite. This consolidates these tests into the appropriate test suite as expected.
1 parent 439dd04 commit 97a1f4a

File tree

16 files changed

+519
-369
lines changed

16 files changed

+519
-369
lines changed

test/admin/collections/CustomIdRow.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

test/admin/collections/CustomIdTab.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

test/admin/config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const dirname = path.dirname(filename)
55
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
66
import { BaseListFilter } from './collections/BaseListFilter.js'
77
import { CustomFields } from './collections/CustomFields/index.js'
8-
import { CustomIdRow } from './collections/CustomIdRow.js'
9-
import { CustomIdTab } from './collections/CustomIdTab.js'
108
import { CustomViews1 } from './collections/CustomViews1.js'
119
import { CustomViews2 } from './collections/CustomViews2.js'
1210
import { DisableDuplicate } from './collections/DisableDuplicate.js'
@@ -155,8 +153,6 @@ export default buildConfigWithDefaults({
155153
CollectionGroup2A,
156154
CollectionGroup2B,
157155
Geo,
158-
CustomIdTab,
159-
CustomIdRow,
160156
DisableDuplicate,
161157
BaseListFilter,
162158
],

test/admin/e2e/3/e2e.spec.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { AdminUrlUtil } from '../../../helpers/adminUrlUtil.js'
2020
import { initPayloadE2ENoConfig } from '../../../helpers/initPayloadE2ENoConfig.js'
2121
import { customAdminRoutes } from '../../shared.js'
2222
import {
23-
customIdCollectionId,
2423
disableDuplicateSlug,
2524
geoCollectionSlug,
2625
globalSlug,
@@ -544,7 +543,7 @@ describe('admin3', () => {
544543
defaultValueField: 'not the default value',
545544
}
546545
const updatedPostTitle = `${post1Title} (Updated)`
547-
await Promise.all([createPost(postData)])
546+
await createPost(postData)
548547
await page.goto(postsUrl.list)
549548
await page.locator('input#select-all').check()
550549
await page.locator('.edit-many__toggle').click()
@@ -652,24 +651,6 @@ describe('admin3', () => {
652651
await expect(modalContainer).toHaveClass(/payload__modal-container--exitDone/)
653652
})
654653
})
655-
656-
describe('custom IDs', () => {
657-
test('unnamed tab — should allow custom ID field', async () => {
658-
await page.goto(postsUrl.collection('customIdTab') + '/' + customIdCollectionId)
659-
660-
const idField = page.locator('#field-id')
661-
662-
await expect(idField).toHaveValue(customIdCollectionId)
663-
})
664-
665-
test('row — should allow custom ID field', async () => {
666-
await page.goto(postsUrl.collection('customIdRow') + '/' + customIdCollectionId)
667-
668-
const idField = page.locator('#field-id')
669-
670-
await expect(idField).toHaveValue(customIdCollectionId)
671-
})
672-
})
673654
})
674655

675656
async function createPost(overrides?: Partial<Post>): Promise<Post> {

test/admin/payload-types.ts

Lines changed: 47 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface Config {
1515
posts: Post;
1616
users: User;
1717
'hidden-collection': HiddenCollection;
18+
'not-in-view-collection': NotInViewCollection;
1819
'collection-no-api-view': CollectionNoApiView;
1920
'custom-views-one': CustomViewsOne;
2021
'custom-views-two': CustomViewsTwo;
@@ -24,8 +25,6 @@ export interface Config {
2425
'group-two-collection-ones': GroupTwoCollectionOne;
2526
'group-two-collection-twos': GroupTwoCollectionTwo;
2627
geo: Geo;
27-
customIdTab: CustomIdTab;
28-
customIdRow: CustomIdRow;
2928
'disable-duplicate': DisableDuplicate;
3029
'base-list-filters': BaseListFilter;
3130
'payload-locked-documents': PayloadLockedDocument;
@@ -38,6 +37,7 @@ export interface Config {
3837
posts: PostsSelect<false> | PostsSelect<true>;
3938
users: UsersSelect<false> | UsersSelect<true>;
4039
'hidden-collection': HiddenCollectionSelect<false> | HiddenCollectionSelect<true>;
40+
'not-in-view-collection': NotInViewCollectionSelect<false> | NotInViewCollectionSelect<true>;
4141
'collection-no-api-view': CollectionNoApiViewSelect<false> | CollectionNoApiViewSelect<true>;
4242
'custom-views-one': CustomViewsOneSelect<false> | CustomViewsOneSelect<true>;
4343
'custom-views-two': CustomViewsTwoSelect<false> | CustomViewsTwoSelect<true>;
@@ -47,8 +47,6 @@ export interface Config {
4747
'group-two-collection-ones': GroupTwoCollectionOnesSelect<false> | GroupTwoCollectionOnesSelect<true>;
4848
'group-two-collection-twos': GroupTwoCollectionTwosSelect<false> | GroupTwoCollectionTwosSelect<true>;
4949
geo: GeoSelect<false> | GeoSelect<true>;
50-
customIdTab: CustomIdTabSelect<false> | CustomIdTabSelect<true>;
51-
customIdRow: CustomIdRowSelect<false> | CustomIdRowSelect<true>;
5250
'disable-duplicate': DisableDuplicateSelect<false> | DisableDuplicateSelect<true>;
5351
'base-list-filters': BaseListFiltersSelect<false> | BaseListFiltersSelect<true>;
5452
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
@@ -60,6 +58,7 @@ export interface Config {
6058
};
6159
globals: {
6260
'hidden-global': HiddenGlobal;
61+
'not-in-view-global': NotInViewGlobal;
6362
'global-no-api-view': GlobalNoApiView;
6463
global: Global;
6564
'custom-global-views-one': CustomGlobalViewsOne;
@@ -70,6 +69,7 @@ export interface Config {
7069
};
7170
globalsSelect: {
7271
'hidden-global': HiddenGlobalSelect<false> | HiddenGlobalSelect<true>;
72+
'not-in-view-global': NotInViewGlobalSelect<false> | NotInViewGlobalSelect<true>;
7373
'global-no-api-view': GlobalNoApiViewSelect<false> | GlobalNoApiViewSelect<true>;
7474
global: GlobalSelect<false> | GlobalSelect<true>;
7575
'custom-global-views-one': CustomGlobalViewsOneSelect<false> | CustomGlobalViewsOneSelect<true>;
@@ -199,6 +199,16 @@ export interface HiddenCollection {
199199
updatedAt: string;
200200
createdAt: string;
201201
}
202+
/**
203+
* This interface was referenced by `Config`'s JSON-Schema
204+
* via the `definition` "not-in-view-collection".
205+
*/
206+
export interface NotInViewCollection {
207+
id: string;
208+
title?: string | null;
209+
updatedAt: string;
210+
createdAt: string;
211+
}
202212
/**
203213
* This interface was referenced by `Config`'s JSON-Schema
204214
* via the `definition` "collection-no-api-view".
@@ -318,30 +328,6 @@ export interface Geo {
318328
updatedAt: string;
319329
createdAt: string;
320330
}
321-
/**
322-
* This interface was referenced by `Config`'s JSON-Schema
323-
* via the `definition` "customIdTab".
324-
*/
325-
export interface CustomIdTab {
326-
title?: string | null;
327-
id: string;
328-
description?: string | null;
329-
number?: number | null;
330-
updatedAt: string;
331-
createdAt: string;
332-
}
333-
/**
334-
* This interface was referenced by `Config`'s JSON-Schema
335-
* via the `definition` "customIdRow".
336-
*/
337-
export interface CustomIdRow {
338-
title?: string | null;
339-
id: string;
340-
description?: string | null;
341-
number?: number | null;
342-
updatedAt: string;
343-
createdAt: string;
344-
}
345331
/**
346332
* This interface was referenced by `Config`'s JSON-Schema
347333
* via the `definition` "disable-duplicate".
@@ -385,6 +371,10 @@ export interface PayloadLockedDocument {
385371
relationTo: 'hidden-collection';
386372
value: string | HiddenCollection;
387373
} | null)
374+
| ({
375+
relationTo: 'not-in-view-collection';
376+
value: string | NotInViewCollection;
377+
} | null)
388378
| ({
389379
relationTo: 'collection-no-api-view';
390380
value: string | CollectionNoApiView;
@@ -421,14 +411,6 @@ export interface PayloadLockedDocument {
421411
relationTo: 'geo';
422412
value: string | Geo;
423413
} | null)
424-
| ({
425-
relationTo: 'customIdTab';
426-
value: string | CustomIdTab;
427-
} | null)
428-
| ({
429-
relationTo: 'customIdRow';
430-
value: string | CustomIdRow;
431-
} | null)
432414
| ({
433415
relationTo: 'disable-duplicate';
434416
value: string | DisableDuplicate;
@@ -569,6 +551,15 @@ export interface HiddenCollectionSelect<T extends boolean = true> {
569551
updatedAt?: T;
570552
createdAt?: T;
571553
}
554+
/**
555+
* This interface was referenced by `Config`'s JSON-Schema
556+
* via the `definition` "not-in-view-collection_select".
557+
*/
558+
export interface NotInViewCollectionSelect<T extends boolean = true> {
559+
title?: T;
560+
updatedAt?: T;
561+
createdAt?: T;
562+
}
572563
/**
573564
* This interface was referenced by `Config`'s JSON-Schema
574565
* via the `definition` "collection-no-api-view_select".
@@ -680,30 +671,6 @@ export interface GeoSelect<T extends boolean = true> {
680671
updatedAt?: T;
681672
createdAt?: T;
682673
}
683-
/**
684-
* This interface was referenced by `Config`'s JSON-Schema
685-
* via the `definition` "customIdTab_select".
686-
*/
687-
export interface CustomIdTabSelect<T extends boolean = true> {
688-
title?: T;
689-
id?: T;
690-
description?: T;
691-
number?: T;
692-
updatedAt?: T;
693-
createdAt?: T;
694-
}
695-
/**
696-
* This interface was referenced by `Config`'s JSON-Schema
697-
* via the `definition` "customIdRow_select".
698-
*/
699-
export interface CustomIdRowSelect<T extends boolean = true> {
700-
title?: T;
701-
id?: T;
702-
description?: T;
703-
number?: T;
704-
updatedAt?: T;
705-
createdAt?: T;
706-
}
707674
/**
708675
* This interface was referenced by `Config`'s JSON-Schema
709676
* via the `definition` "disable-duplicate_select".
@@ -764,6 +731,16 @@ export interface HiddenGlobal {
764731
updatedAt?: string | null;
765732
createdAt?: string | null;
766733
}
734+
/**
735+
* This interface was referenced by `Config`'s JSON-Schema
736+
* via the `definition` "not-in-view-global".
737+
*/
738+
export interface NotInViewGlobal {
739+
id: string;
740+
title?: string | null;
741+
updatedAt?: string | null;
742+
createdAt?: string | null;
743+
}
767744
/**
768745
* This interface was referenced by `Config`'s JSON-Schema
769746
* via the `definition` "global-no-api-view".
@@ -845,6 +822,16 @@ export interface HiddenGlobalSelect<T extends boolean = true> {
845822
createdAt?: T;
846823
globalType?: T;
847824
}
825+
/**
826+
* This interface was referenced by `Config`'s JSON-Schema
827+
* via the `definition` "not-in-view-global_select".
828+
*/
829+
export interface NotInViewGlobalSelect<T extends boolean = true> {
830+
title?: T;
831+
updatedAt?: T;
832+
createdAt?: T;
833+
globalType?: T;
834+
}
848835
/**
849836
* This interface was referenced by `Config`'s JSON-Schema
850837
* via the `definition` "global-no-api-view_select".

test/admin/seed.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { executePromises } from '../helpers/executePromises.js'
55
import { seedDB } from '../helpers/seed.js'
66
import {
77
collectionSlugs,
8-
customIdCollectionId,
98
customViews1CollectionSlug,
109
customViews2CollectionSlug,
1110
geoCollectionSlug,
@@ -113,26 +112,6 @@ export const seed = async (_payload) => {
113112
depth: 0,
114113
overrideAccess: true,
115114
}),
116-
() =>
117-
_payload.create({
118-
collection: 'customIdTab',
119-
data: {
120-
id: customIdCollectionId,
121-
title: 'Hello world title',
122-
},
123-
depth: 0,
124-
overrideAccess: true,
125-
}),
126-
() =>
127-
_payload.create({
128-
collection: 'customIdRow',
129-
data: {
130-
id: customIdCollectionId,
131-
title: 'Hello world title',
132-
},
133-
depth: 0,
134-
overrideAccess: true,
135-
}),
136115
],
137116
false,
138117
)

test/admin/slugs.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,3 @@ export const globalSlugs = [
4848
hiddenGlobalSlug,
4949
noApiViewGlobalSlug,
5050
]
51-
52-
export const customIdCollectionSlug = 'customId'
53-
export const customIdCollectionId = '111111111111111111111111'

0 commit comments

Comments
 (0)