test: admin list view custom components (#10956)
### What? This PR adds tests for custom list view components to the existing suite in `admin/e2e/list-view/`. Custom components are already tested in the document-level counterpart, and should be tested here as well. ### Why? Previously, there were no tests for these list view components. Refactors, features, or changes that impact the importMap, default list view, etc., could affect how these components get rendered. It's safer to have tests in place to catch this as custom list view components, in general, are used quite often. ### How? This PR adds 5 simple tests that check for the rendering of the following list view components: - `BeforeList` - `BeforeListTable` - `UI Field Cell` - `AfterList` - `AfterListTable`
This commit is contained in:
@@ -156,6 +156,56 @@ describe('List View', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('list view custom components', () => {
|
||||
test('should render custom beforeList component', async () => {
|
||||
await page.goto(postsUrl.list)
|
||||
await expect(
|
||||
page.locator('.collection-list--posts').locator('div', {
|
||||
hasText: exactText('BeforeList custom component'),
|
||||
}),
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('should render custom beforeListTable component', async () => {
|
||||
await page.goto(postsUrl.list)
|
||||
await expect(
|
||||
page.locator('.collection-list__wrap').locator('div', {
|
||||
hasText: exactText('BeforeListTable custom component'),
|
||||
}),
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('should render custom Cell component in table', async () => {
|
||||
await page.goto(postsUrl.list)
|
||||
await expect(
|
||||
page
|
||||
.locator(`${tableRowLocator} td.cell-demoUIField`)
|
||||
.first()
|
||||
.locator('p', {
|
||||
hasText: exactText('Demo UI Field Cell'),
|
||||
}),
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('should render custom afterList component', async () => {
|
||||
await page.goto(postsUrl.list)
|
||||
await expect(
|
||||
page.locator('.collection-list__wrap').locator('div', {
|
||||
hasText: exactText('AfterListTable custom component'),
|
||||
}),
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('should render custom afterListTable component', async () => {
|
||||
await page.goto(postsUrl.list)
|
||||
await expect(
|
||||
page.locator('.collection-list--posts').locator('div', {
|
||||
hasText: exactText('AfterList custom component'),
|
||||
}),
|
||||
).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
describe('search', () => {
|
||||
test('should prefill search input from query param', async () => {
|
||||
await createPost({ title: 'dennis' })
|
||||
|
||||
Reference in New Issue
Block a user