abramenal / cypress-file-upload

File upload testing made easy
https://npm.im/cypress-file-upload
MIT License
496 stars 89 forks source link

[Bug] [documentation] Readme's usage session should mention that index.js also needs to import commands.js #242

Closed zecarrera closed 3 years ago

zecarrera commented 3 years ago

Current behavior:

The following error is shown if you change command.js but don't change index.js TypeError: cy.get(...).attachFile is not a function

As a first time user of cypress, I just followed the instructions here, and therefore the added commands were not loaded.

Desired behavior:

Under usage section of readme. Add the following line or similar:

Make sure that the following line is not commented out in your project's cypress/support/index.js or cypress/support/index.ts file:

import './commands';

Steps to reproduce: (app code and test code)

1 - Install cypress-file-upload 2 - Add import command to commands.js 3 - Run a test that tries to use cy.get('#anylocator').attachFile('filePath');

Actual result: 3 - Test fails with TypeError: cy.get(...).attachFile is not a function

Versions

This is a documentation related issue, which was observed using the following versions: "cypress": "^5.6.0", "cypress-file-upload": "^4.1.1",

abramenal commented 3 years ago

Hi @zecarrera Thanks for submitting the issue! Good one, let me add it