Skip to content

Commit

Permalink
Attempt to fix failures with chrome-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueWinds committed Feb 7, 2022
1 parent 74e964e commit ed0ed36
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/driver/src/cy/chai/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export function create (chai) {
typeof object.nodeName === 'string'
}

// We can't just check if object instanceof Document, because it might be the document of an iframe,
// which in Chrome 99+ is a separate class, and instanceof Document returns false.
let isDocument = function (object) {
return object.defaultView && object.defaultView === object.defaultView.window
}

let formatValueHook

const setFormatValueHook = (fn) => formatValueHook = fn
Expand Down Expand Up @@ -124,6 +130,10 @@ export function create (chai) {
}
}

if (isDocument(value)) {
return value.documentElement.outerHTML
}

// Look up the keys of the object.
let visibleKeys = getEnumerableProperties(value)
let keys = ctx.showHidden ? getProperties(value) : visibleKeys
Expand Down

0 comments on commit ed0ed36

Please sign in to comment.