From c76dc77e647810eccfb976469a5cb42efc592203 Mon Sep 17 00:00:00 2001 From: Jacob Fletcher Date: Tue, 30 May 2023 11:28:26 -0400 Subject: [PATCH] chore: writes e2e test for list drawer useAsTitle search --- test/fields/e2e.spec.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/fields/e2e.spec.ts b/test/fields/e2e.spec.ts index 76f5cc98e..b2509fb83 100644 --- a/test/fields/e2e.spec.ts +++ b/test/fields/e2e.spec.ts @@ -511,6 +511,27 @@ describe('fields', () => { await expect(menu).not.toContainText('Uploads3'); }); + test('should search correct useAsTitle field after toggling collection in list drawer', async () => { + await navigateToRichTextFields(); + + // open link drawer + const field = await page.locator('#field-richText'); + const button = await field.locator('button.rich-text-relationship__list-drawer-toggler.list-drawer__toggler'); + button.click(); + + // check that the search is on the `name` field of the `text-fields` collection + const drawer = await page.locator('[id^=list-drawer_1_]'); + await expect(await drawer.locator('.search-filter__input')).toHaveAttribute('placeholder', 'Search by Text'); + + // change the selected collection to `array-fields` + await page.locator('.list-drawer__select-collection-wrap .rs__control').click(); + const menu = page.locator('.list-drawer__select-collection-wrap .rs__menu'); + await menu.locator('.rs__option').getByText('Array Field').click(); + + // check that `id` is now the default search field + await expect(await drawer.locator('.search-filter__input')).toHaveAttribute('placeholder', 'Search by ID'); + }); + test('should only list RTE enabled collections in link drawer', async () => { await navigateToRichTextFields();