@@ -12,6 +12,10 @@ import { test, expect } from "../../element-web-test";
1212import { SettingLevel } from "../../../src/settings/SettingLevel" ;
1313import { Layout } from "../../../src/settings/enums/Layout" ;
1414import { type ElementAppPage } from "../../pages/ElementAppPage" ;
15+ import { dirname , join } from "node:path" ;
16+ import { fileURLToPath } from "node:url" ;
17+
18+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
1519
1620// Find and click "Reply" button
1721const clickButtonReply = async ( tile : Locator ) => {
@@ -30,7 +34,9 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
3034
3135 const uploadFile = async ( page : Page , file : string ) => {
3236 // Upload a file from the message composer
33- await page . locator ( ".mx_MessageComposer_actions input[type='file']" ) . setInputFiles ( file ) ;
37+ await page
38+ . locator ( ".mx_MessageComposer_actions input[type='file']" )
39+ . setInputFiles ( join ( __dirname , ".." , ".." , file ) ) ;
3440
3541 // Find and click primary "Upload" button
3642 await page . locator ( ".mx_Dialog" ) . getByRole ( "button" , { name : "Upload" } ) . click ( ) ;
@@ -158,15 +164,15 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
158164 } ) ;
159165
160166 test ( "should be correctly rendered - light theme" , { tag : "@screenshot" } , async ( { page, app } ) => {
161- await uploadFile ( page , "playwright/ sample-files/1sec-long-name-audio-file.ogg" ) ;
167+ await uploadFile ( page , "sample-files/1sec-long-name-audio-file.ogg" ) ;
162168 await takeSnapshots ( page , app , "Selected EventTile of audio player (light theme)" ) ;
163169 } ) ;
164170
165171 test (
166172 "should be correctly rendered - light theme with monospace font" ,
167173 { tag : "@screenshot" } ,
168174 async ( { page, app } ) => {
169- await uploadFile ( page , "playwright/ sample-files/1sec-long-name-audio-file.ogg" ) ;
175+ await uploadFile ( page , "sample-files/1sec-long-name-audio-file.ogg" ) ;
170176
171177 await takeSnapshots ( page , app , "Selected EventTile of audio player (light theme, monospace font)" , true ) ; // Enable monospace
172178 } ,
@@ -183,7 +189,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
183189
184190 await app . closeDialog ( ) ;
185191
186- await uploadFile ( page , "playwright/ sample-files/1sec-long-name-audio-file.ogg" ) ;
192+ await uploadFile ( page , "sample-files/1sec-long-name-audio-file.ogg" ) ;
187193
188194 await takeSnapshots ( page , app , "Selected EventTile of audio player (high contrast)" ) ;
189195 } ) ;
@@ -192,13 +198,13 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
192198 // Enable dark theme
193199 await app . settings . setValue ( "theme" , null , SettingLevel . ACCOUNT , "dark" ) ;
194200
195- await uploadFile ( page , "playwright/ sample-files/1sec-long-name-audio-file.ogg" ) ;
201+ await uploadFile ( page , "sample-files/1sec-long-name-audio-file.ogg" ) ;
196202
197203 await takeSnapshots ( page , app , "Selected EventTile of audio player (dark theme)" ) ;
198204 } ) ;
199205
200206 test ( "should play an audio file" , async ( { page, app } ) => {
201- await uploadFile ( page , "playwright/ sample-files/1sec.ogg" ) ;
207+ await uploadFile ( page , "sample-files/1sec.ogg" ) ;
202208
203209 // Assert that the audio player is rendered
204210 const container = page . locator ( ".mx_EventTile_last" ) . getByRole ( "region" , { name : "Audio player" } ) ;
@@ -220,7 +226,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
220226 } ) ;
221227
222228 test ( "should support downloading an audio file" , async ( { page, app } ) => {
223- await uploadFile ( page , "playwright/ sample-files/1sec.ogg" ) ;
229+ await uploadFile ( page , "sample-files/1sec.ogg" ) ;
224230
225231 const downloadPromise = page . waitForEvent ( "download" ) ;
226232
@@ -238,7 +244,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
238244 "should support replying to audio file with another audio file" ,
239245 { tag : "@screenshot" } ,
240246 async ( { page, app } ) => {
241- await uploadFile ( page , "playwright/ sample-files/1sec.ogg" ) ;
247+ await uploadFile ( page , "sample-files/1sec.ogg" ) ;
242248
243249 // Assert the audio player is rendered
244250 await expect ( page . getByRole ( "region" , { name : "Audio player" } ) ) . toBeVisible ( ) ;
@@ -248,7 +254,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
248254 await clickButtonReply ( tile ) ;
249255
250256 // Reply to the player with another audio file
251- await uploadFile ( page , "playwright/ sample-files/1sec.ogg" ) ;
257+ await uploadFile ( page , "sample-files/1sec.ogg" ) ;
252258
253259 // Assert that the audio player is rendered
254260 await expect ( tile . getByRole ( "region" , { name : "Audio player" } ) ) . toBeVisible ( ) ;
@@ -273,7 +279,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
273279
274280 const tile = page . locator ( ".mx_EventTile_last" ) ;
275281
276- await uploadFile ( page , "playwright/ sample-files/upload-first.ogg" ) ;
282+ await uploadFile ( page , "sample-files/upload-first.ogg" ) ;
277283
278284 // Assert that the audio player is rendered
279285 await expect (
@@ -283,7 +289,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
283289 await clickButtonReply ( tile ) ;
284290
285291 // Reply to the player with another audio file
286- await uploadFile ( page , "playwright/ sample-files/upload-second.ogg" ) ;
292+ await uploadFile ( page , "sample-files/upload-second.ogg" ) ;
287293
288294 // Assert that the audio player is rendered
289295 await expect (
@@ -293,7 +299,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
293299 await clickButtonReply ( tile ) ;
294300
295301 // Reply to the player with yet another audio file to create a reply chain
296- await uploadFile ( page , "playwright/ sample-files/upload-third.ogg" ) ;
302+ await uploadFile ( page , "sample-files/upload-third.ogg" ) ;
297303
298304 // Assert that the audio player is rendered
299305 await expect ( tile . getByRole ( "region" , { name : "Audio player" } ) ) . toBeVisible ( ) ;
@@ -325,7 +331,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
325331 ) ;
326332
327333 test ( "should be rendered, play, and support replying on a thread" , async ( { page, app } ) => {
328- await uploadFile ( page , "playwright/ sample-files/1sec-long-name-audio-file.ogg" ) ;
334+ await uploadFile ( page , "sample-files/1sec-long-name-audio-file.ogg" ) ;
329335
330336 // On the main timeline
331337 const messageList = page . locator ( ".mx_RoomView_MessageList" ) ;
0 commit comments