Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions playwright/e2e/sign-herself-with-click-to-sign.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ test('sign herself with click to sign', async ({ page }) => {
await expect(page.getByLabel('PDF document to sign')).toBeVisible({ timeout: 15_000 })
const signButton = page.locator('.sign-pdf-sidebar .button-wrapper').getByRole('button', { name: 'Sign document' })
await expect(signButton).toBeVisible({ timeout: 15_000 })
await expect(page.getByText('No visible signature is required')).toBeVisible()
await signButton.click({ force: true })
const signResponsePromise = page.waitForResponse((response) =>
response.request().method() === 'POST'
Expand Down
58 changes: 58 additions & 0 deletions src/tests/views/SignPDF/Sign.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2267,3 +2267,61 @@ describe('Sign.vue - required device geolocation', () => {
expect(submitSignatureMock.mock.calls[0]?.[0]).not.toHaveProperty('geolocation')
})
})

describe('Sign.vue - no visible signature notice', () => {
Comment thread
vitormattos marked this conversation as resolved.
const mountWithVisibleElementFor = async (signRequestId: number) => {
setActivePinia(createPinia())

const SignComponent = await import('../../../views/SignPDF/_partials/Sign.vue')
const { useSignStore } = await import('../../../store/sign.js')
const signStore = useSignStore()

signStore.document = createSignDocument({
status: FILE_STATUS.ABLE_TO_SIGN,
signers: [
{ signRequestId: 501, me: true, status: SIGN_REQUEST_STATUS.ABLE_TO_SIGN },
{ signRequestId: 502 },
],
visibleElements: [
{ elementId: 201, fileId: 1, signRequestId, type: 'signature', coordinates: { page: 1, left: 10, top: 20, width: 30, height: 40 } },
],
})

const base = createSignMountOptions()
const options = {
...base,
global: {
...base.global,
stubs: {
...base.global.stubs,
NcNoteCard: { template: '<div class="nc-note-card-stub"><slot /></div>' },
NcButton: { template: '<button><slot /></button>' },
},
},
}

const wrapper = mount(SignComponent.default, options)
await flushPromises()

return wrapper
}

it('shows the notice when only another signer has a visible element', async () => {
const wrapper = await mountWithVisibleElementFor(502)

expect(wrapper.text()).toContain('Your digital signature will still be added')
})

it('does not show the notice when the current signer has a visible element', async () => {
const wrapper = await mountWithVisibleElementFor(501)

expect(wrapper.text()).not.toContain('Your digital signature will still be added')
})

it('keeps Sign document available while the notice is shown', async () => {
const wrapper = await mountWithVisibleElementFor(502)

expect(wrapper.text()).toContain('Your digital signature will still be added')
expect(wrapper.text()).toContain('Sign document')
})
})
9 changes: 9 additions & 0 deletions src/views/SignPDF/_partials/Sign.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<NcRichText :text="error.message"
:use-markdown="true" />
</NcNoteCard>
<NcNoteCard v-if="!hasVisibleSignatureField && !hasBlockingSignError"
:heading="t('libresign', 'No visible signature is required')"
type="info">
<p>
<!-- TRANSLATORS Informational message shown when the current signer has no visible signature field in the document. -->
{{ t('libresign', 'Your digital signature will still be added to the PDF and can be validated after signing.') }}
</p>
</NcNoteCard>
<div v-if="needCreateSignature" class="no-signature-warning">
<p>
<!-- TRANSLATORS Warning shown when the signer has not created any reusable signature yet. -->
Expand Down Expand Up @@ -587,6 +595,7 @@ const needCreateSignature = computed(() => {
}
return hasVisibleElementsForCurrentUser(visibleElementsDocument.value)
})
const hasVisibleSignatureField = computed(() => hasVisibleElementsForCurrentUser(visibleElementsDocument.value))
const needIdentificationDocuments = computed(() => identificationDocumentStore.showDocumentsComponent())
const canCreateSignature = computed(() => {
const capabilities = getCapabilities() as LibresignCapabilities
Expand Down
Loading