Skip to content

Commit 7e79274

Browse files
authored
Revert "Cross domain file download (#566)"
This reverts commit bedb8d6.
1 parent bedb8d6 commit 7e79274

File tree

5 files changed

+3
-54
lines changed

5 files changed

+3
-54
lines changed

examples/testing-dom__download/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
![File download in Chrome](images/chrome.png)
44

5-
See [cypress/plugins/index.js](cypress/plugins/index.js) to see how we set the download folder when launching the browser. See the [cypress/integration/spec.js](cypress/integration/spec.js) spec file that downloads and verifies a CSV file, an Excel file, and a PNG image.
5+
See [cypress/plugins/index.js](cypress/plugins/index.js) to see how we set the download folder when launching the browser. See the [cypress/integration/spec.js](cypress/integration/spec.js) spec file that downloads and verifies a CSV file and an Excel file.
66

77
![File download in Firefox](images/firefox.png)

examples/testing-dom__download/cypress.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"fixturesFolder": false,
33
"supportFile": false,
44
"viewportWidth": 500,
5-
"viewportHeight": 500,
6-
"baseUrl": "http://localhost:8070",
7-
"chromeWebSecurity": false
5+
"viewportHeight": 300,
6+
"baseUrl": "http://localhost:8070"
87
}

examples/testing-dom__download/cypress/integration/spec.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -95,48 +95,4 @@ describe('file download', () => {
9595
])
9696
})
9797
})
98-
99-
it('downloads local PNG image', () => {
100-
// image comes from the same domain as the page
101-
cy.visit('/')
102-
cy.get('[data-cy=download-png]').click()
103-
104-
cy.log('**confirm downloaded image**')
105-
106-
const downloadedFilename = path.join(downloadsFolder, 'logo.png')
107-
108-
// ensure the file has been saved before trying to parse it
109-
cy.readFile(downloadedFilename, 'binary', { timeout: 15000 })
110-
.should((buffer) => {
111-
// by having length assertion we ensure the file has text
112-
// since we don't know when the browser finishes writing it to disk
113-
114-
// Tip: use expect() form to avoid dumping binary contents
115-
// of the buffer into the Command Log
116-
expect(buffer.length).to.be.gt(1000)
117-
})
118-
})
119-
120-
// The next step tries to download file located in
121-
// the second domain. It runs in Chromium browsers with
122-
// "chromeWebSecurity": false, but we need to skip it in Firefox
123-
it('downloads remote PNG image', { browser: '!firefox' }, () => {
124-
// image comes from a domain different from the page
125-
cy.visit('/')
126-
cy.get('[data-cy=download-remote-png]').click()
127-
128-
cy.log('**confirm downloaded image**')
129-
const downloadedFilename = path.join(downloadsFolder, 'logo.png')
130-
131-
// ensure the file has been saved before trying to parse it
132-
cy.readFile(downloadedFilename, 'binary', { timeout: 15000 })
133-
.should((buffer) => {
134-
// by having length assertion we ensure the file has text
135-
// since we don't know when the browser finishes writing it to disk
136-
137-
// Tip: use expect() form to avoid dumping binary contents
138-
// of the buffer into the Command Log
139-
expect(buffer.length).to.be.gt(1000)
140-
})
141-
})
14298
})

examples/testing-dom__download/public/index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,4 @@ <h1>Download CSV</h1>
55

66
<h1>Download XLSX</h1>
77
<a data-cy="download-xlsx" href="people.xlsx" download>people.xlsx</a>
8-
9-
<h1>Download a local PNG image</h1>
10-
<a data-cy="download-png" href="logo.png" download>logo.png</a>
11-
12-
<h1>Download a remote PNG image</h1>
13-
<a data-cy="download-remote-png" href="https://docs.cypress.io/img/logo.png" download>remote logo.png</a>
148
</body>
-6.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)