From dd48c74f8bb6bce553ec6d69a51d6fbf1da1c5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Peyrelongue?= <62641861+Come-Peyrelongue@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:58:46 +0100 Subject: [PATCH 1/4] SCENARIO: Linking an existing document (see #383). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the scenario to include comments on video documents and modified the expected document list. Co-authored-by: - Sacha HIMBER - Enzo MOUGIN - Côme PEYRELONGUE --- frontend/scenarios/link_document.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/scenarios/link_document.feature b/frontend/scenarios/link_document.feature index f6090714..03a792c4 100644 --- a/frontend/scenarios/link_document.feature +++ b/frontend/scenarios/link_document.feature @@ -6,13 +6,13 @@ Scénario: pour commenter un document Soit un document existant affiché comme document principal Et une session active avec mon compte - Quand je réutilise "Glossaire" comme glose - Alors "Glossaire" est la glose ouverte - Et la glose contient : + Quand j'utilise un document existant comme commentaire + Alors la liste de mes documents s'affichent + Et la liste contient pour chaque document son titre, son auteur, sa dernière date de modification et son lien isPartOf """ - "Il était une fois" - "Once upon a time" (eng) - "Bolo to raz" (svk) + "Comments on the video - Côme Peyrelongue, 24/03/2026 09:32 - My First Video Document" + "My Second Video Document - Côme Peyrelongue, 10/03/2026 20:15" + "Comments on the video - Côme Peyrelongue, 23/03/2026 10:44 - My Second Video Document" """ Scénario: pour le comparer avec un autre From 42eeb3bece511b6932f7179156e19ca0eb291623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Peyrelongue?= <62641861+Come-Peyrelongue@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:58:46 +0100 Subject: [PATCH 2/4] SCENARIO: Linking an existing document (see #383). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the scenario to include comments on video documents and modified the expected document list. Co-authored-by: Enzo MOUGIN enzo.mougin@utt.fr Co-authored-by: Côme PEYRELONGUE come.peyrelongue@utt.fr Co-authored-by: Sacha HIMBER sacha.himber@utt.fr --- frontend/scenarios/link_document.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/scenarios/link_document.feature b/frontend/scenarios/link_document.feature index f6090714..03a792c4 100644 --- a/frontend/scenarios/link_document.feature +++ b/frontend/scenarios/link_document.feature @@ -6,13 +6,13 @@ Scénario: pour commenter un document Soit un document existant affiché comme document principal Et une session active avec mon compte - Quand je réutilise "Glossaire" comme glose - Alors "Glossaire" est la glose ouverte - Et la glose contient : + Quand j'utilise un document existant comme commentaire + Alors la liste de mes documents s'affichent + Et la liste contient pour chaque document son titre, son auteur, sa dernière date de modification et son lien isPartOf """ - "Il était une fois" - "Once upon a time" (eng) - "Bolo to raz" (svk) + "Comments on the video - Côme Peyrelongue, 24/03/2026 09:32 - My First Video Document" + "My Second Video Document - Côme Peyrelongue, 10/03/2026 20:15" + "Comments on the video - Côme Peyrelongue, 23/03/2026 10:44 - My Second Video Document" """ Scénario: pour le comparer avec un autre From 82e207e1c2c3b84a47cda3c28c0efb976d940f1b Mon Sep 17 00:00:00 2001 From: Sacha Date: Tue, 31 Mar 2026 17:49:46 +0200 Subject: [PATCH 3/4] TEST: Linking an existing document (see #383). --- frontend/tests/event.js | 4 ++++ frontend/tests/outcome.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/frontend/tests/event.js b/frontend/tests/event.js index bd6cc9f8..293c0833 100644 --- a/frontend/tests/event.js +++ b/frontend/tests/event.js @@ -147,3 +147,7 @@ Quand("j'essaie d'ajouter une image à une glose", () => { }); }); +Quand("j'utilise un document existant comme commentaire", () => { + cy.get('.select-document').click(); + cy.get('#select-dropdown').select('refersTo'); +}); diff --git a/frontend/tests/outcome.js b/frontend/tests/outcome.js index cf23f917..19954394 100644 --- a/frontend/tests/outcome.js +++ b/frontend/tests/outcome.js @@ -202,3 +202,15 @@ Alors("la colonne {int} contient {string}", (column, text) => { cy.contains(`.lectern .main .col .col:nth-child(${column})`, text); }); +Alors("la liste de mes documents s'affichent", () => { + cy.get('input[placeholder="Search documents"]').should('be.visible'); + cy.get('.document-list-container .existingDocument').should('have.length.greaterThan', 0); +}); + +Alors("la liste contient pour chaque document son titre, son auteur, sa dernière date de modification et son lien isPartOf", (_documentsText) => { + cy.get('.document-list-container .existingDocument') + .should('have.length.greaterThan', 0) + .each(($card) => { + cy.wrap($card).find('span').invoke('text').should('match', /\S+/); + }); +}); From 4bda3a5d005819a2faf5952bdf1afa0095ecb4c5 Mon Sep 17 00:00:00 2001 From: Sacha Date: Tue, 7 Apr 2026 15:22:50 +0200 Subject: [PATCH 4/4] FIX : Linking an existing document should be clearer and more practical (fixes #383). --- frontend/src/components/ExistingDocument.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ExistingDocument.jsx b/frontend/src/components/ExistingDocument.jsx index 4f81c141..fd63980f 100644 --- a/frontend/src/components/ExistingDocument.jsx +++ b/frontend/src/components/ExistingDocument.jsx @@ -1,9 +1,13 @@ import Card from 'react-bootstrap/Card'; import { useNavigate } from 'react-router'; +import {format } from 'date-fns'; function ExistingDocument({ document, relatedTo, verb, setLastUpdate, backend }) { const navigate = useNavigate(); const title = document.dc_title || 'Untitled document'; + const isPartOf = document.dc_isPartOf || ''; + const creator = document.dc_creator || ''; + const issued = format(new Date(document.dc_issued), 'dd/MM/yyyy HH:mm') || ''; const sourceChunksToBeLinked = (verb !== 'includes' && relatedTo.length) ? [{ verb, object: relatedTo[0] }] : relatedTo.map(object =>({ verb, object })); @@ -33,11 +37,10 @@ function ExistingDocument({ document, relatedTo, verb, setLastUpdate, backend }) }) .catch(console.error); }; - return ( - {title} + {title} - {isPartOf} - {creator} - {issued} );