Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'.selectFile must only be invoked from the spec file or support file' error in Firefox #27845

Closed
RKNeedsHelp opened this issue Sep 19, 2023 · 2 comments
Assignees

Comments

@RKNeedsHelp
Copy link

RKNeedsHelp commented Sep 19, 2023

Current behavior

I use this code to upload a File which works perfectly in Chrome, Edge and Electron but not in Firefox:
cy.delayedGet('[type="file"]').selectFile('Test Word bestand.pdf', { force: true });

I have also tried this version which results in the same behavior:
cy.get('input[type=file]').selectFile('cypress/fixtures/Test Word bestand.pdf', { force: true, action: 'drag-drop' });

The errror:
cy.selectFile() must only be invoked from the spec file or support file.

Desired behavior

For the file to successfully upload also in Firefox

Test code to reproduce

    cy.get('input[type=file]').selectFile('cypress/fixtures/Test Word bestand.pdf', { force: true, action: 'drag-drop' });

    cy.delayedGet('[type="file"]').selectFile('Test Word bestand.pdf', { force: true });

Cypress Version

v13.2.0

Node version

v18.17.1

Operating System

Windows 22H2

Debug Logs

Other

Issue is similar to #27149 and #27457

@nagash77
Copy link
Contributor

Hi @RKNeedsHelp
In order to give our engineers the best chance at recreating your problem, please create a reproducible example using a fork of Cypress Test Tiny. This gives us the best chance of seeing exactly what you are seeing and being able to investigate effectively.

@nagash77 nagash77 self-assigned this Sep 21, 2023
@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue and removed stage: needs information Not enough info to reproduce the issue labels Oct 5, 2023
@KrzysztofWisniewskiAcc
Copy link

KrzysztofWisniewskiAcc commented Oct 21, 2023

This should not be closed as it exists on 13.3.2

node: 18.18.2
npm: 10.2.0
cypres: 13.3.2
system: win11

I have only cypress installed.
Runing e2e specs tests

describe('=== Some spec ===', function () {
    context('+++ Test file +++', function () {
        it('- Put file into input', {}, function () {
            cy.get('#file-input-xxx').selectFile('cypress/fixtures/files/test.csv');
        })
    })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants