Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency: Update jQuery to latest #30345

Open
wants to merge 23 commits into
base: release/14.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f9f9226
remove jquery patch
jennifer-shehane Oct 2, 2024
f1b591f
changelog entry
jennifer-shehane Oct 2, 2024
844db79
fix issue link
jennifer-shehane Oct 2, 2024
eb86a7c
Update halfScrollPixels to width/height that jQuery returns
jennifer-shehane Oct 2, 2024
34a02db
Update scroll tests to properly check for half with no scrollbar
jennifer-shehane Oct 3, 2024
19bbd98
remove passing variable that doesn't exist in jquery scrollto
jennifer-shehane Oct 3, 2024
30ef0de
bump to jQuery 3.5.0 + fix invalid DOM in tests
jennifer-shehane Oct 3, 2024
874be28
Merge branch 'release/14.0.0' into remove-jquery-patch
jennifer-shehane Oct 3, 2024
91cfc14
bump down jquery - got too excited
jennifer-shehane Oct 3, 2024
c8d1396
Merge branch 'remove-jquery-patch' of https://github.com/cypress-io/c…
jennifer-shehane Oct 3, 2024
17531ad
Merge branch 'release/14.0.0' into remove-jquery-patch
jennifer-shehane Oct 3, 2024
b5fe393
Fix the tests to be accurate
jennifer-shehane Oct 4, 2024
ddfc43b
bump jquery
jennifer-shehane Oct 4, 2024
5d5a846
switch to client, see what breaks
jennifer-shehane Oct 7, 2024
ea9d7a2
Repatch jquery and update tests back to old logic
jennifer-shehane Oct 8, 2024
5b6378b
add dep changelog entry
jennifer-shehane Oct 8, 2024
6614b89
remove test that's reliant on deprecated jQuery focus
jennifer-shehane Oct 8, 2024
1f0bb68
update test to follow cypress conventions for chaining
jennifer-shehane Oct 8, 2024
59caf49
Update regex to include jQuery stack traces as well as sizzle since j…
jennifer-shehane Oct 8, 2024
87dac4b
Merge branch 'release/14.0.0' into remove-jquery-patch
jennifer-shehane Oct 8, 2024
fce86e0
update changelog
jennifer-shehane Oct 10, 2024
73174df
update focus link to fix it
jennifer-shehane Oct 10, 2024
fc9aef2
Merge branch 'remove-jquery-patch' of https://github.com/cypress-io/c…
jennifer-shehane Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ _Released 12/3/2024 (PENDING)_
- Prebuilt binaries for Linux are no longer compatible with Linux distributions based on glibc <2.28, for example: Ubuntu 14-18, RHEL 7, CentOS 7, Amazon Linux 2. Addresses [#29601](https://github.com/cypress-io/cypress/issues/29601).
- The undocumented methods `Cypress.backend('firefox:force:gc')` and `Cypress.backend('log:memory:pressure')` were removed. Addresses [#30222](https://github.com/cypress-io/cypress/issues/30222).

**Dependency Updates:**

- Updated `jQuery` from `3.4.1` to `3.7.1`. Addressed in [#30345](https://github.com/cypress-io/cypress/pull/30345).

## 13.15.1

_Released 10/1/2024 (PENDING)_
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
"**/@types/cheerio": "0.22.21",
"**/@types/enzyme": "3.10.5",
"**/@types/react": "16.9.50",
"**/jquery": "3.4.1",
"**/jquery": "3.7.1",
"**/pretty-format": "26.4.0",
"**/sharp": "0.29.3",
"**/socket.io-parser": "4.0.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/app/cypress/e2e/cypress-in-cypress-component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ describe('Cypress In Cypress CT', { viewportWidth: 1500, defaultCommandTimeout:
cy.get('body').click()

cy.findByTestId('playground-activator').click()
cy.findByTestId('playground-selector').clear().type('[data-cy-root]')
cy.findByTestId('playground-selector').clear()
cy.findByTestId('playground-selector').type('[data-cy-root]')

// TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435
// snapshotAUTPanel('cy.get selector')
Expand Down
5 changes: 3 additions & 2 deletions packages/app/src/runner/aut-iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Highlight from './selector-playground/Highlight.ce.vue'
type $CypressJQuery = any

const sizzleRe = /sizzle/i
const jQueryRe = /jquery/i

export class AutIframe {
debouncedToggleSelectorPlayground: DebouncedFunc<(isEnabled: any) => void>
Expand Down Expand Up @@ -540,8 +541,8 @@ export class AutIframe {
$el = $root.find(selector)
}
} catch (err) {
// if not a sizzle error, ignore it and let $el be null
if (!sizzleRe.test(err.stack)) throw err
// if not a sizzle or jQuery error, ignore it and let $el be null
if (!(sizzleRe.test(err.stack) || jQueryRe.test(err.stack))) throw err
}

return $el
Expand Down
57 changes: 30 additions & 27 deletions packages/driver/cypress/e2e/commands/actions/scroll.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ describe('src/cy/commands/actions/scroll', () => {
this.scrollBoth.scrollTop = 0
this.scrollBoth.scrollLeft = 0

// width/height of scrollable container - width of parent viewport (minux scrollbars) / 2 to get the center
// width or height of DOM in pixels
this.scrollableContainerWidthHeight = 500
this.elementWidthHeight = 100
this.scrollBarWidthHeight = 15

// divide by 2 to get the center
// browsers round up the pixel value so we need to round it
this.halfScrollPixels = Math.round((500 - 100) / 2)
this.halfScroll = Math.round((this.scrollableContainerWidthHeight - this.elementWidthHeight) / 2)
this.fullScroll = Math.round(this.scrollableContainerWidthHeight - this.elementWidthHeight)
})

describe('subject', () => {
Expand All @@ -48,7 +54,9 @@ describe('src/cy/commands/actions/scroll', () => {

it('can use window', () => {
cy.window().scrollTo('10px').then((win) => {
expect(win.scrollX).to.eq(10)
// Firefox doesn't round this number like other browsers
// So we round in the test to get consistent results here
expect(Math.round(win.scrollX)).to.eq(10)
})
})

Expand Down Expand Up @@ -86,11 +94,10 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-horizontal').scrollTo('50%').then(function () {
// they don't calculate the height of the container
// in the percentage of the scroll (since going the height
// of the container wouldn't scroll at all...)
expect(this.scrollHoriz.get(0).scrollTop).to.eq(0)
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(this.halfScrollPixels)
// since there is no veritical scrollbar to take into account
// this is just half of the basic width
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(this.halfScroll)
})
})
})
Expand All @@ -112,7 +119,7 @@ describe('src/cy/commands/actions/scroll', () => {

cy.get('#scroll-to-both').scrollTo('top').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(0)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll)
})
})

Expand All @@ -122,7 +129,7 @@ describe('src/cy/commands/actions/scroll', () => {

cy.get('#scroll-to-both').scrollTo('topRight').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(0)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.fullScroll)
})
})

Expand All @@ -131,7 +138,7 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('left').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)
})
})
Expand All @@ -141,8 +148,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('center').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll)
})
})

Expand All @@ -151,8 +158,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('right').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((this.fullScroll))
})
})

Expand All @@ -161,7 +168,7 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('bottomLeft').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollTop).to.eq((this.fullScroll))
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)
})
})
Expand All @@ -171,8 +178,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('bottom').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollTop).to.eq((this.fullScroll))
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll)
})
})

Expand All @@ -181,8 +188,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('bottomRight').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollTop).to.eq((this.fullScroll))
expect(this.scrollBoth.get(0).scrollLeft).to.eq((this.fullScroll))
})
})
})
Expand Down Expand Up @@ -233,8 +240,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('50%', '50%').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll)
})
})

Expand All @@ -243,7 +250,7 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('0%', '50%').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)
})
})
Expand All @@ -254,7 +261,7 @@ describe('src/cy/commands/actions/scroll', () => {

cy.get('#scroll-to-both').scrollTo('50%', '0%').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(0)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll)
})
})
})
Expand Down Expand Up @@ -353,12 +360,8 @@ describe('src/cy/commands/actions/scroll', () => {

// https://github.com/cypress-io/cypress/issues/1924
it('skips scrollability check', () => {
const scrollTo = cy.spy($.fn, 'scrollTo')

cy.get('button:first').scrollTo('bottom', { ensureScrollable: false }).then(() => {
cy.stub(Cypress.ensure, 'isScrollable')

expect(scrollTo).to.be.calledWithMatch({}, { ensureScrollable: false })
expect(Cypress.ensure.isScrollable).not.to.be.called
})
})
Expand Down
12 changes: 0 additions & 12 deletions packages/driver/cypress/e2e/commands/assertions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2650,18 +2650,6 @@ describe('src/cy/commands/assertions', () => {

expect({}).to.have.focus
})

it('calls into custom focus pseudos', () => {
cy.$$('button:first').focus()
const stub = cy.spy($.expr.pseudos, 'focus').as('focus')

expect(cy.$$('button:first')).to.have.focus

cy.get('button:first').should('have.focus')
.then(() => {
expect(stub).to.be.calledTwice
})
})
})

context('match', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/cypress/e2e/dom/visibility.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('src/cypress/dom/visibility', () => {
}

// ensure all tests run against a scrollable window
const scrollThisIntoView = add('<div style=`height: 1000px;` /><div>Should be in view</div>')
const scrollThisIntoView = add('<div style=`height: 1000px;`></div><div>Should be in view</div>')

this.$visHidden = add('<ul style="visibility: hidden;"></ul>')
this.$parentVisHidden = add('<div class="invis" style="visibility: hidden;"><button>parent visibility: hidden</button></div>')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('src/cypress/dom/visibility - shadow dom', () => {
}

// ensure all tests run against a scrollable window
const scrollThisIntoView = $(`<div style='height: 1000px; width: 10px;' /><div>Should be in view</div>`).appendTo(cy.$$('body'))
const scrollThisIntoView = $(`<div style='height: 1000px; width: 10px;'></div><div>Should be in view</div>`).appendTo(cy.$$('body'))

// scroll the 2nd element into view so that
// there is always a scrollTop so we ensure
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"is-valid-domain": "0.0.20",
"is-valid-hostname": "1.0.1",
"jimp": "0.22.12",
"jquery": "3.4.1",
"jquery": "3.7.1",
"js-cookie": "3.0.5",
"json-stable-stringify": "1.0.1",
"lodash": "^4.17.21",
Expand Down
Loading