mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
fix: broken e2e tests (#1956)
This commit is contained in:
@ -484,6 +484,7 @@ export function TemplateUseDialog({
|
||||
|
||||
<input
|
||||
type="file"
|
||||
data-testid="template-use-dialog-file-input"
|
||||
className="absolute h-full w-full opacity-0"
|
||||
accept=".pdf,application/pdf"
|
||||
onChange={(e) => {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user