Cypress Tutorial
Selected Reading
- Cypress - Discussion
- Cypress - Useful Resources
- Cypress - Quick Guide
- Cypress - GitHub
- Cypress - Plugins
- Cypress - Reports
- Cypress - Configuration of JSON File
- Cypress - Hooks
- Cypress - Environment Variables
- Cypress - Fixtures
- Cypress - Custom Commands
- Cypress - Debugging
- Cypress - Screenshots and Videos
- Cypress - Dashboards
- Cypress - Prompt Pop-up Window
- Cypress - Data Driven Testing
- Cypress - File Upload
- Cypress - Get and Post
- Cypress - Cookies
- Cypress - Mouse Actions
- Cypress - Web Tables
- Cypress - Frames
- Cypress - Hidden Elements
- Cypress - Child Windows
- Cypress - Alerts
- Cypress - Dropdown
- Cypress - Tabs
- Cypress - Checkbox
- Cypress - jQuery
- Cypress - Working with XHR
- Cypress - Asynchronous Behavior
- Cypress - Text Verification
- Cypress - Assertions
- Cypress - Locators
- Cypress - Aliases
- Cypress - Variables
- Cypress - Basic Commands
- Cypress - Supported Browsers
- Cypress - Build First Test
- Cypress - Test Runner
- Cypress - Architecture and Environment Setup
- Cypress - Introduction
- Cypress - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cypress - File Upload
Cypress - File Upload
To perform file upload task in Cypress, we have to first install a plugin with the command mentioned below −
npm install –dev cypress-file-upload
以下屏幕将登在你的电脑上:
一旦安装完毕,我们就必须在指挥部档案中增加进口气压单上载荷。 这一档案存放在我们“Cypress”项目内。
此外,我们将补充我们想要在固定装置夹中上载的文件(Picture.png文档)。 将展示以下屏幕:
为了上载档案,我们必须使用Cypress指挥系统,并附上File,并将文档作为参数上载。
Implementation
用于在Cypress上载一个档案的指挥系统如下:
describe( Tutorialspoint Test , function () { // test case it( Test Case6 , function (){ //file to be uploaded path in project folder const p = Picture.png // launch URL cy.visit("https://the-internet.herokuapp.com/upload") //upload file with attachFile cy.get( #file-upload ).attachFile(p) //cpck on upload cy.get( #file-submit ).cpck() //verify uploaded file cy.get( #uploaded-files ).contains( Picture ) }); });
产出如下:
执行记录显示档案照片。 png got上载,文档名称反映在网页上。
Advertisements