Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

files cannot be found in repository when running tests in pipeline

Maxim Edelman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 5, 2025

situation
I'm trying to run a simple test where i upload a file 
using a command like so 

await  page.locator('input[type="file"]').nth(0).setInputFiles('/opt/atlassian/pipelines/agent/build/../sample-img.png');


the file /sample-img.png is stored inside the repository 

issue - 
locally this works fine , but when running it in the pipeline it wont be able to find the ../sample-img.png 
it cant find the path to the file for some reason


i tried every variation of ./sample-img.png and adding the upper path which is tests/sample-img.png , nothing works 

from what i understood its because the file is stored in a different path in the machine that is running the pipeline , but i cant find how to find it 
someone suggested to use 

 

            - ls -LaR

but maybe I'm not using it correct , adding it to the pipeline step simply does nothing

can someone help which what path i need to put before the sample img? or what can i do to solve this issue?

 

1 answer

0 votes
Phil C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2025

Hi Maxim,

Welcome to the community!

As you alluded to the issue you're encountering is likely due to the difference in file paths between your local environment and the pipeline environment. When running tests in a CI/CD environment like Bitbucket Pipelines, you need to ensure that any required files are available at the expected path during the test execution. 

My understanding is that you have a test file (sample-img.png) that is used during the tests executed on your pipeline. In this case, you need to make sure that the file is included in your repository in a directory tests/sample-img.png and on the branch where the build is executing. For example if your file is on the main branch but your build is executing on a branch develop where that file and folder does not exist the build will not be able to locate the file. 

Here's an example bitbucket-pipelines.yml to help locate the file

image: atlassian/default-image:3
pipelines:
default:
- step:
script:
- pwd # Print working directory
- ls -LaR # Show all files in the repo
- ls -l tests/sample-img.png # Verify file exists

 

Hopefully this helps point you in the right direction. 

- Phil

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events