mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 04:42:58 +00:00
fix: add Introduction step in the Single collection Edit view (#23943)
This commit is contained in:
parent
0b05e14275
commit
3fc9f7ab14
@ -10,7 +10,7 @@ import {
|
|||||||
useQueryParams,
|
useQueryParams,
|
||||||
unstable_tours,
|
unstable_tours,
|
||||||
} from '@strapi/admin/strapi-admin';
|
} 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 { useIntl } from 'react-intl';
|
||||||
import { useLocation, useParams } from 'react-router-dom';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
import { styled } from 'styled-components';
|
import { styled } from 'styled-components';
|
||||||
@ -140,6 +140,12 @@ const EditViewPage = () => {
|
|||||||
return (
|
return (
|
||||||
<Main paddingLeft={10} paddingRight={10}>
|
<Main paddingLeft={10} paddingRight={10}>
|
||||||
<Page.Title>{pageTitle}</Page.Title>
|
<Page.Title>{pageTitle}</Page.Title>
|
||||||
|
{isSingleType && (
|
||||||
|
<unstable_tours.contentManager.Introduction>
|
||||||
|
{/* Invisible Anchor */}
|
||||||
|
<Box paddingTop={5} />
|
||||||
|
</unstable_tours.contentManager.Introduction>
|
||||||
|
)}
|
||||||
<Form
|
<Form
|
||||||
disabled={hasDraftAndPublished && status === 'published'}
|
disabled={hasDraftAndPublished && status === 'published'}
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
@ -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
|
// Step 5. Close the relation modal to see the updated relation on the root document
|
||||||
await page.getByRole('button', { name: 'Close modal' }).click();
|
await page.getByRole('button', { name: 'Close modal' }).click();
|
||||||
await expect(page.getByRole('button', { name: 'Mr. Plop' })).toBeVisible({ timeout: 20000 });
|
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 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();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('I want to create a relation inside a component, and save', async ({ page }) => {
|
test('I want to create a relation inside a component, and save', async ({ page }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user