From 75005aead3f141a1e3d6c06af14e040550ee66c4 Mon Sep 17 00:00:00 2001 From: Kai Arseneau Date: Thu, 7 Nov 2024 23:48:43 -0500 Subject: [PATCH] Update upload.test.ts --- e2e/tests/upload/upload.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e/tests/upload/upload.test.ts b/e2e/tests/upload/upload.test.ts index c9d692e5..3790a6ac 100644 --- a/e2e/tests/upload/upload.test.ts +++ b/e2e/tests/upload/upload.test.ts @@ -1,5 +1,6 @@ import { test, expect } from '@playwright/test'; import path from 'path'; +import * as fs from 'fs'; test.describe('Upload Form', () => { @@ -12,13 +13,18 @@ test.describe('Upload Form', () => { test('should open upload form and submit a file', async ({ page }) => { const filePath = path.join(__dirname, '../../test-files/endurance.bin'); + console.log("Resolved file path:", filePath); + console.log("File exists:", fs.existsSync(filePath)); + + if (!fs.existsSync(filePath)) { + throw new Error(`Test file not found at ${filePath}`); + } + // Opens the upload form by clicking the Upload button await page.getByRole('button', { name: 'Upload' }).click(); // Clicks on the file input label and uploads the file await page.locator('#label-file-upload').click(); - console.log("File path:", filePath); - console.log("dir name:", __dirname); await page.setInputFiles('#label-file-upload', filePath); // Clicks the submit button