You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am seeing this error
[0-0] Error in "reporter TimelineReporter"
TypeError: Cannot read properties of undefined (reading 'includes')
at TimelineReporter.onAfterCommand (/Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/wdio-timeline-reporter/build/timeline-reporter.js:50:30)
at TimelineReporter.emit (node:events:513:28)
at TimelineReporter.emit (node:domain:489:12)
at file:///Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/runner/build/index.js:503:18
at Array.forEach ()
at BaseReporter.emit (file:///Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/runner/build/index.js:501:21)
at EventEmitter. (file:///Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/runner/build/index.js:793:55)
at EventEmitter.emit (node:events:513:28)
at EventEmitter.emit (node:domain:489:12)
at Browser.WebDriver.prototype. (/Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/utils/build/index.js:453:29)
I looked at the stack and found it is a function in the timeline-report.js file
onAfterCommand(command) {
if (this.reporterOptions.screenshotStrategy !== 'none' &&
command.endpoint.includes('screenshot') &&
command.result &&
command.result.value &&
this.test) {
try {
const filepath = path_1.resolve(this.reporterOptions.outputDir, file-${Date.now()}.jpeg);
var wstream = fs_1.createWriteStream(filepath);
wstream.write(Buffer.from(command.result.value, 'base64'));
wstream.end();
this.test.screenshots.push(filepath);
}
catch (error) {
console.log(error);
}
}
}
Seems the includes that is looking for 'screenshot' to be on the object command.endpoint is throwing an error.
I added some loggers, and I see that it appears each test calls this function twice, one instance it passes the expected object, but the 2nd time it passes an unexpected response that looks like this
Unexpected data format: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function getDocumentScrollHeight() {\n' +
[0-0] ' const viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n' +
[0-0] ' const scrollHeight = document.documentElement.scrollHeight;\n' +
[0-0] ' const bodyScrollHeight = document.body.scrollHeight;\n' +
[0-0] ' // In some situations the default scrollheight can be equal to the viewport height\n' +
[0-0] ' // but the body scroll height can be different, then return that one\n' +
[0-0] ' if (viewPortHeight === scrollHeight && bodyScrollHeight > scrollHeight) {\n' +
[0-0] ' return bodyScrollHeight;\n' +
[0-0] ' }\n' +
[0-0] ' // In some cases we can have a challenge determining the height of the page\n' +
[0-0] ' // due to for example a vh property on the body element.\n' +
[0-0] ' // If that is the case we need to walk over all the elements and determine the highest element\n' +
[0-0] ' // this is a very time consuming thing, so our last hope :(\n' +
[0-0] ' let pageHeight = 0;\n' +
[0-0] " let largestNodeElement = document.querySelector('body');\n" +
[0-0] ' if (bodyScrollHeight === scrollHeight && bodyScrollHeight === viewPortHeight) {\n' +
[0-0] ' findHighestNode(document.documentElement.childNodes);\n' +
[0-0] ' // There could be some elements above this largest element,\n' +
[0-0] ' // add that on top\n' +
[0-0] ' /* istanbul ignore next */\n' +
[0-0] ' return pageHeight + largestNodeElement.getBoundingClientRect().top;\n' +
[0-0] ' }\n' +
[0-0] ' // The scrollHeight is good enough\n' +
[0-0] ' return scrollHeight;\n' +
[0-0] ' /**\n' +
[0-0] ' * Find the largest html element on the page\n' +
[0-0] ' * @param nodesList\n' +
[0-0] ' /\n' +
[0-0] ' function findHighestNode(nodesList) {\n' +
[0-0] ' for (let i = nodesList.length - 1; i >= 0; i--) {\n' +
[0-0] ' const currentNode = nodesList[i];\n' +
[0-0] ' / istanbul ignore next */\n' +
[0-0] ' if (currentNode.scrollHeight && currentNode.clientHeight) {\n' +
[0-0] ' const elHeight = Math.max(currentNode.scrollHeight, currentNode.clientHeight);\n' +
[0-0] ' pageHeight = Math.max(elHeight, pageHeight);\n' +
[0-0] ' if (elHeight === pageHeight) {\n' +
[0-0] ' largestNodeElement = currentNode;\n' +
[0-0] ' }\n' +
[0-0] ' }\n' +
[0-0] ' if (currentNode.childNodes.length) {\n' +
[0-0] ' findHighestNode(currentNode.childNodes);\n' +
[0-0] ' }\n' +
[0-0] ' }\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: []
[0-0] },
[0-0] result: { value: 1694 },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Received data: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function hideScrollBars(hide) {\n' +
[0-0] ' try {\n' +
[0-0] " document.body.style.overflow = hide ? 'hidden' : '';\n" +
[0-0] ' }\n' +
[0-0] ' catch (_e) {\n' +
[0-0] ' // Do nothing\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ false ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Unexpected data format: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function hideScrollBars(hide) {\n' +
[0-0] ' try {\n' +
[0-0] " document.body.style.overflow = hide ? 'hidden' : '';\n" +
[0-0] ' }\n' +
[0-0] ' catch (_e) {\n' +
[0-0] ' // Do nothing\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ false ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Received data: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function removeElementFromDom(id) {\n' +
[0-0] ' const elem = document.querySelector(#${id});\n' +
[0-0] ' if (elem) {\n' +
[0-0] ' elem.parentNode.removeChild(elem);\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ 'pic-css' ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Unexpected data format: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function removeElementFromDom(id) {\n' +
[0-0] ' const elem = document.querySelector(#${id});\n' +
[0-0] ' if (elem) {\n' +
[0-0] ' elem.parentNode.removeChild(elem);\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ 'pic-css' ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Received data: {
[0-0] name: 'checkFullPageScreen',
[0-0] result: 0,
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Unexpected data format: {
[0-0] name: 'checkFullPageScreen',
[0-0] result: 0,
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
AND DUE TO THIS IT THROWS THE ERROR.. DOESNT SEEM TO INPACT THE RESULTS BUT SEEMS TO BE A BUG
The text was updated successfully, but these errors were encountered:
I am seeing this error
[0-0] Error in "reporter TimelineReporter"
TypeError: Cannot read properties of undefined (reading 'includes')
at TimelineReporter.onAfterCommand (/Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/wdio-timeline-reporter/build/timeline-reporter.js:50:30)
at TimelineReporter.emit (node:events:513:28)
at TimelineReporter.emit (node:domain:489:12)
at file:///Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/runner/build/index.js:503:18
at Array.forEach ()
at BaseReporter.emit (file:///Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/runner/build/index.js:501:21)
at EventEmitter. (file:///Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/runner/build/index.js:793:55)
at EventEmitter.emit (node:events:513:28)
at EventEmitter.emit (node:domain:489:12)
at Browser.WebDriver.prototype. (/Users/t85kzfl/Desktop/GIT/nyl-aem-automation/webdriverio/node_modules/@wdio/utils/build/index.js:453:29)
I looked at the stack and found it is a function in the timeline-report.js file
onAfterCommand(command) {
if (this.reporterOptions.screenshotStrategy !== 'none' &&
command.endpoint.includes('screenshot') &&
command.result &&
command.result.value &&
this.test) {
try {
const filepath = path_1.resolve(this.reporterOptions.outputDir,
file-${Date.now()}.jpeg
);var wstream = fs_1.createWriteStream(filepath);
wstream.write(Buffer.from(command.result.value, 'base64'));
wstream.end();
this.test.screenshots.push(filepath);
}
catch (error) {
console.log(error);
}
}
}
Seems the includes that is looking for 'screenshot' to be on the object command.endpoint is throwing an error.
I added some loggers, and I see that it appears each test calls this function twice, one instance it passes the expected object, but the 2nd time it passes an unexpected response that looks like this
Unexpected data format: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function getDocumentScrollHeight() {\n' +
[0-0] ' const viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n' +
[0-0] ' const scrollHeight = document.documentElement.scrollHeight;\n' +
[0-0] ' const bodyScrollHeight = document.body.scrollHeight;\n' +
[0-0] ' // In some situations the default scrollheight can be equal to the viewport height\n' +
[0-0] ' // but the body scroll height can be different, then return that one\n' +
[0-0] ' if (viewPortHeight === scrollHeight && bodyScrollHeight > scrollHeight) {\n' +
[0-0] ' return bodyScrollHeight;\n' +
[0-0] ' }\n' +
[0-0] ' // In some cases we can have a challenge determining the height of the page\n' +
[0-0] ' // due to for example a
vh
property on the body element.\n' +[0-0] ' // If that is the case we need to walk over all the elements and determine the highest element\n' +
[0-0] ' // this is a very time consuming thing, so our last hope :(\n' +
[0-0] ' let pageHeight = 0;\n' +
[0-0] " let largestNodeElement = document.querySelector('body');\n" +
[0-0] ' if (bodyScrollHeight === scrollHeight && bodyScrollHeight === viewPortHeight) {\n' +
[0-0] ' findHighestNode(document.documentElement.childNodes);\n' +
[0-0] ' // There could be some elements above this largest element,\n' +
[0-0] ' // add that on top\n' +
[0-0] ' /* istanbul ignore next */\n' +
[0-0] ' return pageHeight + largestNodeElement.getBoundingClientRect().top;\n' +
[0-0] ' }\n' +
[0-0] ' // The scrollHeight is good enough\n' +
[0-0] ' return scrollHeight;\n' +
[0-0] ' /**\n' +
[0-0] ' * Find the largest html element on the page\n' +
[0-0] ' * @param nodesList\n' +
[0-0] ' /\n' +
[0-0] ' function findHighestNode(nodesList) {\n' +
[0-0] ' for (let i = nodesList.length - 1; i >= 0; i--) {\n' +
[0-0] ' const currentNode = nodesList[i];\n' +
[0-0] ' / istanbul ignore next */\n' +
[0-0] ' if (currentNode.scrollHeight && currentNode.clientHeight) {\n' +
[0-0] ' const elHeight = Math.max(currentNode.scrollHeight, currentNode.clientHeight);\n' +
[0-0] ' pageHeight = Math.max(elHeight, pageHeight);\n' +
[0-0] ' if (elHeight === pageHeight) {\n' +
[0-0] ' largestNodeElement = currentNode;\n' +
[0-0] ' }\n' +
[0-0] ' }\n' +
[0-0] ' if (currentNode.childNodes.length) {\n' +
[0-0] ' findHighestNode(currentNode.childNodes);\n' +
[0-0] ' }\n' +
[0-0] ' }\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: []
[0-0] },
[0-0] result: { value: 1694 },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Received data: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function hideScrollBars(hide) {\n' +
[0-0] ' try {\n' +
[0-0] " document.body.style.overflow = hide ? 'hidden' : '';\n" +
[0-0] ' }\n' +
[0-0] ' catch (_e) {\n' +
[0-0] ' // Do nothing\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ false ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Unexpected data format: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function hideScrollBars(hide) {\n' +
[0-0] ' try {\n' +
[0-0] " document.body.style.overflow = hide ? 'hidden' : '';\n" +
[0-0] ' }\n' +
[0-0] ' catch (_e) {\n' +
[0-0] ' // Do nothing\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ false ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Received data: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function removeElementFromDom(id) {\n' +
[0-0] ' const elem = document.querySelector(
#${id}
);\n' +[0-0] ' if (elem) {\n' +
[0-0] ' elem.parentNode.removeChild(elem);\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ 'pic-css' ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Unexpected data format: {
[0-0] command: 'executeScript',
[0-0] method: 'POST',
[0-0] endpoint: '/session/:sessionId/execute/sync',
[0-0] body: {
[0-0] script: '\n' +
[0-0] " var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;\n" +
[0-0] ' return (function removeElementFromDom(id) {\n' +
[0-0] ' const elem = document.querySelector(
#${id}
);\n' +[0-0] ' if (elem) {\n' +
[0-0] ' elem.parentNode.removeChild(elem);\n' +
[0-0] ' }\n' +
[0-0] '}).apply(null, arguments)\n' +
[0-0] ' ',
[0-0] args: [ 'pic-css' ]
[0-0] },
[0-0] result: { value: null },
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Received data: {
[0-0] name: 'checkFullPageScreen',
[0-0] result: 0,
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
[0-0] Unexpected data format: {
[0-0] name: 'checkFullPageScreen',
[0-0] result: 0,
[0-0] sessionId: '5548e1ceeafa433eaaa093f3c2af269d',
[0-0] cid: '0-0'
[0-0] }
AND DUE TO THIS IT THROWS THE ERROR.. DOESNT SEEM TO INPACT THE RESULTS BUT SEEMS TO BE A BUG
The text was updated successfully, but these errors were encountered: