The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
fix: broken e2e tests (#1956)
David Nguyen9026aabe3bab
diff --git a/apps/remix/app/components/dialogs/template-use-dialog.tsx b/apps/remix/app/components/dialogs/template-use-dialog.tsxindex 2f8266ef1..242d146b9 100644--- a/apps/remix/app/components/dialogs/template-use-dialog.tsx+++ b/apps/remix/app/components/dialogs/template-use-dialog.tsx@@ -484,6 +484,7 @@ export function TemplateUseDialog({<inputtype="file"+ data-testid="template-use-dialog-file-input"className="absolute h-full w-full opacity-0"accept=".pdf,application/pdf"onChange={(e) => {diff --git a/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts b/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.tsindex d70bc03d8..73ef577b7 100644--- a/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts+++ b/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts@@ -1178,13 +1178,12 @@ test.describe('Unauthorized Access - Document API V2', () => {const { user: firstRecipientUser } = await seedUser();const { user: secondRecipientUser } = await seedUser();- await prisma.template.update({+ const updatedTemplate = await prisma.template.update({where: { id: template.id },data: {recipients: {create: [{- id: firstRecipientUser.id,name: firstRecipientUser.name || '',email: firstRecipientUser.email,token: nanoid(12),@@ -1193,7 +1192,6 @@ test.describe('Unauthorized Access - Document API V2', () => {signingStatus: SigningStatus.NOT_SIGNED,},{- id: secondRecipientUser.id,name: secondRecipientUser.name || '',email: secondRecipientUser.email,token: nanoid(12),@@ -1204,21 +1202,35 @@ test.describe('Unauthorized Access - Document API V2', () => {],},},+ include: {+ recipients: true,+ },});+ const recipientAId = updatedTemplate.recipients.find(+ (recipient) => recipient.email === firstRecipientUser.email,+ )?.id;+ const recipientBId = updatedTemplate.recipients.find(+ (recipient) => recipient.email === secondRecipientUser.email,+ )?.id;++ if (!recipientAId || !recipientBId) {+ throw new Error('Recipient IDs not found');+ }+const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/use`, {headers: { Authorization: `Bearer ${tokenB}` },data: {templateId: template.id,recipients: [{- id: firstRecipientUser.id,+ id: recipientAId,name: firstRecipientUser.name,email: firstRecipientUser.email,role: RecipientRole.SIGNER,},{- id: secondRecipientUser.id,+ id: recipientBId,name: secondRecipientUser.name,email: secondRecipientUser.email,role: RecipientRole.SIGNER,diff --git a/packages/app-tests/e2e/templates/create-document-from-template.spec.ts b/packages/app-tests/e2e/templates/create-document-from-template.spec.tsindex 39c58fc78..1db744603 100644--- a/packages/app-tests/e2e/templates/create-document-from-template.spec.ts+++ b/packages/app-tests/e2e/templates/create-document-from-template.spec.ts@@ -268,7 +268,7 @@ test('[TEMPLATE]: should create a document from a template with custom document'// Upload document.const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'),- page.locator('input[type=file]').evaluate((e) => {+ page.getByTestId('template-use-dialog-file-input').evaluate((e) => {if (e instanceof HTMLInputElement) {e.click();}@@ -361,7 +361,7 @@ test('[TEMPLATE]: should create a team document from a template with custom docu// Upload document.const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'),- page.locator('input[type=file]').evaluate((e) => {+ page.getByTestId('template-use-dialog-file-input').evaluate((e) => {if (e instanceof HTMLInputElement) {e.click();}diff --git a/packages/ui/primitives/document-upload.tsx b/packages/ui/primitives/document-upload.tsxindex 975c593d4..7ea3aff82 100644--- a/packages/ui/primitives/document-upload.tsx+++ b/packages/ui/primitives/document-upload.tsx@@ -96,7 +96,7 @@ export const DocumentDropzone = ({return (<Button loading={loading} aria-disabled={disabled} {...getRootProps()} {...props}><div className="flex items-center gap-2">- <input {...getInputProps()} />+ <input data-testid="document-upload-input" {...getInputProps()} />{!loading && <Upload className="h-4 w-4" />}{disabled ? _(disabledMessage) : _(heading[type])}</div>