@@ -21,20 +21,46 @@ test('can edit edito page with all bloc types', async ({ page }) => {
2121 // Debug screenshot: after deleting all blocs
2222 await page . screenshot ( { path : 'tests/edito/screenshots/01b-empty-page.png' , fullPage : true } )
2323
24- // === Step 1: Add a DatasetsListBloc with multiple datasets ===
24+ // === Step 1: Add a HeroBloc ===
2525 await page . getByRole ( 'button' , { name : 'Ajouter un bloc' } ) . first ( ) . click ( )
26+ await page . getByText ( 'Hero' ) . click ( )
27+ await page . waitForTimeout ( 300 )
28+
29+ // Edit the hero title (it has a default "Titre")
30+ const heroTitle = page . locator ( '.bg-new-blue-illustration [contenteditable="true"]' ) . first ( )
31+ await heroTitle . click ( )
32+ await heroTitle . fill ( 'Bienvenue sur data.gouv.fr' )
33+ await page . mouse . click ( 1 , 1 )
34+
35+ // Add a description
36+ await page . getByText ( 'Ajouter une description' ) . click ( )
37+ await page . waitForTimeout ( 200 )
38+ const heroDescription = page . locator ( '.bg-new-blue-illustration [contenteditable="true"]' ) . nth ( 1 )
39+ await heroDescription . click ( )
40+ await heroDescription . fill ( 'La plateforme ouverte des données publiques françaises' )
41+ await page . mouse . click ( 1 , 1 )
42+
43+ // Change the color to green
44+ await page . locator ( '.bg-new-green-illustration.size-8' ) . click ( )
45+ await page . waitForTimeout ( 200 )
46+
47+ // Debug screenshot: after adding hero bloc
48+ await page . screenshot ( { path : 'tests/edito/screenshots/01c-hero-bloc.png' , fullPage : true } )
49+
50+ // === Step 2: Add a DatasetsListBloc with multiple datasets ===
51+ await page . getByRole ( 'button' , { name : 'Ajouter un bloc' } ) . last ( ) . click ( )
2652 await page . getByText ( 'Données à la une' ) . click ( )
2753 await page . waitForTimeout ( 300 )
2854
29- // Edit the title
30- const datasetsBlocTitle = page . locator ( '[contenteditable="true"]' ) . first ( )
55+ // Edit the title (use container to avoid hero bloc)
56+ const datasetsBlocTitle = page . locator ( '.container [contenteditable="true"]' ) . first ( )
3157 await datasetsBlocTitle . click ( )
3258 await datasetsBlocTitle . fill ( 'Nos jeux de données phares' )
3359 await page . mouse . click ( 1 , 1 )
3460
3561 // Add subtitle
3662 await page . getByText ( 'Ajouter un sous-titre' ) . first ( ) . click ( )
37- const datasetsSubtitle = page . locator ( '[contenteditable="true"]' ) . nth ( 1 )
63+ const datasetsSubtitle = page . locator ( '.container [contenteditable="true"]' ) . nth ( 1 )
3864 await datasetsSubtitle . click ( )
3965 await datasetsSubtitle . fill ( 'Découvrez les données les plus consultées' )
4066 await page . mouse . click ( 1 , 1 )
@@ -65,7 +91,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
6591 // Debug screenshot: after adding datasets
6692 await page . screenshot ( { path : 'tests/edito/screenshots/02-datasets-bloc.png' , fullPage : true } )
6793
68- // === Step 2 : Add a ReusesListBloc with multiple reuses ===
94+ // === Step 3 : Add a ReusesListBloc with multiple reuses ===
6995 await page . getByRole ( 'button' , { name : 'Ajouter un bloc' } ) . last ( ) . click ( )
7096 await page . getByText ( 'Réutilisations à la une' ) . click ( )
7197 await page . waitForTimeout ( 300 )
@@ -102,7 +128,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
102128 // Debug screenshot: after adding reuses
103129 await page . screenshot ( { path : 'tests/edito/screenshots/03-reuses-bloc.png' , fullPage : true } )
104130
105- // === Step 3 : Add a DataservicesListBloc with multiple APIs ===
131+ // === Step 4 : Add a DataservicesListBloc with multiple APIs ===
106132 await page . getByRole ( 'button' , { name : 'Ajouter un bloc' } ) . last ( ) . click ( )
107133 await page . getByText ( 'APIs à la une' ) . click ( )
108134 await page . waitForTimeout ( 300 )
@@ -139,7 +165,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
139165 // Debug screenshot: after adding dataservices
140166 await page . screenshot ( { path : 'tests/edito/screenshots/04-dataservices-bloc.png' , fullPage : true } )
141167
142- // === Step 4 : Add a LinksListBloc WITH paragraph ===
168+ // === Step 5 : Add a LinksListBloc WITH paragraph ===
143169 await page . getByRole ( 'button' , { name : 'Ajouter un bloc' } ) . last ( ) . click ( )
144170 await page . getByText ( 'Liens à la une' ) . click ( )
145171 await page . waitForTimeout ( 300 )
@@ -188,7 +214,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
188214 // Debug screenshot: after adding links bloc with paragraph
189215 await page . screenshot ( { path : 'tests/edito/screenshots/05-links-bloc-with-paragraph.png' , fullPage : true } )
190216
191- // === Step 5 : Add a LinksListBloc WITHOUT paragraph ===
217+ // === Step 6 : Add a LinksListBloc WITHOUT paragraph ===
192218 await page . getByRole ( 'button' , { name : 'Ajouter un bloc' } ) . last ( ) . click ( )
193219 await page . getByText ( 'Liens à la une' ) . click ( )
194220 await page . waitForTimeout ( 300 )
@@ -228,7 +254,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
228254 // Debug screenshot: after adding links bloc without paragraph
229255 await page . screenshot ( { path : 'tests/edito/screenshots/06-links-bloc-without-paragraph.png' , fullPage : true } )
230256
231- // === Step 6 : Test bloc manipulation ===
257+ // === Step 7 : Test bloc manipulation ===
232258 // Move the first bloc down
233259 await page . locator ( '[title="Descendre"]' ) . first ( ) . click ( )
234260 await page . waitForTimeout ( 300 )
@@ -278,7 +304,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
278304 // Debug screenshot: after re-adding reuses bloc
279305 await page . screenshot ( { path : 'tests/edito/screenshots/09-reuses-bloc-readded.png' , fullPage : true } )
280306
281- // === Step 7 : Save the page ===
307+ // === Step 8 : Save the page ===
282308 await page . getByRole ( 'button' , { name : 'Sauvegarder' } ) . click ( )
283309 await page . waitForTimeout ( 1000 )
284310
@@ -288,7 +314,7 @@ test('can edit edito page with all bloc types', async ({ page }) => {
288314 // Wait for the toast to confirm save
289315 await expect ( page . getByText ( 'Page créée' ) . or ( page . getByText ( 'Page sauvegardée' ) ) ) . toBeVisible ( )
290316
291- // === Step 8 : Final screenshot for visual regression ===
317+ // === Step 9 : Final screenshot for visual regression ===
292318 await page . waitForLoadState ( 'networkidle' )
293319 await page . waitForTimeout ( 500 )
294320
0 commit comments