Skip to content

Commit

Permalink
fix iframe placeholder html (#5296)
Browse files Browse the repository at this point in the history
* fix iframe placeholder html, add test

* add link to issue

* remove added test, modify existing only
  • Loading branch information
kuceb authored Oct 29, 2019
1 parent cffe8b8 commit 3182f62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/driver/src/cy/snapshots.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ create = ($$, state) ->
</style>
<p>&lt;iframe&gt; placeholder for #{iframe.src}</p>
"""
$placeholder[0].src = "data:text/html;charset=utf-8,#{encodeURI(contents)}"
$placeholder[0].src = "data:text/html;base64,#{window.btoa(contents)}"

getStyles = (snapshot) ->
styleIds = snapshotsMap.get(snapshot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@ describe "driver/src/cy/snapshots", ->
it "replaces with placeholders that have src in content", ->
$("<iframe src='generic.html' />").appendTo(cy.$$("body"))

## NOTE: possibly switch to visual screenshot diffing in future
## since data: iframes are considered cross-origin and we cannot
## query into them and assert on contents
## e.g. cy.get('iframe').toMatchScreenshot()

## For now we parse the src attr and assert on base64 encoded content
{ body } = cy.createSnapshot(null, @$el)
expect(body.find("iframe").length).to.equal(1)
expect(body.find("iframe")[0].src).to.include("generic.html")
expect(body.find("iframe")[0].src).to.include(";base64")

expect(atob(body.find("iframe")[0].src.split(',')[1])).to.include("generic.html")

it "placeholders have same id", ->
$("<iframe id='foo-bar' />").appendTo(cy.$$("body"))
Expand Down

3 comments on commit 3182f62

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3182f62 Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/darwin-x64/circle-develop-3182f6257303c1001aae5c6e7fb11accc437c59e-177643/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.1/circle-develop-3182f6257303c1001aae5c6e7fb11accc437c59e-177639/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3182f62 Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/win32-x64/appveyor-develop-3182f6257303c1001aae5c6e7fb11accc437c59e-28472744/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.1/win32-x64/appveyor-develop-3182f6257303c1001aae5c6e7fb11accc437c59e-28472744/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3182f62 Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/win32-ia32/appveyor-develop-3182f6257303c1001aae5c6e7fb11accc437c59e-28472744/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.1/win32-ia32/appveyor-develop-3182f6257303c1001aae5c6e7fb11accc437c59e-28472744/cypress.zip

Please sign in to comment.