{"id":16018256,"url":"https://github.com/caiquecoelho/cypress-upload-file","last_synced_at":"2025-03-10T16:03:35.208Z","repository":{"id":104329235,"uuid":"309469647","full_name":"CaiqueCoelho/cypress-upload-file","owner":"CaiqueCoelho","description":"Upload any file with cypress! This library supports cypress in version 5.5.0 and also with higher and lower versions!","archived":false,"fork":false,"pushed_at":"2020-12-11T14:10:08.000Z","size":49,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T00:48:24.636Z","etag":null,"topics":["cypress","cypress-io","cypress-plugin","upload-file"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cypress-upload-file","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CaiqueCoelho.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"CaiqueCoelho"}},"created_at":"2020-11-02T19:09:27.000Z","updated_at":"2020-12-11T14:10:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a767eea-754f-4fa0-950c-26e560030ec1","html_url":"https://github.com/CaiqueCoelho/cypress-upload-file","commit_stats":null,"previous_names":["caiquecoelho/cypress-upload-file"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiqueCoelho%2Fcypress-upload-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiqueCoelho%2Fcypress-upload-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiqueCoelho%2Fcypress-upload-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaiqueCoelho%2Fcypress-upload-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaiqueCoelho","download_url":"https://codeload.github.com/CaiqueCoelho/cypress-upload-file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242883696,"owners_count":20200979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","cypress-io","cypress-plugin","upload-file"],"created_at":"2024-10-08T16:41:34.611Z","updated_at":"2025-03-10T16:03:35.164Z","avatar_url":"https://github.com/CaiqueCoelho.png","language":"JavaScript","funding_links":["https://opencollective.com/CaiqueCoelho"],"categories":[],"sub_categories":[],"readme":"# Cypress Upload File\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/abramenal/cypress-file-upload/blob/master/LICENSE)\n[![npm version](https://img.shields.io/npm/v/cypress-upload-file.svg?style=flat\u0026color=important)](https://www.npmjs.com/package/cypress-upload-file)\n\nUpload any file quickly and easily with cypress! You only need two lines of code to upload it! This library works with cypress in version 5.5.0 and also with higher and lower versions!\n\n## How to install\n\n```bash\nnpm install --save-dev cypress-upload-file\n```\n\n## How to use\n\n`cypress-file-upload` extends Cypress' `cy` command.\nAdd this line to your project's `cypress/support/commands.js` or `cypress/support/commands.ts` file:\n\n```javascript\nimport uploadFile from \"cypress-upload-file\";\n```\n\n```javascript\ndescribe(\"Upload the file\", () =\u003e {\n  it(\"Upload the file and assert the name of the file uploaded\", () =\u003e {\n    cy.visit(\"https://the-internet.herokuapp.com/upload\");\n\n    // Name of the file in your directory cypress/fixture\n    // If yout file is inside another folder you must put the path\n    // example 'folderName/blank.pdf'\n    const fileName = \"blank.pdf\";\n    // The type extension for this file like: image/png, image/jpeg, video/mp4, application/pdf, text/plain, application/json\n    const fileType = \"image/png\";\n    // Selector path to find the input element in UI that we want to upload a file, in our example the element\n    // has an id name \"file-upload\" so we can use here \"#file-upload\"\n    const selector = \"#file-upload\";\n\n    uploadFile(selector, fileName, fileType);\n    cy.get(\"#file-submit\").click();\n    cy.get(\"#uploaded-files\").contains(\"blank\");\n  });\n});\n```\n\n## Documentation\n\n```\nThis function help cypress to upload a file to a file upload input\nusing any type of file extension: png, jpg, jpeg, gif, pdf, svg, mp4, mp3, docx.\nYou need to have your file stored in fixtures cypress directory\nCall this function with some selector element, with file name, and file type.\nFile extension types must be input like:\n- image/png\n- image/jpeg\n- image/jpg\n- video/mp4\n- application/pdf\n- application/json\n- text/plain\n- image/gif\n- text/html\n- audio/mpeg\n- audio/ogg\n- audio/mp3\n\n- @param {String} selectorElement Some selector information to find the file upload input element\n- @param {String} fileName Name of the file with with its extension, exampĺe image.png\n- @param {String} fileType The file type extension like: image/png, image/jpeg, video/mp4, image/gif, application/pdf, text/plain, application/json, audio/mpeg\n- @return {VoidFunction} This function don't returned anything\n```\n\n## Feature Request\n\nIf you have any feature request just open an issue describing your request or feel free with your feature! Any pull pull request are welcome!\n\n## Found an issue?\n\nRegister the issue [here](https://github.com/CaiqueCoelho/cypress-upload-file/issues) and wait for us to solve it as soon as possible.\nIn addition, any contribution is welcome, so feel free to make a pull request if you want to solve any problem :happy:\n\n## License\n\n[MIT](https://github.com/abramenal/cypress-file-upload/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiquecoelho%2Fcypress-upload-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaiquecoelho%2Fcypress-upload-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiquecoelho%2Fcypress-upload-file/lists"}