From 77d3c3ec003c00a9a3a4215141bb23e113401f00 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Tue, 27 Jul 2021 10:37:58 -0500 Subject: [PATCH 01/29] BREAKING CHANGE: 9.0 From 2e4ec7c1e98d3a8561f3de4928811e8eab3e28f8 Mon Sep 17 00:00:00 2001 From: Kukhyeon Heo Date: Thu, 5 Aug 2021 01:27:15 +0900 Subject: [PATCH 02/29] fix: The content of ` +
+ +
+ +
+ +
+ + diff --git a/packages/driver/cypress/integration/commands/querying_spec.js b/packages/driver/cypress/integration/commands/querying_spec.js index 777da0a46c98..560c185064d2 100644 --- a/packages/driver/cypress/integration/commands/querying_spec.js +++ b/packages/driver/cypress/integration/commands/querying_spec.js @@ -1573,13 +1573,13 @@ describe('src/cy/commands/querying', () => { it('will not find script elements', () => { cy.$$('').appendTo(cy.$$('body')) - cy.contains('some-script-content').should('not.match', 'script') + cy.contains('some-script-content').should('not.exist') }) it('will not find style elements', () => { cy.$$('').appendTo(cy.$$('body')) - cy.contains('some-style-content').should('not.match', 'style') + cy.contains('some-style-content').should('not.exist') }) it('finds the nearest element by :contains selector', () => { @@ -1954,6 +1954,30 @@ space }) }) + describe('ignores style and script tag in body', () => { + it('style', (done) => { + cy.on('fail', (err) => { + expect(err.message).to.include('Expected to find content: ') + + done() + }) + + cy.visit('fixtures/content-in-body.html') + cy.contains('font-size', { timeout: 500 }) + }) + + it('script', (done) => { + cy.on('fail', (err) => { + expect(err.message).to.include('Expected to find content: ') + + done() + }) + + cy.visit('fixtures/content-in-body.html') + cy.contains('I am in the script tag in body', { timeout: 500 }) + }) + }) + describe('subject contains text nodes', () => { it('searches for content within subject', () => { const badge = cy.$$('#edge-case-contains .badge:contains(5)') diff --git a/packages/driver/src/dom/elements.ts b/packages/driver/src/dom/elements.ts index 465632c72571..8283e1dbc7ec 100644 --- a/packages/driver/src/dom/elements.ts +++ b/packages/driver/src/dom/elements.ts @@ -1075,6 +1075,20 @@ const getElements = ($el) => { return els } +// Remove