The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
chore: test for redirect url
Ephraim Atta-Duncan5377d27c6a2d
diff --git a/packages/app-tests/e2e/pr-718-add-stepper-component.spec.ts b/packages/app-tests/e2e/pr-718-add-stepper-component.spec.tsindex 3318afe7a..4327935bb 100644--- a/packages/app-tests/e2e/pr-718-add-stepper-component.spec.ts+++ b/packages/app-tests/e2e/pr-718-add-stepper-component.spec.ts@@ -252,3 +252,88 @@ test('should be able to create, send and sign a document', async ({ page }) => {const { status: completedStatus } = await getDocumentByToken({ token });expect(completedStatus).toBe(DocumentStatus.COMPLETED);});++test('should be able to create, send with redirect url, sign a document and redirect to redirect url', async ({+ page,+}) => {+ await page.goto('/signin');++ const documentTitle = `example-${Date.now()}.pdf`;++ // Sign in+ await page.getByLabel('Email').fill(TEST_USER.email);+ await page.getByLabel('Password', { exact: true }).fill(TEST_USER.password);+ await page.getByRole('button', { name: 'Sign In' }).click();++ // Upload document+ const [fileChooser] = await Promise.all([+ page.waitForEvent('filechooser'),+ page.locator('input[type=file]').evaluate((e) => {+ if (e instanceof HTMLInputElement) {+ e.click();+ }+ }),+ ]);++ await fileChooser.setFiles(path.join(__dirname, '../../../assets/example.pdf'));++ // Wait to be redirected to the edit page+ await page.waitForURL(/\/documents\/\d+/);++ // Set title+ await expect(page.getByRole('heading', { name: 'Add Title' })).toBeVisible();++ await page.getByLabel('Title').fill(documentTitle);++ await page.getByRole('button', { name: 'Continue' }).click();++ // Add signers+ await expect(page.getByRole('heading', { name: 'Add Signers' })).toBeVisible();++ await page.getByLabel('Email*').fill('[email protected]');+ await page.getByLabel('Name').fill('User 1');++ await page.getByRole('button', { name: 'Continue' }).click();++ // Add fields+ await expect(page.getByRole('heading', { name: 'Add Fields' })).toBeVisible();+ await page.getByRole('button', { name: 'Continue' }).click();++ // Add subject and send+ await expect(page.getByRole('heading', { name: 'Add Subject' })).toBeVisible();+ await page.getByRole('button', { name: 'Advanced Options' }).click();+ await page.getByLabel('Redirect URL').fill('https://documenso.com');++ await page.getByRole('button', { name: 'Send' }).click();++ await page.waitForURL('/documents');++ // Assert document was created+ await expect(page.getByRole('link', { name: documentTitle })).toBeVisible();+ await page.getByRole('link', { name: documentTitle }).click();++ const url = await page.url().split('/');+ const documentId = url[url.length - 1];++ const { token } = await getRecipientByEmail({+ email: '[email protected]',+ documentId: Number(documentId),+ });++ await page.goto(`/sign/${token}`);+ await page.waitForURL(`/sign/${token}`);++ // Check if document has been viewed+ const { status } = await getDocumentByToken({ token });+ expect(status).toBe(DocumentStatus.PENDING);++ await page.getByRole('button', { name: 'Complete' }).click();+ await expect(page.getByRole('dialog').getByText('Sign Document')).toBeVisible();+ await page.getByRole('button', { name: 'Sign' }).click();++ await page.waitForURL('https://documenso.com');++ // Check if document has been signed+ const { status: completedStatus } = await getDocumentByToken({ token });+ expect(completedStatus).toBe(DocumentStatus.COMPLETED);+});diff --git a/packages/ui/primitives/document-flow/add-subject.tsx b/packages/ui/primitives/document-flow/add-subject.tsxindex bfc7f3fc5..aa0bc148f 100644--- a/packages/ui/primitives/document-flow/add-subject.tsx+++ b/packages/ui/primitives/document-flow/add-subject.tsx@@ -230,7 +230,7 @@ export const AddSubjectFormPartial = ({<div className="flex flex-col gap-y-4"><div><Label htmlFor="redirectUrl" className="flex items-center">- Redirect URL{' '}+ Redirect URL<Tooltip><TooltipTrigger><Info className="mx-2 h-4 w-4" />