Skip to content

cy.selectFile() not finding file when executing github action #31726

Open
@kathleennaughton

Description

@kathleennaughton

Current behavior

My tests are failing with the following error when executing in github action (these pass on local execution):

CypressError: cy.selectFile("/home/runner/work/qa-cypress/qa-cypress/cypress/downloads/PersonalTaxReturn.jpg") failed because the file does not exist at the following path:

/home/runner/work/qa-cypress/qa-cypress/cypress/downloads/PersonalTaxReturn.jpg

I have verified that this file exists in my github runner image:
Run echo "Absolute path to cypress/downloads:"
Absolute path to cypress/downloads:

/home/runner/work/qa-cypress/qa-cypress/cypress/downloads
total [6](**REDACTED ****)80
drwxr-xr-x 2 runner docker   4096 May 15 1[7](https:**REDACTED ****):35 .
drwxr-xr-x 7 runner docker   4096 May 15 17:35 ..
-rw-r--r-- 1 runner docker   614[8](https:**REDACTED ****) May 15 17:35 .DS_Store
-rw-r--r-- 1 runner docker 173527 May 15 17:35 BankStatement3Month.pdf
-rw-r--r-- 1 runner docker 173527 May 15 17:35 BankStatement6Month.pdf
-rw-r--r-- 1 runner docker 14132[9](**REDACTED ****) May 15 17:35 BusinessTaxReturn.jpg
-rw-r--r-- 1 runner docker  38719 May 15 17:35 GovermentID.jpg
-rw-r--r-- 1 runner docker 141329 May 15 17:35 PersonalTaxReturn.jpg

Please correct this issue.

Desired behavior

cy.selectFile() works in github action the same as in local exeuction

Test code to reproduce

 it.only("can add note to uploaded file", () => {
    const filePath = `${Cypress.config("fileServerFolder")}/cypress/downloads/PersonalTaxReturn.jpg`;
    cy.get("input[type=file]").first().selectFile(filePath, {
      force: true,
    }); // force: true is needed to bypass the hidden input field
    cy.wait(1000); // wait for the file to upload
    
    // clean up the uploaded file by removing it
    cy.get(removeIcon).contains(localizedString("Remove")).click();
    cy.wait(2000);
    // Verify that all remove buttons are gone
    cy.get(removeIcon).contains(localizedString("Remove")).should("not.exist");
  });

Cypress Version

14.3.2

Node version

23.11.1

Operating System

Download action repository 'cypress-io/github-action@v6'

Debug Logs

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy