Skip to content

Commit

Permalink
chore: fix serialization test for newer versions of firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed Sep 2, 2023
1 parent 4887e6a commit 3687fd7
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions packages/driver/cypress/e2e/util/serialization.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,20 @@ describe('Log Serialization', () => {

expect(snapshotBodyBefore.length).to.equal(1)

expect(snapshotBodyBefore[0]).to.be.instanceOf(HTMLBodyElement)
if (Cypress.browser.name === 'firefox') {
// serialized as an object in newer versions of firefox but matches the signature of HTMLBodyElement
expect(snapshotBodyBefore[0].constructor.name).to.equal('HTMLBodyElement')
} else {
expect(snapshotBodyBefore[0]).to.be.instanceOf(HTMLBodyElement)
}

// verify to some degree that the reified elements above can be matched into the snapshot
expect(snapshotBodyBefore[0].querySelector('form#button-inside-a')).to.be.instanceOf(HTMLFormElement)
if (Cypress.browser.name === 'firefox') {
// serialized as an object in newer versions of firefox but matches the signature of HTMLFormElement
expect(snapshotBodyBefore[0].querySelector('form#button-inside-a').constructor.name).to.equal('HTMLFormElement')
} else {
expect(snapshotBodyBefore[0].querySelector('form#button-inside-a')).to.be.instanceOf(HTMLFormElement)
}

expect(snapshots[1]).to.have.property('name').that.equals('after')
expect(snapshots[1]).to.have.property('htmlAttrs').that.deep.equals({})
Expand All @@ -449,10 +460,15 @@ describe('Log Serialization', () => {
const snapshotBodyAfter = snapshots[1].body.get()

expect(snapshotBodyAfter.length).to.equal(1)

expect(snapshotBodyAfter[0]).to.be.instanceOf(HTMLBodyElement)
// verify to some degree that the reified elements above can be matched into the snapshot
expect(snapshotBodyAfter[0].querySelector('form#button-inside-a')).to.be.instanceOf(HTMLFormElement)
if (Cypress.browser.name === 'firefox') {
// serialized as an object in newer versions of firefox but matches the signature of HTMLBodyElement
expect(snapshotBodyAfter[0].constructor.name).to.equal('HTMLBodyElement')
expect(snapshotBodyAfter[0].querySelector('form#button-inside-a').constructor.name).to.equal('HTMLFormElement')
} else {
expect(snapshotBodyAfter[0]).to.be.instanceOf(HTMLBodyElement)
// verify to some degree that the reified elements above can be matched into the snapshot
expect(snapshotBodyAfter[0].querySelector('form#button-inside-a')).to.be.instanceOf(HTMLFormElement)
}
})

// purpose of these 'DOM Elements' tests is to give a very basic understanding of how DOM element serialization works in the log serializer
Expand Down

4 comments on commit 3687fd7

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3687fd7 Sep 2, 2023

Choose a reason for hiding this comment

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

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

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.2.0/linux-x64/chore/update_electron25_and_node18-3687fd7e4a029cdb19bf6c67117b39f35dc3f82d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3687fd7 Sep 2, 2023

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 arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.2.0/darwin-arm64/chore/update_electron25_and_node18-3687fd7e4a029cdb19bf6c67117b39f35dc3f82d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3687fd7 Sep 2, 2023

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.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.2.0/darwin-x64/chore/update_electron25_and_node18-3687fd7e4a029cdb19bf6c67117b39f35dc3f82d/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3687fd7 Sep 2, 2023

Choose a reason for hiding this comment

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

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

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.2.0/win32-x64/chore/update_electron25_and_node18-3687fd7e4a029cdb19bf6c67117b39f35dc3f82d/cypress.tgz

Please sign in to comment.