Repository navigation
Conversation
Signed-off-by: Buzepool <pedrokenorhue@gmail.com>
|
Thanks for opening your first pull request in this repository! ✌️ |
vitormattos
left a comment
There was a problem hiding this comment.
Please address the inline regression test feedback before merging.
| expect(signStore.document!.files).toEqual(envelopeFiles) | ||
| }) | ||
|
|
||
| it('requests detailed envelope files so child files carry a PDF url', async () => { |
There was a problem hiding this comment.
Could you extend this regression test to verify the actual PDF loading behavior using Vitest's it.each, with the following datasets?
it.each([
{ nodeType: 'file', fileCount: 1 },
{ nodeType: 'envelope', fileCount: 2 },
])('loads all PDFs for $nodeType with $fileCount file(s)', ...)You can reuse the existing mocks and the createSignDocument() helper in this test suite.
A suggested approach:
- Set
mockRoute.nametoSignPDFto exercise the internal signing flow. - Mock
filesStore.fetchFileDetail()to return the corresponding document or envelope. - Mock
loadState()to simulate a fresh page load without preloaded PDFs or envelope files. - For the envelope scenario, make the
axios.get()mock return the summary payload without PDF URLs whendetails=trueis absent, and the detailed payload when it is present. - Mock
fetch()to return PDF blobs, following the existing envelope tests in this file. - Mount the component after configuring the mocks and use
flushPromises()to wait for asynchronous loading.
Then verify that:
- Each expected PDF URL was fetched.
PdfEditorreceives the expected number of files and their corresponding filenames.- No PDF loading error is reported.
Also, the existing generateOcsUrl mock should prepend only /ocs/v2.php, since the component already supplies /apps/libresign in the path.
Without this fix, the standalone document scenario should pass and the envelope scenario should fail. With this fix, both should pass.
This will protect the actual signing workflow rather than only the presence of a query parameter.
There was a problem hiding this comment.
Thanks for the detailed guidance! Done in the latest commit:
- Replaced the query-parameter check with
it.eachover{ nodeType: 'file', fileCount: 1 }and{ nodeType: 'envelope', fileCount: 2 }, mounting on theSignPDFroute withfetchFileDetail()returning the document/envelope andloadState()simulating a fresh page load. - For the envelope,
axios.get()returns the summary payload (no PDF URLs) unlessdetails=trueis present, then the detailed payload. - Asserts each PDF URL is fetched,
PdfEditorreceives the expected number of files and file names, and no PDF load error is reported. - Fixed the
generateOcsUrlmock to prepend only/ocs/v2.php(my previous assertion would have checked a duplicated path).
Local results (npx vitest run src/tests/views/SignPDF/SignPDF.spec.ts):
- With the fix: 10/10 passing.
- Without the fix (
details: 'true'removed): the file scenario passes and the envelope scenario fails withexpected "vi.fn()" to be called 2 times, but got 0 times.
ESLint is clean on both changed files.
Resolves: #9571
📝 Summary
On
/f/sign/{uuid},SignPDF.vueloads envelope children throughfile/listwithoutdetails=true. The summary payload has no PDFurlfor child files, sogetFileUrl()finds nothing and the page shows "Failed to load envelope files" without requesting any PDF. The detailed payload adds the current signer's PDF url (the same call inVisibleElements.vuealready passesdetails: true)./p/signworks because the files come from the initial state.🧪 How to test
/apps/libresign/f/sign/{uuid}/pdfwith a full page load.Validation evidence
🎨 UI / Front-end changes
fetchEnvelopeFilesrequestsdetails=true✅ Checklist
🤖 AI (if applicable)