Upload a file while running tests on LambdaTest using WDIO

How do I upload a file to my website from my local system ? It works fine in my local, but when I run in lambda test, it says file not found I had given the relative path. should I be doing anything specific to , fetch the files from my framework folder, while running them in lambda test

const patientPhoto = path.join(__dirname, (’…/data/testpicture/test’));

this is how I had given the path

Hi Tom,

Here’s a sample code in the WDIO framework that uploads a file from your local system when running your tests on LambdaTest

const path = require('path');

it('should upload a file', function () {

browser.url('https://the-internet.herokuapp.com/upload')

const filePath = 'C://Users//Lattitude3410//Desktop//worthpoint.PNG'

const remoteFilePath = browser.uploadFile(filePath)

$('#file-upload').setValue(remoteFilePath)
$('#file-submit').click()

});

Hope this helps. Happy testing!!