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

Merged
merged 28 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 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
eea3036
Merge branch 'release/14.0.0' into remove-jquery-patch
jennifer-shehane Oct 28, 2024
2f31b3a
Merge branch 'release/14.0.0' into remove-jquery-patch
jennifer-shehane Oct 29, 2024
57c2304
Merge branch 'release/14.0.0' into remove-jquery-patch
jennifer-shehane Nov 1, 2024
01faf00
added patch for :focus selector
mschile Nov 4, 2024
c73de3d
Move changelog entry to 4.0
jennifer-shehane Nov 4, 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
2 changes: 2 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ _Released 12/3/2024 (PENDING)_

- Upgraded `electron` from `27.3.10` to `32.2.0`. Addresses [#29547](https://github.com/cypress-io/cypress/issues/29547).
- Upgraded bundled Chromium version from `118.0.5993.159` to `128.0.6613.178`. Addresses [#29547](https://github.com/cypress-io/cypress/issues/29547).
- Updated `jQuery` from `3.4.1` to `3.7.1`. Addressed in [#30345](https://github.com/cypress-io/cypress/pull/30345).


## 13.15.2
Expand All @@ -34,6 +35,7 @@ _Released 11/5/2024 (PENDING)_

- Updated `@cypress/request` from `3.0.4` to `3.0.6`. Addressed in [#30488](https://github.com/cypress-io/cypress/pull/30488).


## 13.15.1

_Released 10/24/2024_
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
"**/@types/enzyme": "3.10.5",
"**/@types/react": "16.9.50",
"**/@wdio/logger": "9.0.0",
"**/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]')
Comment on lines +40 to +41
Copy link
Member Author

Choose a reason for hiding this comment

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

just fixing chaining of a test that was found to match our recommendations


// 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
Comment on lines +544 to +545
Copy link
Member Author

Choose a reason for hiding this comment

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

jQuery no longer relies so much on sizzle, so these stack traces changed and are coming from jQuery now.

}

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)
Comment on lines +31 to +39
Copy link
Member Author

Choose a reason for hiding this comment

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

Just cleaning this up to make these arbitrary numbers more understandable.

})

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>')
Copy link
Member Author

Choose a reason for hiding this comment

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

jQuery no longer gracefully handles DOM that is not valid - so this would no longer create the accurate DOM to test against. This was just written wrong at some point.


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