fix: add Introduction step in the Single collection Edit view (#23943)

This commit is contained in:
Simone 2025-07-14 10:07:27 +02:00 committed by GitHub
parent 0b05e14275
commit 3fc9f7ab14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 50 additions and 32 deletions

View File

@ -10,7 +10,7 @@ import {
useQueryParams,
unstable_tours,
} from '@strapi/admin/strapi-admin';
import { Grid, Main, Tabs } from '@strapi/design-system';
import { Grid, Main, Tabs, Box } from '@strapi/design-system';
import { useIntl } from 'react-intl';
import { useLocation, useParams } from 'react-router-dom';
import { styled } from 'styled-components';
@ -140,6 +140,12 @@ const EditViewPage = () => {
return (
<Main paddingLeft={10} paddingRight={10}>
<Page.Title>{pageTitle}</Page.Title>
{isSingleType && (
<unstable_tours.contentManager.Introduction>
{/* Invisible Anchor */}
<Box paddingTop={5} />
</unstable_tours.contentManager.Introduction>
)}
<Form
disabled={hasDraftAndPublished && status === 'published'}
initialValues={initialValues}

View File

@ -0,0 +1,41 @@
import { test, expect } from '@playwright/test';
import { login } from '../../../utils/login';
import { resetDatabaseAndImportDataFromPath } from '../../../utils/dts-import';
import { clickAndWait } from '../../../utils/shared';
test.describe('Relations on the fly - Create a Relation and Save', () => {
test.beforeEach(async ({ page }) => {
await resetDatabaseAndImportDataFromPath('with-admin.tar');
await page.goto('/admin');
});
test('I want to create a new relation, publish the related document and check if the new relation is added to the parent document', async ({
page,
}) => {
// Step 0. Login as admin
await login({ page });
// Step 1. Got to Article collection-type and open one article
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Article' }));
await clickAndWait(page, page.getByRole('gridcell', { name: 'West Ham post match analysis' }));
// Step 2. Open the relation modal
await page.getByRole('combobox', { name: 'authors' }).click();
await page.getByRole('option', { name: 'Create a relation' }).click();
// Step 3. Edit the form
const name = page.getByRole('textbox', { name: 'name' });
await expect(name).toHaveValue('');
await name.fill('Mr. Fred Passo');
await expect(name).toHaveValue('Mr. Fred Passo');
// Step 4. Publish the related document
await clickAndWait(page, page.getByRole('button', { name: 'Publish' }));
await expect(name).toHaveValue('Mr. Fred Passo');
await expect(page.getByRole('status', { name: 'Published' }).first()).toBeVisible();
// Step 5. Close the relation modal to see the updated relation on the root document
await page.getByRole('button', { name: 'Close modal' }).click();
await expect(page.getByRole('button', { name: 'Mr. Fred Passo' })).toBeVisible();
});
});

View File

@ -38,37 +38,8 @@ test.describe('Relations on the fly - Create a Relation and Save', () => {
// Step 5. Close the relation modal to see the updated relation on the root document
await page.getByRole('button', { name: 'Close modal' }).click();
await expect(page.getByRole('button', { name: 'Mr. Plop' })).toBeVisible({ timeout: 20000 });
});
test('I want to create a new relation, publish the related document and check if the new relation is added to the parent document', async ({
page,
}) => {
// Step 0. Login as admin
await login({ page });
// Step 1. Got to Article collection-type and open one article
await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' }));
await clickAndWait(page, page.getByRole('link', { name: 'Article' }));
await clickAndWait(page, page.getByRole('gridcell', { name: 'West Ham post match analysis' }));
// Step 2. Open the relation modal
await page.getByRole('combobox', { name: 'authors' }).click();
await page.getByRole('option', { name: 'Create a relation' }).click();
// Step 3. Edit the form
const name = page.getByRole('textbox', { name: 'name' });
await expect(name).toHaveValue('');
await name.fill('Mr. Fred Passo');
await expect(name).toHaveValue('Mr. Fred Passo');
// Step 4. Publish the related document
await clickAndWait(page, page.getByRole('button', { name: 'Publish' }));
await expect(name).toHaveValue('Mr. Fred Passo');
await expect(page.getByRole('status', { name: 'Published' }).first()).toBeVisible();
// Step 5. Close the relation modal to see the updated relation on the root document
await page.getByRole('button', { name: 'Close modal' }).click();
await expect(page.getByRole('button', { name: 'Mr. Fred Passo' })).toBeVisible();
await page.waitForSelector('button:has-text("Mr. Plop")', { timeout: 20000 });
await expect(page.getByRole('button', { name: 'Mr. Plop' })).toBeVisible();
});
test('I want to create a relation inside a component, and save', async ({ page }) => {