Skip to content

Commit

Permalink
chore: turn off protocol element highlight selector tests (#29533)
Browse files Browse the repository at this point in the history
* blank

* blank - run ci

* chore: remove protocol highlight tests

* blank - run ci
  • Loading branch information
ryanthemanuel committed May 17, 2024
1 parent b62fc3f commit 5a23501
Showing 1 changed file with 0 additions and 106 deletions.
106 changes: 0 additions & 106 deletions packages/driver/cypress/e2e/cy/snapshot.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,112 +175,6 @@ describe('driver/src/cy/snapshots', () => {
expect(body.get().find('iframe').css('height')).to.equal('70px')
})
})

context('protocol', () => {
beforeEach(() => {
// set to 0 to ensure protocol snapshots are taken
// since the driver support file sets the value to 1
Cypress.config('numTestsKeptInMemory', 0)
})

it('captures a protocol snapshot with highlight elements', {
protocolEnabled: true,
}, function () {
cy.window().then((win) => {
win.__cypressProtocolMetadata = { frameId: 'test-frame-id' }

const { elementsToHighlight, name, timestamp } = cy.createSnapshot('snapshot', cy.$$('a'))

expect(elementsToHighlight?.length).to.equal(3)
expect(elementsToHighlight?.[0].selector).to.equal('a:nth-child(2)')
expect(elementsToHighlight?.[0].frameId).to.equal('test-frame-id')
expect(elementsToHighlight?.[1].selector).to.equal('#hashchange')
expect(elementsToHighlight?.[1].frameId).to.equal('test-frame-id')
expect(elementsToHighlight?.[2].selector).to.equal('#dimensions')
expect(elementsToHighlight?.[2].frameId).to.equal('test-frame-id')
expect(name).to.equal('snapshot')
expect(timestamp).to.be.a('number')
})
})

it('captures a protocol snapshot with an embedded iframe highlight element', {
protocolEnabled: true,
}, function () {
const iframe = $('<iframe src=\'iframe-inner.html\' />')

iframe.on('load', () => {
const ownerDoc = iframe[0].contentDocument
const elWindow = iframe[0].contentWindow
const element = $(ownerDoc.querySelector('button'))

elWindow.__cypressProtocolMetadata = { frameId: 'test-frame-id' }

const { elementsToHighlight, name, timestamp } = cy.createSnapshot('snapshot', element)

expect(elementsToHighlight?.length).to.equal(1)
expect(elementsToHighlight?.[0].selector).to.equal('button:nth-child(1)')
expect(elementsToHighlight?.[0].frameId).to.equal('test-frame-id')
expect(name).to.equal('snapshot')
expect(timestamp).to.be.a('number')
})

iframe.appendTo(cy.$$('body'))
})

it('captures a protocol snapshot with a body highlight element', {
protocolEnabled: true,
}, function () {
cy.window().then((win) => {
win.__cypressProtocolMetadata = { frameId: 'test-frame-id' }

const { elementsToHighlight, name, timestamp } = cy.createSnapshot('snapshot', cy.$$('body'))

expect(elementsToHighlight?.length).to.equal(1)
expect(elementsToHighlight?.[0].selector).to.equal('body:nth-child(2)')
expect(elementsToHighlight?.[0].frameId).to.equal('test-frame-id')
expect(name).to.equal('snapshot')
expect(timestamp).to.be.a('number')
})
})

it('captures a protocol snapshot and excludes a null element', {
protocolEnabled: true,
}, function () {
// create an element but don't append it to the DOM
const element = $('<div id=\'foo\' />')

const { elementsToHighlight, name, timestamp } = cy.createSnapshot('snapshot', element)

expect(elementsToHighlight?.length).to.equal(0)
expect(name).to.equal('snapshot')
expect(timestamp).to.be.a('number')
})

it('captures shadow DOM selectors structure properly', {
protocolEnabled: true,
}, () => {
cy.visit('/fixtures/shadow-dom-type.html')
cy.window().then((win) => {
win.__cypressProtocolMetadata = { frameId: 'test-frame-id' }

cy.get('#shadow-dom-input', {
includeShadowDom: true,
}).then((shadowDomSlot) => {
const { elementsToHighlight, name, timestamp } = cy.createSnapshot('snapshot', shadowDomSlot)

expect(elementsToHighlight?.length).to.equal(1)
const elementToHighlight = elementsToHighlight[0]

expect(elementToHighlight.selector.length).to.equal(2)
expect(elementToHighlight.selector[0]).to.equal('#element')
expect(elementToHighlight.selector[1]).to.equal('#shadow-dom-input')
expect(elementToHighlight.frameId).to.equal('test-frame-id')
expect(name).to.equal('snapshot')
expect(timestamp).to.be.a('number')
})
})
})
})
})

context('custom elements', () => {
Expand Down

5 comments on commit 5a23501

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5a23501 May 17, 2024

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.9.1/linux-x64/develop-5a2350130e8f0acb83886dd594f61866064d6bb4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5a23501 May 17, 2024

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 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.9.1/linux-arm64/develop-5a2350130e8f0acb83886dd594f61866064d6bb4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5a23501 May 17, 2024

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.9.1/win32-x64/develop-5a2350130e8f0acb83886dd594f61866064d6bb4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5a23501 May 17, 2024

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.9.1/darwin-arm64/develop-5a2350130e8f0acb83886dd594f61866064d6bb4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5a23501 May 17, 2024

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.9.1/darwin-x64/develop-5a2350130e8f0acb83886dd594f61866064d6bb4/cypress.tgz

Please sign in to comment.