Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d8fa85d
Author: Chris Breiding <chrisbreiding@users.noreply.github.com>
Date:   Fri Jan 14 09:48:43 2022 -0500

    chore: Fix a couple multi-domain bugs (#19698)

commit 2e5fbad
Author: Chris Breiding <chrisbreiding@gmail.com>
Date:   Thu Jan 13 11:44:35 2022 -0500

    fix types issue

commit cc08d12
Author: Chris Breiding <chrisbreiding@gmail.com>
Date:   Thu Jan 13 09:56:31 2022 -0500

    fix issues after merge

commit 8e0770f
Merge: 2ee9893 d87711e
Author: Chris Breiding <chrisbreiding@gmail.com>
Date:   Thu Jan 13 09:31:25 2022 -0500

    Merge branch 'develop' into feature-multidomain

commit d87711e
Merge: 576519e f22e3ca
Author: Brian Barrow <briancbarrow@gmail.com>
Date:   Wed Jan 12 16:41:35 2022 +0000

    Merge branch 'master' into develop

commit f22e3ca
Author: Brian Barrow <briancbarrow@gmail.com>
Date:   Wed Jan 12 09:40:48 2022 -0700

    Fixed Vue README links in Global Components section (#19550)

commit 576519e
Author: Pascal Gafner <gafner.pascal@gmail.com>
Date:   Wed Jan 12 15:52:26 2022 +0100

    fix: use util.getEnv to handle environment variables set with npm (#19560)

    Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
    Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>

commit 0382768
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Jan 11 21:35:43 2022 +0000

    chore(deps): update dependency electron to v15.3.4 🌟 (#19657)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 1305cca
Author: Lachlan Miller <lachlan.miller.1990@outlook.com>
Date:   Wed Jan 12 07:10:14 2022 +1000

    fix: rename specs to correctly match convention (#19641)

    * fix: rename specs to correctly match convention

    * Remove underscore from TESTFILES glob pattern

    Co-authored-by: Zach Bloomquist <github@chary.us>

commit c45a240
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Jan 11 12:59:14 2022 -0800

    fix(deps): update dependency node-forge to v1 [security] (#19635)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit ea531b7
Author: Kukhyeon Heo <sainthkh@naver.com>
Date:   Wed Jan 12 00:37:05 2022 +0900

    chore: remove pkg/driver //@ts-nocheck part 2 (#19483)

    * listeners.ts

    * chainer.ts

    * command.ts

    * actionability.ts

    * inspect.ts

    * agents.ts

    * aliasing.ts

    * angular.ts

    * asserting.ts

    * clock.ts files

    * commands.ts

    * debugging.ts

    * fix comment.

    * roll back change.

    * Fix.

    * fix

    * Casted to cast.

    * Feedback changes.

    * fix any.

commit 513074e
Author: Josh Wooding <12938082+joshwooding@users.noreply.github.com>
Date:   Tue Jan 11 15:34:01 2022 +0000

    fix: overflow clip to prevent selector header from disapearing (#18649) (#19646)

    Co-authored-by: Tim Griesser <tgriesser10@gmail.com>

commit b8ccf12
Merge: 2071575 d227420
Author: Ryan Manuel <ryanm@cypress.io>
Date:   Mon Jan 10 15:38:23 2022 -0600

    Merge branch 'develop'

commit d227420
Author: Ryan Manuel <ryanm@cypress.io>
Date:   Mon Jan 10 15:34:34 2022 -0600

    release 9.2.1 [skip ci]

commit 5d1dce6
Author: Ryan Manuel <ryanm@cypress.io>
Date:   Mon Jan 10 13:01:12 2022 -0600

    Merge master to dev

commit 4818a21
Author: Juan Julián Merelo Guervós <jjmerelo@gmail.com>
Date:   Mon Jan 10 19:52:32 2022 +0100

    fix: update cli-table dependency to fix broken colors.js (#19622)

    Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
    Co-authored-by: Ryan Manuel <ryanm@cypress.io>

commit 2071575
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Mon Jan 10 11:23:17 2022 -0500

    chore: release @cypress/react-v5.12.1

    [skip ci]

commit 3f85a04
Merge: 642ec41 6304fd7
Author: Zachary Williams <ZachJW34@gmail.com>
Date:   Mon Jan 10 16:02:22 2022 +0000

    Merge branch 'master' into develop

commit 6304fd7
Author: Zachary Williams <ZachJW34@gmail.com>
Date:   Mon Jan 10 10:01:27 2022 -0600

    fix: check resolvedNodePath for Next.js 12 guard (#19604)

commit 10e3e0a
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Tue Dec 21 14:35:12 2021 -0500

    chore: release @cypress/react-v5.12.0

    [skip ci]
  • Loading branch information
mschile committed Jan 18, 2022
1 parent efe6316 commit 199c983
Show file tree
Hide file tree
Showing 39 changed files with 383 additions and 225 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Expand Up @@ -407,7 +407,7 @@ commands:
yarn cypress:run --record --parallel --group 5x-driver-<<parameters.browser>> --browser <<parameters.browser>>
else
# external PR
TESTFILES=$(circleci tests glob "cypress/integration/**/*_spec.*" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
TESTFILES=$(circleci tests glob "cypress/integration/**/*spec.*" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
echo "Test files for this machine are $TESTFILES"
if [[ -z "$TESTFILES" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/tasks/verify.js
Expand Up @@ -15,7 +15,7 @@ const logger = require('../logger')
const xvfb = require('../exec/xvfb')
const state = require('./state')

const VERIFY_TEST_RUNNER_TIMEOUT_MS = +process.env.CYPRESS_VERIFY_TIMEOUT || 30000
const VERIFY_TEST_RUNNER_TIMEOUT_MS = +util.getEnv('CYPRESS_VERIFY_TIMEOUT') || 30000

const checkExecutable = (binaryDir) => {
const executable = state.getPathToExecutable(binaryDir)
Expand Down
6 changes: 3 additions & 3 deletions cli/package.json
Expand Up @@ -24,7 +24,7 @@
"@cypress/request": "^2.88.10",
"@cypress/xvfb": "^1.2.4",
"@types/node": "^14.14.31",
"@types/sinonjs__fake-timers": "^6.0.2",
"@types/sinonjs__fake-timers": "8.1.1",
"@types/sizzle": "^2.3.2",
"arch": "^2.2.0",
"blob-util": "^2.0.2",
Expand All @@ -33,7 +33,7 @@
"chalk": "^4.1.0",
"check-more-types": "^2.24.0",
"cli-cursor": "^3.1.0",
"cli-table3": "~0.6.0",
"cli-table3": "~0.6.1",
"commander": "^5.1.0",
"common-tags": "^1.8.0",
"dayjs": "^1.10.4",
Expand Down Expand Up @@ -75,7 +75,7 @@
"@types/lodash": "4.14.168",
"@types/minimatch": "3.0.3",
"@types/mocha": "8.0.3",
"@types/sinon": "7.5.1",
"@types/sinon": "9.0.9",
"@types/sinon-chai": "3.2.5",
"chai": "3.5.0",
"chai-as-promised": "7.1.1",
Expand Down
8 changes: 8 additions & 0 deletions cli/test/lib/tasks/verify_spec.js
Expand Up @@ -81,6 +81,14 @@ context('lib/tasks/verify', () => {
expect(newVerifyInstance.VERIFY_TEST_RUNNER_TIMEOUT_MS).to.eql(500000)
})

it('accepts custom verify task timeout from npm', () => {
process.env.npm_config_CYPRESS_VERIFY_TIMEOUT = '500000'
delete require.cache[require.resolve(`${lib}/tasks/verify`)]
const newVerifyInstance = require(`${lib}/tasks/verify`)

expect(newVerifyInstance.VERIFY_TEST_RUNNER_TIMEOUT_MS).to.eql(500000)
})

it('falls back to default verify task timeout if custom value is invalid', () => {
process.env.CYPRESS_VERIFY_TIMEOUT = 'foobar'
delete require.cache[require.resolve(`${lib}/tasks/verify`)]
Expand Down
14 changes: 14 additions & 0 deletions npm/react/CHANGELOG.md
@@ -1,3 +1,17 @@
# [@cypress/react-v5.12.1](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.12.0...@cypress/react-v5.12.1) (2022-01-10)


### Bug Fixes

* check resolvedNodePath for Next.js 12 guard ([#19604](https://github.com/cypress-io/cypress/issues/19604)) ([6304fd7](https://github.com/cypress-io/cypress/commit/6304fd7548a0a3fee90fc8a9ba449ab81e7a7a0c))

# [@cypress/react-v5.12.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.11.0...@cypress/react-v5.12.0) (2021-12-21)


### Features

* support create-react-app v5 ([#19434](https://github.com/cypress-io/cypress/issues/19434)) ([415a7b1](https://github.com/cypress-io/cypress/commit/415a7b149aaac37ae605dc1a11007bad29187dc5))

# [@cypress/react-v5.11.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.10.3...@cypress/react-v5.11.0) (2021-12-16)


Expand Down
8 changes: 5 additions & 3 deletions npm/react/plugins/next/checkSWC.ts
Expand Up @@ -10,9 +10,11 @@ export function checkSWC (
)
})

if (hasSWCLoader && cypressConfig.nodeVersion !== 'system') {
throw new Error(`Cypress requires "nodeVersion" to be set to "system" in order to run Next.js with SWC optimizations.
Please add "nodeVersion": "system" to your Cypress configuration and try again.`)
// "resolvedNodePath" is only set when using the user's Node.js, which is required to compile Next.js with SWC optimizations
// If it is not set, they have either explicitly set "nodeVersion" to "bundled" or are are using Cypress < 9.0.0 where it was set to "bundled" by default
if (hasSWCLoader && !cypressConfig.resolvedNodePath) {
throw new Error(`Cannot compile Next.js application with configured Node.js.
If you are on Cypress version >= \`9.0.0\`, remove the "nodeVersion" property from your Cypress config. Otherwise, please add "nodeVersion": "system" to your Cypress config and try again.`)
}

return false
Expand Down
8 changes: 4 additions & 4 deletions npm/vue/README.md
Expand Up @@ -122,10 +122,10 @@ You can pass extensions (global components, mixins, modules to use)
when mounting Vue component. Use `{ extensions: { ... }}` object inside
the `options`.

- `components` - object of 'id' and components to register globally, see [Components](cypress/component/basic/components) example
- `use` (alias `plugins`) - list of plugins, see [Plugins](cypress/component/basic/plugins)
- `mixin` (alias `mixins`) - list of global mixins, see [Mixins](cypress/component/basic/mixins) example
- `filters` - hash of global filters, see [Filters](cypress/component/basic/filters) example
- `components` - object of 'id' and components to register globally, see [Components](npm/vue/cypress/component/basic/components) example
- `use` (alias `plugins`) - list of plugins, see [Plugins](npm/vue/cypress/component/basic/plugins)
- `mixin` (alias `mixins`) - list of global mixins, see [Mixins](npm/vue/cypress/component/basic/mixins) example
- `filters` - hash of global filters, see [Filters](npm/vue/cypress/component/basic/filters) example

### intro example

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "cypress",
"version": "9.2.0",
"version": "9.2.1",
"description": "Cypress.io end to end testing tool",
"private": true,
"scripts": {
Expand Down
45 changes: 45 additions & 0 deletions packages/driver/cypress/integration/dom/coordinates_spec.ts
@@ -1,3 +1,6 @@
import $coordinates from '../../../src/dom/coordinates'
import $elements from '../../../src/dom/elements'

const { $ } = Cypress

export {}
Expand Down Expand Up @@ -233,6 +236,48 @@ describe('src/dom/coordinates', () => {
})
})

context('isAUTFrame', () => {
const { isAUTFrame } = $coordinates

// our test for a window is that it has a `window` that refers
// to itself
const getWindowLikeObject = () => {
const win = { parent: {} as any }

win.parent.window = win.parent

return win
}

it('returns true if parent is a window and not an iframe', () => {
const win = getWindowLikeObject()

expect(isAUTFrame(win)).to.be.true
})

it('returns true if parent is a window and getting its frameElement property throws an error', () => {
const win = getWindowLikeObject()

cy.stub($elements, 'getNativeProp').throws('cross-origin error')

expect(isAUTFrame(win)).to.be.true
})

it('returns false if parent is not a window', () => {
const win = { parent: {} }

expect(isAUTFrame(win)).to.be.false
})

it('returns false if parent is an iframe', () => {
const win = getWindowLikeObject()

cy.stub($elements, 'getNativeProp').returns(true)

expect(isAUTFrame(win)).to.be.false
})
})

context('span spanning multiple lines', () => {
it('gets first dom rect in multiline text', () => {
$(`\
Expand Down
27 changes: 15 additions & 12 deletions packages/driver/cypress/integration/e2e/multi_domain_spec.ts
Expand Up @@ -18,6 +18,17 @@ describe('multi-domain', { experimentalSessionSupport: true, experimentalMultiDo
cy.log('after switchToDomain')
})

it('handles querying nested elements', () => {
cy.switchToDomain('foobar.com', () => {
cy
.get('form button')
.invoke('text')
.should('equal', 'Submit')
})

cy.log('after switchToDomain')
})

it('sets up window.Cypress in secondary domain', () => {
cy.switchToDomain('foobar.com', () => {
cy
Expand Down Expand Up @@ -138,9 +149,7 @@ describe('multi-domain', { experimentalSessionSupport: true, experimentalMultiDo
done()
})

cy.get('[data-cy="alert"]').then(($el) => {
$el.trigger('click')
})
cy.get('[data-cy="alert"]').click()
})
})

Expand All @@ -152,9 +161,7 @@ describe('multi-domain', { experimentalSessionSupport: true, experimentalMultiDo
done()
})

cy.get('[data-cy="confirm"]').then(($el) => {
$el.trigger('click')
})
cy.get('[data-cy="confirm"]').click()
})
})

Expand All @@ -171,9 +178,7 @@ describe('multi-domain', { experimentalSessionSupport: true, experimentalMultiDo
return true
})

cy.get('[data-cy="confirm"]').then(($el) => {
$el.trigger('click')
})
cy.get('[data-cy="confirm"]').click()
})
})

Expand All @@ -191,9 +196,7 @@ describe('multi-domain', { experimentalSessionSupport: true, experimentalMultiDo

Cypress.on('window:confirm', () => {})

cy.get('[data-cy="confirm"]').then(($el) => {
$el.trigger('click')
})
cy.get('[data-cy="confirm"]').click()
})
})
})
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/package.json
Expand Up @@ -24,11 +24,12 @@
"@packages/server": "0.0.0-development",
"@packages/ts": "0.0.0-development",
"@rollup/plugin-node-resolve": "^13.0.4",
"@sinonjs/fake-timers": "7.0.2",
"@sinonjs/fake-timers": "8.1.0",
"@types/chalk": "^2.2.0",
"@types/common-tags": "^1.8.0",
"@types/jquery.scrollto": "1.4.29",
"@types/mocha": "^8.0.3",
"@types/sinonjs__fake-timers": "8.1.1",
"@types/underscore.string": "0.0.38",
"angular": "1.8.0",
"basic-auth": "2.0.1",
Expand Down
20 changes: 11 additions & 9 deletions packages/driver/src/cy/actionability.ts
@@ -1,10 +1,10 @@
// @ts-nocheck
import _ from 'lodash'
import $ from 'jquery'
import Promise from 'bluebird'

import debugFn from 'debug'
import $dom from '../dom'
import type { ElWindowPostion, ElViewportPostion } from '../dom/coordinates'
import $elements from '../dom/elements'
import $errUtils from '../cypress/error_utils'
const debug = debugFn('cypress:driver:actionability')
Expand Down Expand Up @@ -54,7 +54,7 @@ const getPositionFromArguments = function (positionOrX, y, options) {
}

const ensureElIsNotCovered = function (cy, win, $el, fromElViewport, options, log, onScroll) {
let $elAtCoords = null
let $elAtCoords: JQuery<any> | null = null

const getElementAtPointFromViewport = function (fromElViewport) {
// get the element at point from the viewport based
Expand All @@ -64,8 +64,12 @@ const ensureElIsNotCovered = function (cy, win, $el, fromElViewport, options, lo
elAtCoords = $dom.getElementAtPointFromViewport(win.document, fromElViewport.x, fromElViewport.y)

if (elAtCoords) {
return $elAtCoords = $dom.wrap(elAtCoords)
$elAtCoords = $dom.wrap(elAtCoords)

return $elAtCoords
}

return null
}

const ensureDescendents = function (fromElViewport) {
Expand Down Expand Up @@ -164,7 +168,7 @@ const ensureElIsNotCovered = function (cy, win, $el, fromElViewport, options, lo
const scrollContainers = function (scrollables) {
// hold onto all the elements we've scrolled
// past in this cycle
const elementsScrolledPast = []
const elementsScrolledPast: JQuery<any>[] = []

// pull off scrollables starting with the most outer
// container which is window
Expand All @@ -178,9 +182,7 @@ const ensureElIsNotCovered = function (cy, win, $el, fromElViewport, options, lo

const possiblyScrollMultipleTimes = function ($fixed) {
// if we got something AND
let needle

if ($fixed && ((needle = $fixed.get(0), !elementsScrolledPast.includes(needle)))) {
if ($fixed && !elementsScrolledPast.includes($fixed.get(0))) {
elementsScrolledPast.push($fixed.get(0))

scrollContainerPastElement($scrollableContainer, $fixed)
Expand Down Expand Up @@ -229,7 +231,7 @@ const ensureElIsNotCovered = function (cy, win, $el, fromElViewport, options, lo

try {
ensureDescendentsAndScroll()
} catch (error) {
} catch (error: any) {
const err = error

if (log) {
Expand Down Expand Up @@ -352,7 +354,7 @@ const verify = function (cy, $el, config, options, callbacks) {
}

return Promise.try(() => {
const coordsHistory = []
const coordsHistory: (ElViewportPostion | ElWindowPostion)[] = []

const runAllChecks = function () {
let $elAtCoords
Expand Down
4 changes: 1 addition & 3 deletions packages/driver/src/cy/chai/inspect.ts
@@ -1,5 +1,3 @@
// @ts-nocheck

// Changes made: added 'formatValueHook' to process value before being formatted.
// For example the hook can be used to turn `window` objects into the string '[window]'
// to avoid deep recursion.
Expand Down Expand Up @@ -272,7 +270,7 @@ export function create (chai) {
}

function formatArray (ctx, value, recurseTimes, visibleKeys, keys) {
let output = []
let output: string[] = []

for (let i = 0, l = value.length; i < l; ++i) {
if (Object.prototype.hasOwnProperty.call(value, String(i))) {
Expand Down

0 comments on commit 199c983

Please sign in to comment.