I can't seem to make my Playwright test upload image. I have tried with file chooser and with setInputFiles but I might be wrong with order of actions.
Here is my spec.ts file
import { Page, test } from '@playwright/test'
test.use({ storageState: 'playwright/.auth/user.json' })
test.describe('Event creation page', () => {
let requestPage: Page
test.beforeEach(async ({ page }) => {
requestPage = page
await requestPage.goto('/event/create')
})
test('Test event creation', async () => {
await requestPage.goto('/evenement/creation')
await requestPage.getByTestId('event-title').fill('Event title')
await requestPage.getByTestId('event-description').fill('Event event description')
await requestPage.getByTestId('upload-photo-button').click()
await requestPage
.getByTestId('upload-photo-button')
.setInputFiles('fixtures/test-image.jpg')
})
})
The error I have is Error: Error: ENOENT: no such file or directory, stat 'c:\Users\project\fixtures\test-image.jpg'
but I dont
my project structure is following:
e2e
fixtures
test-image.jpg
my-other-test-files
src
app
Thank you!