1
1
import type { BrowserContext , Page } from '@playwright/test'
2
+ import type { GeneratedTypes } from 'helpers/sdk/types.js'
2
3
3
4
import { expect , test } from '@playwright/test'
5
+ import { navigateToDoc } from 'helpers/e2e/navigateToDoc.js'
4
6
import { openDocControls } from 'helpers/e2e/openDocControls.js'
7
+ import { upsertPrefs } from 'helpers/e2e/upsertPrefs.js'
8
+ import { RESTClient } from 'helpers/rest.js'
5
9
import path from 'path'
6
10
import { fileURLToPath } from 'url'
7
11
@@ -31,11 +35,6 @@ import {
31
35
spanishLocale ,
32
36
withRequiredLocalizedFields ,
33
37
} from './shared.js'
34
- import { navigateToDoc } from 'helpers/e2e/navigateToDoc.js'
35
-
36
- import { upsertPrefs } from 'helpers/e2e/upsertPrefs.js'
37
- import { RESTClient } from 'helpers/rest.js'
38
- import { GeneratedTypes } from 'helpers/sdk/types.js'
39
38
40
39
const filename = fileURLToPath ( import . meta. url )
41
40
const dirname = path . dirname ( filename )
@@ -119,16 +118,16 @@ describe('Localization', () => {
119
118
120
119
await expect ( page . locator ( '.localizer .popup' ) ) . toHaveClass ( / p o p u p - - a c t i v e / )
121
120
122
- const activeOption = await page . locator (
121
+ const activeOption = page . locator (
123
122
`.localizer .popup.popup--active .popup-button-list__button--selected` ,
124
123
)
125
124
126
125
await expect ( activeOption ) . toBeVisible ( )
127
126
const tagName = await activeOption . evaluate ( ( node ) => node . tagName )
128
- await expect ( tagName ) . not . toBe ( 'A' )
127
+ expect ( tagName ) . not . toBe ( 'A' )
129
128
await expect ( activeOption ) . not . toHaveAttribute ( 'href' )
130
- await expect ( tagName ) . not . toBe ( 'BUTTON' )
131
- await expect ( tagName ) . toBe ( 'DIV' )
129
+ expect ( tagName ) . not . toBe ( 'BUTTON' )
130
+ expect ( tagName ) . toBe ( 'DIV' )
132
131
} )
133
132
} )
134
133
@@ -140,7 +139,7 @@ describe('Localization', () => {
140
139
const createNewButtonLocator =
141
140
'.collection-list a[href="/admin/collections/cannot-create-default-locale/create"]'
142
141
143
- await expect ( page . locator ( createNewButtonLocator ) ) . not . toBeVisible ( )
142
+ await expect ( page . locator ( createNewButtonLocator ) ) . toBeHidden ( )
144
143
await changeLocale ( page , spanishLocale )
145
144
await expect ( page . locator ( createNewButtonLocator ) . first ( ) ) . toBeVisible ( )
146
145
await page . goto ( urlCannotCreateDefaultLocale . create )
@@ -330,11 +329,11 @@ describe('Localization', () => {
330
329
331
330
await page . goto ( url . list )
332
331
333
- const localeLabel = await page
332
+ const localeLabel = page
334
333
. locator ( '.localizer.app-header__localizer .localizer-button__current-label' )
335
- . innerText ( )
334
+
336
335
337
- expect ( localeLabel ) . not . toEqual ( 'English' )
336
+ await expect ( localeLabel ) . not . toHaveText ( 'English' )
338
337
} )
339
338
} )
340
339
@@ -351,7 +350,7 @@ describe('Localization', () => {
351
350
await navigateToDoc ( page , urlRelationshipLocalized )
352
351
const drawerToggler =
353
352
'#field-relationMultiRelationTo .relationship--single-value__drawer-toggler'
354
- expect ( page . locator ( drawerToggler ) ) . toBeEnabled ( )
353
+ await expect ( page . locator ( drawerToggler ) ) . toBeEnabled ( )
355
354
await openDocDrawer ( page , drawerToggler )
356
355
await expect ( page . locator ( '.doc-drawer__header-text' ) ) . toContainText ( 'spanish-relation2' )
357
356
await page . locator ( '.doc-drawer__header-close' ) . click ( )
@@ -518,7 +517,7 @@ describe('Localization', () => {
518
517
519
518
// only throttle test after initial load to avoid timeouts
520
519
const cdpSession = await throttleTest ( {
521
- page : page ,
520
+ page,
522
521
context,
523
522
delay : 'Fast 4G' ,
524
523
} )
@@ -541,6 +540,13 @@ describe('Localization', () => {
541
540
await cdpSession . detach ( )
542
541
} )
543
542
} )
543
+
544
+ test ( 'should use label in search filter when string or object' , async ( ) => {
545
+ await page . goto ( url . list )
546
+ const searchInput = page . locator ( '.search-filter__input' )
547
+ await expect ( searchInput ) . toBeVisible ( )
548
+ await expect ( searchInput ) . toHaveAttribute ( 'placeholder' , 'Search by Full title' )
549
+ } )
544
550
} )
545
551
546
552
async function fillValues ( data : Partial < LocalizedPost > ) {
0 commit comments